diff --git a/lib-ts/src-ts/_internalnterfaces.d.ts b/dist/_internalnterfaces.d.ts similarity index 100% rename from lib-ts/src-ts/_internalnterfaces.d.ts rename to dist/_internalnterfaces.d.ts diff --git a/lib-ts/src-ts/_internalnterfaces.js b/dist/_internalnterfaces.js similarity index 100% rename from lib-ts/src-ts/_internalnterfaces.js rename to dist/_internalnterfaces.js diff --git a/dist/_internalnterfaces.js.map b/dist/_internalnterfaces.js.map new file mode 100644 index 0000000000000000000000000000000000000000..903f44af2c38024d9e78315d78449548e1de4c10 --- /dev/null +++ b/dist/_internalnterfaces.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_internalnterfaces.js","sourceRoot":"","sources":["../src-ts/_internalnterfaces.ts"],"names":[],"mappings":"AAAA;;GAEG"} \ No newline at end of file diff --git a/dist/_scratch/Hello.d.ts b/dist/_scratch/Hello.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..57cc0823bd38069c104d182abb1755031265666c --- /dev/null +++ b/dist/_scratch/Hello.d.ts @@ -0,0 +1,11 @@ +/** + * Created by gavorhes on 9/22/2016. + */ +import * as React from "react"; +export interface HelloProps { + compiler: string; + framework: string; +} +export declare class Hello extends React.Component<HelloProps, {}> { + render(): JSX.Element; +} diff --git a/dist/_scratch/Hello.js b/dist/_scratch/Hello.js new file mode 100644 index 0000000000000000000000000000000000000000..e494b54dfdcff6c3dd1f674c23a3b6e5c9c747b3 --- /dev/null +++ b/dist/_scratch/Hello.js @@ -0,0 +1,22 @@ +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +/** + * Created by gavorhes on 9/22/2016. + */ +var React = require("react"); +var Hello = (function (_super) { + __extends(Hello, _super); + function Hello() { + _super.apply(this, arguments); + } + Hello.prototype.render = function () { + return React.createElement("h1", null, "Hello from ", this.props.compiler, " and ", this.props.framework, "!"); + }; + return Hello; +}(React.Component)); +exports.Hello = Hello; +//# sourceMappingURL=Hello.js.map \ No newline at end of file diff --git a/dist/_scratch/Hello.js.map b/dist/_scratch/Hello.js.map new file mode 100644 index 0000000000000000000000000000000000000000..193287e871e28fcf64ce94bef0ebbcb30ef39991 --- /dev/null +++ b/dist/_scratch/Hello.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Hello.js","sourceRoot":"","sources":["../../src-ts/_scratch/Hello.tsx"],"names":[],"mappings":";;;;;;AAAA;;GAEG;AACH,IAAY,KAAK,WAAM,OAAO,CAAC,CAAA;AAI/B;IAA2B,yBAA+B;IAA1D;QAA2B,8BAA+B;IAI1D,CAAC;IAHG,sBAAM,GAAN;QACI,MAAM,CAAC,qBAAC,EAAE,wBAAa,IAAI,CAAC,KAAK,CAAC,QAAS,WAAM,IAAI,CAAC,KAAK,CAAC,SAAU,MAAM,CAAC;IACjF,CAAC;IACL,YAAC;AAAD,CAAC,AAJD,CAA2B,KAAK,CAAC,SAAS,GAIzC;AAJY,aAAK,QAIjB,CAAA"} \ No newline at end of file diff --git a/lib-ts/src-ts/_test/my_little_test.d.ts b/dist/_test/another.d.ts similarity index 100% rename from lib-ts/src-ts/_test/my_little_test.d.ts rename to dist/_test/another.d.ts diff --git a/dist/_test/another.js b/dist/_test/another.js new file mode 100644 index 0000000000000000000000000000000000000000..8080833a5414a71126bf87b80b5e6dc084b0c5d7 --- /dev/null +++ b/dist/_test/another.js @@ -0,0 +1,6 @@ +/** + * Created by gavorhes on 9/22/2016. + */ +console.log('here is another'); +console.log('here is another'); +//# sourceMappingURL=another.js.map \ No newline at end of file diff --git a/dist/_test/another.js.map b/dist/_test/another.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7f3f01d36b98d5b0fad5ebd523ae0b9b92ca5ae3 --- /dev/null +++ b/dist/_test/another.js.map @@ -0,0 +1 @@ +{"version":3,"file":"another.js","sourceRoot":"","sources":["../../src-ts/_test/another.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAC/B,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC"} \ No newline at end of file diff --git a/lib-ts/src-ts/index.d.ts b/dist/_test/compare-test.d.ts similarity index 100% rename from lib-ts/src-ts/index.d.ts rename to dist/_test/compare-test.d.ts diff --git a/dist/_test/compare-test.js b/dist/_test/compare-test.js new file mode 100644 index 0000000000000000000000000000000000000000..7bd10e076ae29e53a3d0f3b8af9a3358d17d1794 --- /dev/null +++ b/dist/_test/compare-test.js @@ -0,0 +1,41 @@ +"use strict"; +/** + * Created by gavorhes on 6/1/2016. + */ +var quickMap_1 = require('../olHelpers/quickMap'); +var layerSwipe_1 = require('../olHelpers/layerSwipe'); +var LayerEsriMapServer_1 = require('../layers/LayerEsriMapServer'); +var map = quickMap_1.quickMap(); +var swiper = new layerSwipe_1.default(map); +var wisDotRegions = new LayerEsriMapServer_1.LayerEsriMapServer('http://transportal.cee.wisc.edu/applications/arcgis2/rest/services/MetaManager/Metamanager_regions/MapServer', { + minZoom: 6, + maxZoom: 12, + name: 'WisDOT Regions', + useEsriStyle: true +}); +var metamanagerSegments = new LayerEsriMapServer_1.LayerEsriMapServer('http://transportal.cee.wisc.edu/applications/arcgis2/rest/services/MetaManager/MM_All_Segments/MapServer', { + minZoom: 7, + visible: true, + name: 'Metamanager Segments' +}); +var truckSpeed2014 = new LayerEsriMapServer_1.LayerEsriMapServer('http://transportal.cee.wisc.edu/applications/arcgis2/rest/services/NPMRDS/compareDynamic/MapServer', { + minZoom: 7, + visible: true, + name: 'truck2014', + showLayers: [8] +}); +var truckSpeed2015 = new LayerEsriMapServer_1.LayerEsriMapServer('http://transportal.cee.wisc.edu/applications/arcgis2/rest/services/NPMRDS/compareDynamic/MapServer', { + minZoom: 7, + visible: true, + name: 'truck2015', + showLayers: [9] +}); +map.addLayer(wisDotRegions.olLayer); +map.addLayer(truckSpeed2014.olLayer); +map.addLayer(truckSpeed2015.olLayer); +map.addLayer(metamanagerSegments.olLayer); +swiper.addLeftLayer(wisDotRegions); +swiper.addRightLayer(metamanagerSegments); +swiper.addLeftLayer(truckSpeed2014); +swiper.addRightLayer(truckSpeed2015); +//# sourceMappingURL=compare-test.js.map \ No newline at end of file diff --git a/dist/_test/compare-test.js.map b/dist/_test/compare-test.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c9710e375f658b29f2493044f7a669854863dad7 --- /dev/null +++ b/dist/_test/compare-test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"compare-test.js","sourceRoot":"","sources":["../../src-ts/_test/compare-test.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,yBAAuB,uBAAuB,CAAC,CAAA;AAC/C,2BAAuB,yBAAyB,CAAC,CAAA;AACjD,mCAAiC,8BAA8B,CAAC,CAAA;AAEhE,IAAI,GAAG,GAAG,mBAAQ,EAAE,CAAC;AAGrB,IAAI,MAAM,GAAG,IAAI,oBAAU,CAAC,GAAG,CAAC,CAAC;AAGjC,IAAI,aAAa,GAAG,IAAI,uCAAkB,CACtC,8GAA8G,EAC9G;IACI,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,EAAE;IACX,IAAI,EAAE,gBAAgB;IACtB,YAAY,EAAE,IAAI;CACrB,CAAC,CAAC;AAEP,IAAI,mBAAmB,GAAG,IAAI,uCAAkB,CAC5C,0GAA0G,EAC1G;IACI,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,sBAAsB;CAC/B,CAAC,CAAC;AAEP,IAAI,cAAc,GAAG,IAAI,uCAAkB,CACvC,oGAAoG,EACpG;IACI,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,WAAW;IACjB,UAAU,EAAE,CAAC,CAAC,CAAC;CAClB,CAAC,CAAC;AAEP,IAAI,cAAc,GAAG,IAAI,uCAAkB,CACvC,oGAAoG,EACpG;IACI,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,WAAW;IACjB,UAAU,EAAE,CAAC,CAAC,CAAC;CAClB,CAAC,CAAC;AAEP,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACpC,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACrC,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACrC,GAAG,CAAC,QAAQ,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAG1C,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;AACnC,MAAM,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;AAE1C,MAAM,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;AACpC,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC"} \ No newline at end of file diff --git a/lib-ts/src/index.d.ts b/dist/_test/itsMap.d.ts similarity index 100% rename from lib-ts/src/index.d.ts rename to dist/_test/itsMap.d.ts diff --git a/dist/_test/itsMap.js b/dist/_test/itsMap.js new file mode 100644 index 0000000000000000000000000000000000000000..2d8c28e0f7f7b112b007188ca36d77bc8a6d45cf --- /dev/null +++ b/dist/_test/itsMap.js @@ -0,0 +1,21 @@ +"use strict"; +/** + * Created by gavorhes on 12/18/2015. + */ +// import 'babel-polyfill/dist/polyfill.min'; +var ItsLayerCollection_1 = require('../collections/ItsLayerCollection'); +var LayerLegend_1 = require('../collections/LayerLegend'); +var quickMap_1 = require('../olHelpers/quickMap'); +var map = quickMap_1.default(); +var itsLayerCollection = new ItsLayerCollection_1.default(map); +var layerArray = [ + { + groupName: 'ITS Inventory Layers', + collapse: false, + addCheck: true, + items: itsLayerCollection.layers + } +]; +var legend = new LayerLegend_1.default(layerArray, 'legend-container', {}); +console.log('it works'); +//# sourceMappingURL=itsMap.js.map \ No newline at end of file diff --git a/dist/_test/itsMap.js.map b/dist/_test/itsMap.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5dc862cf8d9355fcb98b6133d0e1d82d1eae1944 --- /dev/null +++ b/dist/_test/itsMap.js.map @@ -0,0 +1 @@ +{"version":3,"file":"itsMap.js","sourceRoot":"","sources":["../../src-ts/_test/itsMap.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,6CAA6C;AAC7C,mCAA+B,mCAAmC,CAAC,CAAA;AACnE,4BAAwB,4BAA4B,CAAC,CAAA;AACrD,yBAAqB,uBAAuB,CAAC,CAAA;AAE7C,IAAI,GAAG,GAAG,kBAAQ,EAAE,CAAC;AAErB,IAAI,kBAAkB,GAAG,IAAI,4BAAkB,CAAC,GAAG,CAAC,CAAC;AAErD,IAAI,UAAU,GAAG;IACb;QACI,SAAS,EAAE,sBAAsB;QACjC,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,kBAAkB,CAAC,MAAM;KACnC;CACJ,CAAC;AAEF,IAAI,MAAM,GAAG,IAAI,qBAAW,CAAC,UAAU,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;AAKjE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/_test/my_little_test.d.ts b/dist/_test/my_little_test.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/dist/_test/my_little_test.js b/dist/_test/my_little_test.js new file mode 100644 index 0000000000000000000000000000000000000000..7b2c0aacd6909c7bd6b3dfdf67e872247302367b --- /dev/null +++ b/dist/_test/my_little_test.js @@ -0,0 +1,31 @@ +"use strict"; +var animate_buttons_1 = require('../domUtil/animate-buttons'); +// +// +console.log('eat this fish'); +console.log('eat this fish'); +console.log('eat this bird'); +// +// let g = new ol3.source.Vector(); +// +// console.log(olx); +console.log('i am here5'); +function me(eat) { + if (eat === void 0) { eat = 10; } + console.log(eat, 'one'); +} +me(); +var control = new animate_buttons_1.MediaControl('map'); +// +// +// console.log(ol3); +// +// +// console.log(definedAndNotNull("fish")); +// console.log(definedAndNotNull("fish")); +// console.log(definedAndNotNull("fish")); +// console.log(definedAndNotNull("fish")); +// console.log(definedAndNotNull("fish")); +// console.log('here'); +// +//# sourceMappingURL=my_little_test.js.map \ No newline at end of file diff --git a/dist/_test/my_little_test.js.map b/dist/_test/my_little_test.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b85547fdbf0feae464d05e9916e8d6d69c3a44d0 --- /dev/null +++ b/dist/_test/my_little_test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"my_little_test.js","sourceRoot":"","sources":["../../src-ts/_test/my_little_test.ts"],"names":[],"mappings":";AACA,gCAA2B,4BAK3B,CAAC,CALsD;AACvD,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,GAAgB;IAAhB,mBAAgB,GAAhB,QAAgB;IACzB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED,EAAE,EAAE,CAAC;AAEL,IAAI,OAAO,GAAG,IAAI,8BAAY,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"} \ No newline at end of file diff --git a/dist/_test/reacttst.d.ts b/dist/_test/reacttst.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/dist/_test/reacttst.js b/dist/_test/reacttst.js new file mode 100644 index 0000000000000000000000000000000000000000..5ce1acf578677ffda672a867c8d4bf2dbee1c34e --- /dev/null +++ b/dist/_test/reacttst.js @@ -0,0 +1,10 @@ +/** + * Created by gavorhes on 9/22/2016. + */ +"use strict"; +var React = require("react"); +var ReactDOM = require("react-dom"); +var Hello_1 = require("../_scratch/Hello"); +console.log('I am in a tsx file for some reason'); +ReactDOM.render(React.createElement(Hello_1.Hello, {compiler: "TypeScript", framework: "React"}), document.getElementById("example")); +//# sourceMappingURL=reacttst.js.map \ No newline at end of file diff --git a/dist/_test/reacttst.js.map b/dist/_test/reacttst.js.map new file mode 100644 index 0000000000000000000000000000000000000000..26019fa8c91ae037c9b0f1ddcca26fb52516352a --- /dev/null +++ b/dist/_test/reacttst.js.map @@ -0,0 +1 @@ +{"version":3,"file":"reacttst.js","sourceRoot":"","sources":["../../src-ts/_test/reacttst.tsx"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,IAAY,KAAK,WAAM,OAAO,CAAC,CAAA;AAC/B,IAAY,QAAQ,WAAM,WAAW,CAAC,CAAA;AAEtC,sBAAsB,mBAAmB,CAAC,CAAA;AAE1C,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AAElD,QAAQ,CAAC,MAAM,CACX,oBAAC,aAAK,GAAC,QAAQ,EAAC,YAAY,EAAC,SAAS,EAAC,OAAO,EAAG,EACjD,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CACrC,CAAC"} \ No newline at end of file diff --git a/dist/_test/slider-test.d.ts b/dist/_test/slider-test.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/dist/_test/slider-test.js b/dist/_test/slider-test.js new file mode 100644 index 0000000000000000000000000000000000000000..cd8e671edc9456d17e45778dd0693d6f55777a0c --- /dev/null +++ b/dist/_test/slider-test.js @@ -0,0 +1,173 @@ +"use strict"; +/** + * Created by gavorhes on 6/22/2016. + */ +var Sliders_1 = require('../collections/Sliders'); +var slidersConfig = [ + { + label: 'AADT', + yearOptions: [ + { label: '1', column: 'aadtyr_1' } + ] + }, + { + label: 'AADT Future', + yearOptions: [ + { label: '5', column: 'aadtyr_5' }, + { label: '10', column: 'aadtyr_10' }, + { label: '15', column: 'aadtyr_15' }, + { label: '20', column: 'aadtyr_20' } + ] + }, + { + label: 'Growth', + yearOptions: [ + { label: '5', column: 'growth_5' }, + { label: '10', column: 'growth_10' }, + { label: '15', column: 'growth_15' }, + { label: '20', column: 'growth_20' } + ] + }, + { + label: 'Truck', + yearOptions: [ + { label: '1', column: 'trkdyr_1' }, + { label: '20', column: 'trkdyr_20' } + ] + }, + { + label: 'LOS', + yearOptions: [ + { label: '1', column: 'losyr_1' } + ] + }, + { + label: 'LOS Future', + yearOptions: [ + { label: '5', column: 'losyr_5' }, + { label: '10', column: 'losyr_10' }, + { label: '15', column: 'losyr_15' }, + { label: '20', column: 'losyr_20' } + ] + }, + { + label: 'Crash Rate', + yearOptions: [ + { label: 1, column: 'crash_rate' } + ] + }, + { + label: 'Severity', + yearOptions: [ + { label: 1, column: 'crash_severity' } + ] + }, + { + label: 'Weather', + yearOptions: [ + { label: 1, column: 'weather' } + ] + }, + { + label: 'Event', + yearOptions: [ + { label: 1, column: 'event' } + ] + } +]; +var presetConfig = [ + { + label: 'Default TIP', + presets: [ + { column: 'aadtyr_1', value: 10.0 }, + { column: 'aadtyr_20', value: 7.0 }, + { column: 'growth_20', value: 7.0 }, + { column: 'trkdyr_1', value: 4.0 }, + { column: 'losyr_1', value: 12.0 }, + { column: 'losyr_20', value: 12.0 }, + { column: 'crash_rate', value: 15.0 }, + { column: 'crash_severity', value: 13.0 }, + { column: 'weather', value: 9.0 }, + { column: 'event', value: 11.0 } + ] + }, + { + label: 'Safety', + presets: [ + { column: 'aadtyr_1', value: 20.0 }, + { column: 'aadtyr_20', value: 0.0 }, + { column: 'growth_20', value: 0.0 }, + { column: 'trkdyr_1', value: 0.0 }, + { column: 'losyr_1', value: 0.0 }, + { column: 'losyr_20', value: 0.0 }, + { column: 'crash_rate', value: 40.0 }, + { column: 'crash_severity', value: 40.0 }, + { column: 'weather', value: 0.0 }, + { column: 'event', value: 0.0 } + ] + }, + { + label: 'Mobility Present', + presets: [ + { column: 'aadtyr_1', value: 25.0 }, + { column: 'aadtyr_20', value: 25.0 }, + { column: 'growth_20', value: 0.0 }, + { column: 'trkdyr_1', value: 25.0 }, + { column: 'losyr_1', value: 25.0 }, + { column: 'losyr_20', value: 0.0 }, + { column: 'crash_rate', value: 0.0 }, + { column: 'crash_severity', value: 0.0 }, + { column: 'weather', value: 0.0 }, + { column: 'event', value: 0.0 } + ] + }, + { + label: 'Mobility Future', + presets: [ + { column: 'aadtyr_1', value: 0.0 }, + { column: 'aadtyr_20', value: 25.0 }, + { column: 'growth_20', value: 25.0 }, + { column: 'trkdyr_1', value: 25.0 }, + { column: 'losyr_1', value: 0.0 }, + { column: 'losyr_20', value: 25.0 }, + { column: 'crash_rate', value: 0.0 }, + { column: 'crash_severity', value: 0.0 }, + { column: 'weather', value: 0.0 }, + { column: 'event', value: 0.0 } + ] + }, + { + label: 'Service', + presets: [ + { column: 'aadtyr_1', value: 30.0 }, + { column: 'aadtyr_20', value: 0.0 }, + { column: 'growth_20', value: 10.0 }, + { column: 'trkdyr_1', value: 0.0 }, + { column: 'losyr_1', value: 30.0 }, + { column: 'losyr_20', value: 30.0 }, + { column: 'crash_rate', value: 0.0 }, + { column: 'crash_severity', value: 0.0 }, + { column: 'weather', value: 0.0 }, + { column: 'event', value: 0.0 } + ] + }, + { + label: 'Freight Performance', + presets: [ + { column: 'aadtyr_1', value: 20.0 }, + { column: 'aadtyr_20', value: 0.0 }, + { column: 'growth_20', value: 0.0 }, + { column: 'trkdyr_1', value: 60.0 }, + { column: 'losyr_1', value: 20.0 }, + { column: 'losyr_20', value: 0.0 }, + { column: 'crash_rate', value: 0.0 }, + { column: 'crash_severity', value: 0.0 }, + { column: 'weather', value: 0.0 }, + { column: 'event', value: 0.0 } + ] + } +]; +var sliders = new Sliders_1.TipSliders(slidersConfig, presetConfig, 'slider-container', 'preset-selector', 'region-selector', 'version-selector', function (chg) { console.log(chg); }); +// sliders.changedCallback = (chg) => {console.log(chg)}; +window['glob'] = sliders; +//# sourceMappingURL=slider-test.js.map \ No newline at end of file diff --git a/dist/_test/slider-test.js.map b/dist/_test/slider-test.js.map new file mode 100644 index 0000000000000000000000000000000000000000..31fc4acdb93a992b4fd107574a58f18ae0b4274c --- /dev/null +++ b/dist/_test/slider-test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"slider-test.js","sourceRoot":"","sources":["../../src-ts/_test/slider-test.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,wBAA2D,wBAAwB,CAAC,CAAA;AAEpF,IAAI,aAAa,GAAG;IAChB;QACI,KAAK,EAAE,MAAM;QACb,WAAW,EAAE;YACT,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAC;SACnC;KACJ;IACD;QACI,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE;YACT,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAC;YAChC,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAC;YAClC,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAC;YAClC,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAC;SACrC;KACJ;IACD;QACI,KAAK,EAAE,QAAQ;QACf,WAAW,EAAE;YACT,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAC;YAChC,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAC;YAClC,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAC;YAClC,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAC;SACrC;KACJ;IACD;QACI,KAAK,EAAE,OAAO;QACd,WAAW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AE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAC;YAC/B,EAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAC;SAChC;KACJ;CACsB,CAAC;AAG5B,IAAI,OAAO,GAAG,IAAI,oBAAU,CAAC,aAAa,EAAE,YAAY,EAAE,kBAAkB,EACxE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAC,GAAG,IAAM,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA,CAAA,CAAC,CAAC,CAAC;AAE3F,yDAAyD;AAEzD,MAAM,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC"} \ No newline at end of file diff --git a/dist/collections/ItsLayerCollection.d.ts b/dist/collections/ItsLayerCollection.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..27376a0b53195a9dfbe0fd4985f0ff9fc23b3823 --- /dev/null +++ b/dist/collections/ItsLayerCollection.d.ts @@ -0,0 +1,36 @@ +import { ol } from 'custom-ol'; +import LayerItsInventory from "../layers/LayerItsInventory"; +declare class ItsLayerCollection { + _map: ol.Map; + _layers: Array<LayerItsInventory>; + /** + * Create a collection of all ITS layers + * @param {ol.Map} theMap the openlayers map + * @param {Array} [exclude=[]] array of Its layer identifiers to exclude + * + * BLUE Bluetooth Detector - Bluetooth Detector + * CABINET Cabinets - The cabinets + * CCTV Camera - Traffic Cameras + * HUT Communication Hut - Communication Hut + * VAULT Communication Vault - The communication vaults + * HAR Highway Advisory Radio - Advisory Radios + * LIGHT Lighting - Lighting + * LOOP Loop Detectors - Loop Detectors + * DMS Message Board - Message Boards and Signs + * MICROWAVE Microwave Detector - Microwave Detectors + * PULL Pull Box - A pull box + * RWIS RWIS - Road weather information system + * GATE Ramp Gate - The ramp Gates + * METER Ramp Meter - The ramp meters + * SIGNAL Signal - Traffic Signal + * TOWER Tower - The towers + * TRENCH + */ + constructor(theMap: ol.Map, exclude?: Array<string>); + /** + * Return the array of layers in this collection + * @returns {Array<LayerItsInventory>} an array of layers + */ + layers: LayerItsInventory[]; +} +export default ItsLayerCollection; diff --git a/dist/collections/ItsLayerCollection.js b/dist/collections/ItsLayerCollection.js new file mode 100644 index 0000000000000000000000000000000000000000..b55376d4096995f83bb2c651d8d83221c016bc94 --- /dev/null +++ b/dist/collections/ItsLayerCollection.js @@ -0,0 +1,155 @@ +/** + * Created by gavorhes on 12/14/2015. + */ +"use strict"; +var colors = require('../util/colors'); +var provide_1 = require('../util/provide'); +var LayerItsInventory_1 = require("../layers/LayerItsInventory"); +var nm = provide_1.default('collections'); +var itsConfig = [ + { + name: 'Camera', + itsType: 'cctv', + minZoom: 11, + itsIconConfig: { + prop: 'owner', + defaultName: 'WisDOT', + defaultIcon: 'cctv.png', + iconArray: [ + ['City of Madison', 'Madison', 'cctv-mad.png'] + ] + } + }, + { + name: 'Message Signs', + itsType: 'DMS', + minZoom: 11, + itsIconConfig: { + prop: 'dmsType', + defaultName: 'DMS', + defaultIcon: 'dms.png', + iconArray: [ + ['pcms', 'PCMS', 'pcms.png'] + ] + } + }, + { name: 'ATR', itsType: 'atr', minZoom: 8, itsIcon: 'atr.png', visible: false }, + { name: 'Lighting', itsType: 'light', minZoom: 16, itsIcon: 'streetlight.png', visible: false, onDemand: true }, + { name: 'Bluetooth', itsType: 'blue', minZoom: 10, itsIcon: 'bluetooth.png', visible: false }, + { name: 'Cabinets', itsType: 'cabinet', minZoom: 10, itsIcon: 'cabinet.png', visible: false }, + { name: 'Hut', itsType: 'hut', minZoom: 10, itsIcon: 'hut.png', visible: false }, + { name: 'Vault', itsType: 'vault', minZoom: 13, itsIcon: 'vault.png', visible: false }, + { name: 'Advisory Radio', itsType: 'har', minZoom: 10, itsIcon: 'har.png', visible: false }, + { + name: 'Loop Detectors', + itsType: 'loop', + legendCollapse: true, + minZoom: 14, + visible: false, + itsIconConfig: { + prop: 'dtctrType', + defaultName: 'Other', + defaultIcon: 'loopdetectorother.png', + iconArray: [ + ['detector', 'Detector', 'loopdetector.png'], + ['long', 'Long', 'loopdetectorlong.png'], + ['zone', 'Zone', 'loopdetectorzone.png'] + ] + }, + onDemand: true + }, + { name: 'Microwave', itsType: 'microwave', minZoom: 14, itsIcon: 'microwave.png', visible: false }, + { name: 'Pull Box', itsType: 'pull', minZoom: 14, itsIcon: 'pullbox.png', visible: false, onDemand: true }, + { name: 'RWIS', itsType: 'rwis', minZoom: 7, itsIcon: 'rwis.png', visible: false }, + { name: 'Ramp Gates', itsType: 'gate', minZoom: 10, itsIcon: 'rampgate.png', visible: false }, + { name: 'Ramp Meter', itsType: 'meter', minZoom: 10, itsIcon: 'rampmeter.png', visible: false }, + { name: 'Signal', itsType: 'signal', minZoom: 13, itsIcon: 'signal.png', visible: false, onDemand: true }, + { name: 'Tower', itsType: 'tower', minZoom: 10, itsIcon: 'tower.png', visible: false }, + { + name: 'Trench', + itsType: 'trench', + onDemand: true, + visible: false, + onDemandDelay: 500, + minZoom: 15, + legendCollapse: true, + itsLineConfig: { + prop: 'owner', + //defaultName: 'Other', + //defaultWidth: 7, + defaultColor: colors.hexAlphaToRgbOrRgba('#747474', 0.8), + lineArray: [ + ['WisDOT', 'WisDOT', colors.hexAlphaToRgbOrRgba('#FF032F', 0.7)], + ['WIN', 'WIN', colors.hexAlphaToRgbOrRgba('#FFC632', 0.7)], + ['USXchange', 'USXchange', colors.hexAlphaToRgbOrRgba('#2DFF46', 0.7)], + ['AT&T', 'AT&T', colors.hexAlphaToRgbOrRgba('#ff2be5', 0.7)], + ['Touch America', 'Touch America', colors.hexAlphaToRgbOrRgba('#52f3ff', 0.7)], + ['Qwest', 'Qwest', colors.hexAlphaToRgbOrRgba('#9278ff', 0.7)], + ['McLeodUSA', 'McLeodUSA', colors.hexAlphaToRgbOrRgba('#2926FF', 0.7)], + ['CINC', 'CINC', colors.hexAlphaToRgbOrRgba('#CB00FF', 0.7)], + ['City of Madison', 'Madison', colors.hexAlphaToRgbOrRgba('#000380', 0.7)] + ] + } + } +]; +var ItsLayerCollection = (function () { + /** + * Create a collection of all ITS layers + * @param {ol.Map} theMap the openlayers map + * @param {Array} [exclude=[]] array of Its layer identifiers to exclude + * + * BLUE Bluetooth Detector - Bluetooth Detector + * CABINET Cabinets - The cabinets + * CCTV Camera - Traffic Cameras + * HUT Communication Hut - Communication Hut + * VAULT Communication Vault - The communication vaults + * HAR Highway Advisory Radio - Advisory Radios + * LIGHT Lighting - Lighting + * LOOP Loop Detectors - Loop Detectors + * DMS Message Board - Message Boards and Signs + * MICROWAVE Microwave Detector - Microwave Detectors + * PULL Pull Box - A pull box + * RWIS RWIS - Road weather information system + * GATE Ramp Gate - The ramp Gates + * METER Ramp Meter - The ramp meters + * SIGNAL Signal - Traffic Signal + * TOWER Tower - The towers + * TRENCH + */ + function ItsLayerCollection(theMap, exclude) { + this._map = theMap; + this._layers = []; + exclude = typeof exclude == 'object' ? exclude : []; + for (var i = 0; i < itsConfig.length; i++) { + var lyrConfig = itsConfig[i]; + var addLayer = true; + for (var j = 0; j < exclude.length; j++) { + if (exclude[j] == lyrConfig.itsType) { + addLayer = false; + break; + } + } + if (addLayer) { + var inventLyr = new LayerItsInventory_1.default(lyrConfig); + this._map.addLayer(inventLyr.olLayer); + this._layers.push(inventLyr); + } + } + } + Object.defineProperty(ItsLayerCollection.prototype, "layers", { + /** + * Return the array of layers in this collection + * @returns {Array<LayerItsInventory>} an array of layers + */ + get: function () { + return this._layers; + }, + enumerable: true, + configurable: true + }); + return ItsLayerCollection; +}()); +nm.ItsLayerCollection = ItsLayerCollection; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = ItsLayerCollection; +//# sourceMappingURL=ItsLayerCollection.js.map \ No newline at end of file diff --git a/dist/collections/ItsLayerCollection.js.map b/dist/collections/ItsLayerCollection.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b1c569213b931bdbfbccb2f791a462c8ea749072 --- /dev/null +++ b/dist/collections/ItsLayerCollection.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ItsLayerCollection.js","sourceRoot":"","sources":["../../src-ts/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AC,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;oBAClC,QAAQ,GAAG,KAAK,CAAC;oBACjB,KAAK,CAAC;gBACV,CAAC;YACL,CAAC;YAED,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACX,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;YACjC,CAAC;QACL,CAAC;IACL,CAAC;IAMD,sBAAI,sCAAM;QAJV;;;WAGG;aACH;YACI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;QACxB,CAAC;;;OAAA;IACL,yBAAC;AAAD,CAAC,AA7DD,IA6DC;AAED,EAAE,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AAC3C;kBAAe,kBAAkB,CAAC"} \ No newline at end of file diff --git a/dist/collections/LayerLegend.d.ts b/dist/collections/LayerLegend.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e6997b7a3272403fc28206cbd14a2aed21e754f6 --- /dev/null +++ b/dist/collections/LayerLegend.d.ts @@ -0,0 +1,26 @@ +/** + * a wrapper to make a legend + */ +declare class LayerLegend { + $divElement: any; + _legendItems: any; + layerGroup: any; + legendId: any; + /** + * + * @param {Array} legendItems array of layers or objects with {groupName: {string}, collapse: {boolean}, addCheck: {boolean}, items: {Array}} + * @param {string} divId the div where the legend should be added + * @param {object} options for legend + * @param {Array} [options.layerDivClasses=[]] optional array of classes to be applied to the layer legend divs for custom styling + * @param {string} [options.legendTitle=Legend] the legend title + * @param {boolean} [options.scaleDependent=true] if legend display is scale dependent + */ + constructor(legendItems: any, divId: any, options: any); + /** + * @param {Array} [legendItems=this._layerConfig] the legend items + * @param {Array} [parents=[]] the ordered list of groups in which this item is a member + * @private + */ + _buildTree(legendItems: any, parents?: any): void; +} +export default LayerLegend; diff --git a/dist/collections/LayerLegend.js b/dist/collections/LayerLegend.js new file mode 100644 index 0000000000000000000000000000000000000000..9268f1b7bdb88e6d518927de744c45acf36706b6 --- /dev/null +++ b/dist/collections/LayerLegend.js @@ -0,0 +1,287 @@ +/** + * Created by gavorhes on 12/16/2015. + */ +"use strict"; +var provide_1 = require('../util/provide'); +var makeGuid_1 = require('../util/makeGuid'); +var mapMove_1 = require('../olHelpers/mapMove'); +var nm = provide_1.default('collections'); +var $ = require('jquery'); +var LayerGroup = (function () { + /** + * + * @param {object} [groupConfig={}] - group configuration object + * @param {string} groupConfig.groupName - the group name + * @param {boolean} [groupConfig.collapse=false] - if the group should be collapsed initially + * @param {boolean} [groupConfig.addCheck=true] - if the group should have a checkbox controlling visibility of all layers + * @param {LayerGroup} [parent=undefined] - the parent group + */ + function LayerGroup(groupConfig, parent) { + this.groupLayers = []; + this.groupLayersLookup = {}; + this.groupGroups = []; + this.groupGroupsLookup = {}; + this.itemIdArray = []; + if (typeof groupConfig == 'undefined') { + this.parent = null; + this.groupId = 'root'; + this.groupName = 'root'; + this.allGroupLookup = { root: this }; + this.allGroupArray = [this]; + this.allLayerArray = []; + this.allLayerLookup = {}; + this.layerParentLookup = {}; + this.collapse = false; + this.addCheck = false; + } + else { + this.groupId = makeGuid_1.default(); + this.parent = parent; + this.groupName = groupConfig.groupName; + this.collapse = typeof groupConfig.collapse == 'boolean' ? groupConfig.collapse : false; + this.addCheck = typeof groupConfig.addCheck == 'boolean' ? groupConfig.addCheck : true; + } + } + /** + * + * @param {object} groupConfig - configuration object + * @param {string} groupConfig.groupName - the group name + * @param {boolean} groupConfig.collapse if the group should be collapsed initially + * @param {boolean} groupConfig.addCheck if the group should have a checkbox controlling visibility of all layers + * @param {Array<LayerGroup>} parents parent groups + * @returns {LayerGroup} the layer group just added + */ + LayerGroup.prototype.addGroup = function (groupConfig, parents) { + var parent; + if (parents.length > 0) { + parent = parents[parents.length - 1]; + } + else { + parent = 'root'; + } + /** + * @type {LayerGroup} + */ + var parentGroup = this.allGroupLookup[parent]; + var newGroup = new LayerGroup(groupConfig, parentGroup); + this.allGroupLookup[newGroup.groupId] = newGroup; + this.allGroupArray.push(newGroup); + parentGroup.groupGroups.push(newGroup); + parentGroup.groupGroupsLookup[newGroup.groupId] = newGroup; + if (parentGroup.itemIdArray.indexOf(newGroup.groupId) > 0) { + console.log(newGroup.groupId); + throw 'layer and group ids must be unique'; + } + parentGroup.itemIdArray.push(newGroup.groupId); + return newGroup; + }; + /** + * + * @param {LayerBase} newLayer the layer to be added + * @param {Array} parents array + */ + LayerGroup.prototype.addLegendLayer = function (newLayer, parents) { + var parent; + if (parents.length > 0) { + parent = parents[parents.length - 1]; + } + else { + parent = 'root'; + } + this.allLayerLookup[newLayer.id] = newLayer; + this.allLayerArray.push(newLayer); + /** + * @type {LayerGroup} + */ + var parentGroup = this.allGroupLookup[parent]; + parentGroup.groupLayers.push(newLayer); + parentGroup.groupLayersLookup[newLayer.id] = newLayer; + if (parentGroup.itemIdArray.indexOf(newLayer.id) > 0) { + console.log(newLayer.id); + throw 'layer and group ids must be unique'; + } + parentGroup.itemIdArray.push(newLayer.id); + this.layerParentLookup[newLayer.id] = parentGroup; + }; + LayerGroup.prototype.getLegendHtml = function (legendId, options) { + var legendHtml = "<ul id=\"" + legendId + "\" class=\"legend-container\">"; + legendHtml += ("<li>" + options.legendTitle + "<input type=\"checkbox\" checked id=\"suppress-by-extent-" + legendId + "\" class=\"suppress-by-extent\">") + + ("<label title=\"Suppress layers not visible at this zoom level\" for=\"suppress-by-extent-" + legendId + "\">") + + "<span></span>" + + "</label></li>"; + legendHtml += this._buildLegend(this.itemIdArray, this, options.layerDivClasses) + '</ul>'; + return legendHtml; + }; + /** + * @param {Array} itemIds the items to process + * @param {LayerGroup} theGroup new group + * @param {Array} [layerDivClasses=[]] optional classes to apply to the layer divs + * @static + * @returns {string} html string + */ + LayerGroup.prototype._buildLegend = function (itemIds, theGroup, layerDivClasses) { + if (itemIds.length == 0) { + return ''; + } + var theHml = ''; + var itemId = itemIds[0]; + if (theGroup.groupLayersLookup[itemId]) { + /** + * @type {LayerBase} + */ + var lyr = theGroup.groupLayersLookup[itemId]; + theHml += ("<li id=\"" + lyr.id + "-layer-li\" class=\"legend-layer-li " + layerDivClasses.join(' ') + "\">") + lyr.getLegendDiv() + '</li>'; + } + else if (theGroup.groupGroupsLookup[itemId]) { + /** + * type {LayerGroup} + */ + var otherGroup = theGroup.groupGroupsLookup[itemId]; + theHml += "<li>"; + theHml += ("<div id=\"" + otherGroup.groupId + "-legend-layer-div\" ") + + ("class=\"legend-layer-group " + layerDivClasses.join(' ') + "\">"); + if (otherGroup.addCheck) { + theHml += ("<input type=\"checkbox\" checked id=\"" + otherGroup.groupId + "-group-chck\">") + + ("<label for=\"" + otherGroup.groupId + "-group-chck\" title=\"Click arrow to expand or collapse\">" + otherGroup.groupName + "</label>"); + } + else { + theHml += "<label title=\"Click arrow to expand or collapse\">" + otherGroup.groupName + "</label>"; + } + theHml += "<span title=\"Expand/Collapse\" class=\"layer-group-expander"; + theHml += (otherGroup.collapse ? ' legend-layer-group-initial-collapse' : '') + "\">"; + theHml += otherGroup.collapse ? '▶' : '▼'; + theHml += '</span>'; + //parents.push(groupId); + theHml += '<ul>' + this._buildLegend(otherGroup.itemIdArray, otherGroup, layerDivClasses) + '</ul>'; + theHml += '</div>'; + theHml += '</li>'; + } + return theHml + this._buildLegend(itemIds.slice(1), theGroup, layerDivClasses); + }; + return LayerGroup; +}()); +/** + * a wrapper to make a legend + */ +var LayerLegend = (function () { + /** + * + * @param {Array} legendItems array of layers or objects with {groupName: {string}, collapse: {boolean}, addCheck: {boolean}, items: {Array}} + * @param {string} divId the div where the legend should be added + * @param {object} options for legend + * @param {Array} [options.layerDivClasses=[]] optional array of classes to be applied to the layer legend divs for custom styling + * @param {string} [options.legendTitle=Legend] the legend title + * @param {boolean} [options.scaleDependent=true] if legend display is scale dependent + */ + function LayerLegend(legendItems, divId, options) { + for (var _i = 0, legendItems_1 = legendItems; _i < legendItems_1.length; _i++) { + var i = legendItems_1[_i]; + if (typeof i == 'undefined') { + throw 'undefined item passed in array to legend constructor'; + } + } + options = options || {}; + options.legendTitle = typeof options.legendTitle == 'string' ? options.legendTitle : 'Legend'; + options.scaleDependent = typeof options.scaleDependent == 'boolean' ? options.scaleDependent : true; + options.layerDivClasses = options.layerDivClasses || []; + // if legend display is scale dependent, make sure the mapMove object is initialized first + if (options.scaleDependent) { + mapMove_1.default.checkInit(); + } + this.$divElement = $('#' + divId); + this._legendItems = legendItems; + this.layerGroup = new LayerGroup(); + this._buildTree(legendItems); + this.legendId = makeGuid_1.default(); + this.$divElement.append(this.layerGroup.getLegendHtml(this.legendId, options)); + for (var _a = 0, _b = this.layerGroup.allLayerArray; _a < _b.length; _a++) { + var l = _b[_a]; + l.applyCollapse(); + } + var _this = this; + //// if legend display is scale dependent, make sure the mapMove object is initialized first + if (options.scaleDependent) { + mapMove_1.default.checkInit(); + mapMove_1.default.addCallback(function (ext, zoom, evt) { + if (typeof evt == 'undefined' || evt == 'change:resolution') { + for (var _i = 0, _a = this.layerGroup.allLayerArray; _i < _a.length; _i++) { + var lyr = _a[_i]; + var $lyrLi = $('#' + lyr.id + '-layer-li'); + if (zoom > lyr.maxZoom || zoom < lyr.minZoom) { + $lyrLi.addClass('layer-not-visible'); + } + else { + $lyrLi.removeClass('layer-not-visible'); + } + } + } + }, this, 100, true, 'legend1'); + } + // <editor-fold desc="add event listeners"> + this.$divElement.find(".suppress-by-extent").change(function () { + var legendLayerLis = $('.legend-layer-li'); + if (this.checked) { + legendLayerLis.removeClass('layer-force-show'); + } + else { + legendLayerLis.addClass('layer-force-show'); + } + }); + this.$divElement.find('.legend-check').change(function () { + var lyrId = this.id.replace('-legend-layer-check', ''); + _this.layerGroup.allLayerLookup[lyrId].visible = this.checked; + }); + this.$divElement.find('.legend-layer-group > input[type=checkbox]').change(function () { + $(this).siblings('ul').find('input[type=checkbox]').prop('checked', this.checked).trigger('change'); + }); + this.$divElement.find('.layer-group-expander').click(function () { + var $this = $(this); + $this.removeClass('legend-layer-group-initial-collapse'); + $this.siblings('ul').slideToggle(); + if ($this.hasClass('legend-layer-group-collapsed')) { + $this.removeClass('legend-layer-group-collapsed'); + $this.html('▼'); + } + else { + $this.addClass('legend-layer-group-collapsed'); + $this.html('▶'); + } + }); + this.$divElement.find('.legend-layer-group-initial-collapse').trigger('click'); + // </editor-fold> + } + /** + * @param {Array} [legendItems=this._layerConfig] the legend items + * @param {Array} [parents=[]] the ordered list of groups in which this item is a member + * @private + */ + LayerLegend.prototype._buildTree = function (legendItems, parents) { + if (legendItems.length == 0) { + return; + } + var oneItem = legendItems[0]; + //reset the parent if the item is in the base array + if (this._legendItems.indexOf(oneItem) > -1 || typeof parents == 'undefined') { + parents = []; + } + if (typeof oneItem['groupName'] !== 'undefined') { + var groupItem = legendItems[0]; + var newGroup = this.layerGroup.addGroup(groupItem, parents); + parents.push(newGroup.groupId); + this._buildTree(groupItem.items, parents); + } + else { + /** + * @type {LayerBase} + */ + var layerItem = legendItems[0]; + this.layerGroup.addLegendLayer(layerItem, parents); + } + this._buildTree(legendItems.slice(1), parents); + }; + return LayerLegend; +}()); +nm.LayerLegend = LayerLegend; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = LayerLegend; +//# sourceMappingURL=LayerLegend.js.map \ No newline at end of file diff --git a/dist/collections/LayerLegend.js.map b/dist/collections/LayerLegend.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a5ade04559e6132df990675aa4672d2035a8fa5a --- /dev/null +++ b/dist/collections/LayerLegend.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LayerLegend.js","sourceRoot":"","sources":["../../src-ts/collections/LayerLegend.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,wBAAoB,iBAAiB,CAAC,CAAA;AACtC,yBAAqB,kBAAkB,CAAC,CAAA;AACxC,wBAAoB,sBAAsB,CAAC,CAAA;AAC3C,IAAI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CAAC,GAAG,CAAC,CAAC,IAAI,OAAO,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC;YAC3E,OAAO,GAAG,EAAE,CAAC;QACjB,CAAC;QAED,EAAE,CAAC,CAAC,OAAO,OAAO,CAAC,WAAW,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC;YAC9C,IAAI,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAC5D,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC/B,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ;;eAEG;YACH,IAAI,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;YAE/B,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACvD,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAEL,kBAAC;AAAD,CAAC,AAlJD,IAkJC;AAED,EAAE,CAAC,WAAW,GAAG,WAAW,CAAC;AAC7B;kBAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/lib-ts/collections/Sliders.d.ts b/dist/collections/Sliders.d.ts similarity index 100% rename from lib-ts/collections/Sliders.d.ts rename to dist/collections/Sliders.d.ts diff --git a/dist/collections/Sliders.js b/dist/collections/Sliders.js new file mode 100644 index 0000000000000000000000000000000000000000..47d444aa64168674a561469bacbc7cace90d2f78 --- /dev/null +++ b/dist/collections/Sliders.js @@ -0,0 +1,502 @@ +/** + * Created by gavorhes on 12/10/2015. + */ +"use strict"; +var provide_1 = require('../util/provide'); +var nm = provide_1.default('collections'); +var $ = require('jquery'); +var TipPresets = (function () { + function TipPresets(conf) { + this.label = conf.label; + this.presets = conf.presets; + this.domId = this.label.replace(/ /g, '').toLowerCase(); + } + return TipPresets; +}()); +var _Slider = (function () { + /** + * Slider constructor + * @param sliderConfig - the configuration + + */ + function _Slider(sliderConfig) { + //let _this = this; + this._dropdownSelection = null; + this._weight = null; + this.name = sliderConfig.label; + this.domId = this.name.toLowerCase().replace(/ /g, '-'); + this._locked = false; + this._min = 0.0; + this._max = 100; + this.labelLow = null; + this.labelHigh = null; + this.labelVal = null; + this.slider = null; + this.chk = null; + this.atMin = false; + this.atMax = false; + var sel = "<select class=\"" + (sliderConfig.yearOptions.length == 1 ? 'hidden-select' : 'show-select') + "\" id=\"" + this.domId + "_chg\">"; + for (var i = 0; i < sliderConfig.yearOptions.length; i++) { + var itm = sliderConfig.yearOptions[i]; + sel += "<option value=\"" + itm.column + "\">" + itm.label + "</option>"; + } + sel += '</select>'; + this.selectedParamDefault = this.selectedParam; + this.html = '<div class="slider-div">' + + ("<label for=\"" + this.domId + "_chk\" class=\"slider-label\">" + this.name + "</label>") + + sel + "<br>" + + ("<input id=\"" + this.domId + "_chk\" type=\"checkbox\" title=\"Lock/Unlock Slider\">") + + ("<label id=\"" + this.domId + "_low\" class=\"low-high\"></label>") + + ("<input id=\"" + this.domId + "\" type=\"range\" value=\"50\" min=\"0\" max=\"100\" step=\"0.1\">") + + ("<label id=\"" + this.domId + "_high\" class=\"low-high\"></label>") + + ("<label id=\"" + this.domId + "_lbl\" for=\"" + this.domId + "\" class=\"percent-label\"></label></div>"); + } + /** + * add html to dom + * @param {jQuery} $container - container element + */ + _Slider.prototype.addToDom = function ($container) { + $container.append(this.html); + this.labelLow = $("#" + this.domId + "_low"); + this.labelHigh = $("#" + this.domId + "_high"); + this.labelVal = $("#" + this.domId + "_lbl"); + this.slider = $("#" + this.domId); + this.selectionBox = $("#" + this.domId + "_chg"); + this.chk = $("#" + this.domId + "_chk"); + }; + /** + * increment the slider + * @param {number} delta change delta + * @returns {number} the remainder not able to be allocated to this slider + */ + _Slider.prototype.increment = function (delta) { + var remainder = 0; + delta = Number(delta.toFixed(1)); + this._weight += delta; + if (this._weight < this._min) { + remainder = this._min - this._weight; + this._weight = this._min; + this.atMin = true; + } + else if (this._weight > this._max) { + remainder = this._max - this._weight; + this._weight = this._max; + this.atMax = true; + } + else { + this.atMin = false; + this.atMax = false; + } + this.slider.val(this._weight.toFixed(1)); + this.labelVal.html(this._weight.toFixed(1) + '%'); + return remainder; + }; + /** + * set the value and drop down + * @param {number} newVal the new value + * @param {string} selectedParam the selected parameter + */ + _Slider.prototype.setValAndDropDown = function (newVal, selectedParam) { + this.min = 0; + this.max = 100; + this.weight = newVal; + this.slider.val(newVal.toFixed(1)); + this.selectionBox.val(selectedParam); + this.selectedParam = selectedParam; + this.locked = true; + }; + Object.defineProperty(_Slider.prototype, "locked", { + /** + * + * @returns {boolean} if locked + */ + get: function () { + return this._locked; + }, + /** + * + * @param {boolean} val if locked + */ + set: function (val) { + this._locked = val; + this.slider.prop('disabled', this._locked); + this.selectionBox.prop('disabled', this._locked); + this.chk.prop('checked', !this._locked); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(_Slider.prototype, "min", { + /** + * + * @returns {number} the minimum + */ + get: function () { + return this._min; + }, + /** + * + * @param {number} newVal new minimum + */ + set: function (newVal) { + this._min = Number(newVal.toFixed(1)); + if (this._min < 0) { + this._min = 0; + } + this.labelLow.html(this._min.toFixed(1)); + this.slider.attr('min', this._min.toFixed(1)); + this.atMin = this._weight == this._min; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(_Slider.prototype, "max", { + /** + * + * @returns {number} the maximum + */ + get: function () { + return this._max; + }, + /** + * + * @param {number} newVal the maximum + */ + set: function (newVal) { + this._max = Number(newVal.toFixed(1)); + if (this._max > 100) { + this._max = 100.0; + } + this.labelHigh.html(this._max.toFixed(1)); + this.slider.attr('max', this._max.toFixed(1)); + this.atMax = this._weight == this._max; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(_Slider.prototype, "weight", { + /** + * + * @returns {number} the weight + */ + get: function () { + return this._weight; + }, + /** + * + * @param {number} newVal the weight + */ + set: function (newVal) { + this._weight = Number(newVal.toFixed(1)); + this.labelVal.html(this._weight.toFixed(1) + '%'); + if (this._weight <= this._min) { + this.atMin = true; + this.atMax = false; + } + else if (this._weight >= this._max) { + this.atMin = false; + this.atMax = true; + } + else { + this.atMin = false; + this.atMax = false; + } + }, + enumerable: true, + configurable: true + }); + return _Slider; +}()); +nm._Slider = _Slider; +/** + * class to keep track of the sliders + */ +var TipSliders = (function () { + /** + * + * @param sliderConfigs + * @param presetConfig + * @param divId + * @param presetSelectorId + * @param regionSelectorId + * @param versionSelectorId + */ + function TipSliders(sliderConfigs, presetConfig, divId, presetSelectorId, regionSelectorId, versionSelectorId, chgCallback) { + var _this = this; + this.resetting = false; + this.reservedPercent = 0.0; + this.$container = $('#' + divId); + this.$container.addClass('slider-container'); + this.changedCallback = typeof chgCallback == 'function' ? chgCallback : function () { }; + this._$presetSelector = $('#' + presetSelectorId); + this._$regionSelector = $('#' + regionSelectorId); + this._$versionSelector = $('#' + versionSelectorId); + this._sliderList = []; + this._sliderLookup = {}; + for (var i = 0; i < sliderConfigs.length; i++) { + var sld = new _Slider(sliderConfigs[i]); + this._sliderList.push(sld); + this._sliderLookup[sld.domId] = sld; + sld.addToDom(this.$container); + } + this._presetArray = []; + this._presetLookup = {}; + for (var i = 0; i < presetConfig.length; i++) { + var preset = new TipPresets(presetConfig[i]); + var idx = (i + 1).toFixed(); + this._presetLookup[idx] = preset; + this._presetArray.push(preset); + this._$presetSelector.append("<option value=\"" + idx + "\">" + preset.label + "</option>"); + } + this._lockedList = []; + this._inRangeList = []; + this._atMinList = []; + this._atMaxList = []; + this.lockedCount = 10; + this.notLockedCount = 0; + this._splitSliderArray(); + this._$presetSelector.change(function () { + _this.setPresetValues(); + _this._runChangedCallback(); + }); + this._$regionSelector.change(function () { + _this._runChangedCallback(); + }); + this._$versionSelector.change(function () { + _this._runChangedCallback(); + }); + this._$presetSelector.trigger('change'); + this._addEventListeners(); + } + TipSliders.prototype._runChangedCallback = function () { + this.changedCallback(this.paramWeightsRegionVersion); + }; + TipSliders.prototype.setPresetValues = function () { + var thePreset = this._presetLookup[this._$presetSelector.val()]; + for (var i = 0; i < thePreset.presets.length; i++) { + var presetValues = thePreset.presets[i]; + var theSlider = this._sliderList[i]; + theSlider.locked = true; + theSlider.setValAndDropDown(presetValues.value, presetValues.column); + } + }; + /** + * split array into subarrays holding the sliders + * @private + */ + TipSliders.prototype._splitSliderArray = function () { + this._lockedList = []; + this._inRangeList = []; + this._atMinList = []; + this._atMaxList = []; + for (var i = 0; i < this._sliderList.length; i++) { + var sld = this._sliderList[i]; + if (sld.locked) { + this._lockedList.push(sld); + } + else if (sld.atMin) { + this._atMinList.push(sld); + } + else if (sld.atMax) { + this._atMaxList.push(sld); + } + else { + this._inRangeList.push(sld); + } + } + this.lockedCount = this._lockedList.length; + this.notLockedCount = this._sliderList.length - this.lockedCount; + }; + /** + * handle remainder, recursive to take care of min max overshoots + * @param {number} remain the remainder + * @param {string} skipDomId - this dom id + * @private + */ + TipSliders.prototype._handleRemainder = function (remain, skipDomId) { + remain = Number(remain.toFixed(1)); + if (remain == 0) { + return; + } + this._splitSliderArray(); + var canChangeArray = []; + for (var i = 0; i < this._inRangeList.length; i++) { + var sld = this._inRangeList[i]; + if (sld.domId == skipDomId) { + continue; + } + canChangeArray.push(sld); + } + if (remain > 0) { + for (var i = 0; i < this._atMaxList.length; i++) { + var sld = this._atMaxList[i]; + if (sld.domId == skipDomId) { + continue; + } + canChangeArray.push(sld); + } + } + else { + for (var i = 0; i < this._atMinList.length; i++) { + var sld = this._atMinList[i]; + if (sld.domId == skipDomId) { + continue; + } + canChangeArray.push(sld); + } + } + if (canChangeArray.length == 0) { + return; + } + var inc = -1 * Number((remain / canChangeArray.length).toFixed(1)); + var newRemainder = 0; + for (var i = 0; i < canChangeArray.length; i++) { + newRemainder += canChangeArray[i].increment(inc); + } + this._handleRemainder(newRemainder, skipDomId); + }; + /** + * + * @param {object} keyValList key and value list + */ + TipSliders.prototype.setValues = function (keyValList) { + this.resetting = true; + for (var k in keyValList) { + if (keyValList.hasOwnProperty(k)) { + this._sliderLookup[k].setValAndDropDown(keyValList[k][0], keyValList[k][1]); + } + } + this.resetting = false; + }; + /** + * get the weight sum + * @returns {number} the weight sum + */ + TipSliders.prototype.getSum = function () { + var total = 0; + for (var i = 0; i < this._sliderList.length; i++) { + var sld = this._sliderList[i]; + total += Number(sld.weight.toFixed(1)); + } + return total; + }; + /** + * get the parameter weights + * @returns {object} lookup with parameter weights + */ + TipSliders.prototype.getParams = function () { + var paramWeights = {}; + for (var i = 0; i < this._sliderList.length; i++) { + var sld = this._sliderList[i]; + paramWeights[sld.selectedParam] = Number(sld.weight.toFixed(1)); + } + return paramWeights; + }; + TipSliders.prototype._addEventListeners = function () { + var ___this = this; + //change function + this.$container.find('input[type="range"]').change(function () { + if (___this.resetting) { + return; + } + var $this = $(this); + var domId = this['id']; + var sldr = ___this._sliderLookup[domId]; + var newValue = parseFloat($this.val()); + var oldValue = sldr.weight; + var diff = newValue - oldValue; + diff = Number(diff.toFixed(1)); + sldr.weight = Number(newValue.toFixed(1)); + ___this._handleRemainder(diff, domId); + //cleanup, make sure the sum is still 100 + var sum = Number(___this.getSum().toFixed(1)); + if (sum > 100) { + loop1: while (true) { + for (var i = 0; i < ___this._sliderList.length; i++) { + var sld = ___this._sliderList[i]; + if (sld.domId == domId || sld.locked || sld.atMin) { + continue; + } + sld.increment(-0.1); + sum -= 0.1; + if (sum.toFixed(1) == '100.0') { + break loop1; + } + } + } + } + else if (sum < 100) { + loop1: while (true) { + for (var i = 0; i < ___this._sliderList.length; i++) { + var sld = ___this._sliderList[i]; + if (sld.domId == domId || sld.locked || sld.atMax) { + continue; + } + sld.increment(0.1); + sum += 0.1; + if (sum.toFixed(1) == '100.0') { + break loop1; + } + } + } + } + ___this._$presetSelector.val('0'); + ___this._runChangedCallback(); + }); + //update the selected parameter when the selection is changed + $('.show-select').change(function () { + if (___this.resetting) { + return; + } + ___this._sliderLookup[this['id'].replace('_chg', '')].selectedParam = $(this).val(); + ___this._$presetSelector.val('0'); + ___this._runChangedCallback(); + }); + //lock the slider and update the reserved percent + this.$container.find('input[type="checkbox"]').change(function () { + var domEl = this; + ___this._sliderLookup[domEl.id.replace('_chk', '')].locked = !domEl.checked; + ___this.reservedPercent = 0.0; + ___this.notLockedCount = 0; + var notLockedSliders = []; + for (var i = 0; i < ___this._sliderList.length; i++) { + var sld = ___this._sliderList[i]; + if (sld.locked) { + ___this.reservedPercent += sld.weight; + continue; + } + notLockedSliders.push(sld); + ___this.notLockedCount++; + } + for (var i = 0; i < ___this._sliderList.length; i++) { + var sld = ___this._sliderList[i]; + if (sld.locked) { + continue; + } + sld.max = 100 - ___this.reservedPercent; + } + if (notLockedSliders.length == 1) { + notLockedSliders[0].min = notLockedSliders[0].weight; + } + else { + for (var i = 0; i < notLockedSliders.length; i++) { + notLockedSliders[i].min = 0; + } + } + }); + }; + Object.defineProperty(TipSliders.prototype, "paramWeightsRegionVersion", { + get: function () { + return { paramWeights: this.getParams(), + region: this._$regionSelector.val(), mmVersion: this._$versionSelector.val() }; + }, + enumerable: true, + configurable: true + }); + return TipSliders; +}()); +exports.TipSliders = TipSliders; +nm.Sliders = TipSliders; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = TipSliders; +//# sourceMappingURL=Sliders.js.map \ No newline at end of file diff --git a/dist/collections/Sliders.js.map b/dist/collections/Sliders.js.map new file mode 100644 index 0000000000000000000000000000000000000000..96f2380a04ef92248da7c2ebb1fccfe6ef08fe02 --- /dev/null +++ b/dist/collections/Sliders.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Sliders.js","sourceRoot":"","sources":["../../src-ts/collections/Sliders.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAGH,wBAAoB,iBAAiB,CAAC,CAAA;AACtC,IAAI,E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;gBACjC,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;oBACb,QAAQ,CAAC;gBACb,CAAC;gBACD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC;YAC5C,CAAC;YAED,EAAE,CAAC,CAAC,gBAAgB,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC/B,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YACzD,CAAC;YAAC,IAAI,CAAC,CAAC;gBACJ,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC/C,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;gBAChC,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;IAEP,CAAC;IAED,sBAAI,iDAAyB;aAA7B;YACI,MAAM,CAAC,EAAC,YAAY,EAAE,IAAI,CAAC,SAAS,EAAE;gBAClC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,EAAC,CAAA;QACrF,CAAC;;;OAAA;IACL,iBAAC;AAAD,CAAC,AAxWD,IAwWC;AAxWY,kBAAU,aAwWtB,CAAA;AAED,EAAE,CAAC,OAAO,GAAG,UAAU,CAAC;AACxB;kBAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/dist/domUtil/SelectBoxBase.d.ts b/dist/domUtil/SelectBoxBase.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e8bf18fc1344e22cc161f9122c7e77ded705b985 --- /dev/null +++ b/dist/domUtil/SelectBoxBase.d.ts @@ -0,0 +1,52 @@ +export interface selectChangeCallback { + /** + * + * @param theValue the current select value of the select box + */ + (theValue: string): void; +} +/** + * must return in the contents <select id="${guid}"></select> among other things + */ +export interface contentGenerator { + /** + * @param aGuid + */ + (aGuid: string): string; +} +export declare class SelectBoxBase { + _$container: JQuery; + $label: JQuery; + _box: JQuery; + _changeListeners: Array<selectChangeCallback>; + /** + * + * @param {jQuery} parent - parent container + * @param {string} labelContent + * @param {contentGenerator} [contentGen=undefined] + */ + constructor(parent: any, labelContent: any, contentGen?: contentGenerator); + /** + * + * @returns {jQuery} + */ + box: JQuery; + changed(): void; + /** + * + * @param {selectChangeCallback} func + */ + addChangeListener(func: selectChangeCallback): void; + /** + * + * @returns {string|number} + */ + /** + * + * @param {string|number} v + * @protected + */ + selectedValue: any; + selectedText: string; +} +export default SelectBoxBase; diff --git a/dist/domUtil/SelectBoxBase.js b/dist/domUtil/SelectBoxBase.js new file mode 100644 index 0000000000000000000000000000000000000000..8327a205ba926ddc853a1d87389fbbec56eb0cc1 --- /dev/null +++ b/dist/domUtil/SelectBoxBase.js @@ -0,0 +1,119 @@ +"use strict"; +/** + * Created by gavorhes on 5/13/2016. + */ +/** + * Created by gavorhes on 5/12/2016. + */ +var makeGuid_1 = require('../util/makeGuid'); +var provide_1 = require('../util/provide'); +var nm = provide_1.default('domUtil'); +var SelectBoxBase = (function () { + /** + * + * @param {jQuery} parent - parent container + * @param {string} labelContent + * @param {contentGenerator} [contentGen=undefined] + */ + function SelectBoxBase(parent, labelContent, contentGen) { + var _this = this; + var guidTop = makeGuid_1.default(); + var guid = makeGuid_1.default(); + var htmlString = "<div id=\"" + guidTop + "\">"; + htmlString += "<label for=\"" + guid + "\">" + labelContent + "</label>"; + if (contentGen) { + htmlString += contentGen(guid); + } + else { + htmlString += "<select id=\"" + guid + "\"></select>"; + } + htmlString += '</div>'; + parent.append(htmlString); + this._$container = parent.find('#' + guidTop); + this.$label = this._$container.find('label'); + /** + * + * @type {Array<selectChangeCallback>} + * @private + */ + this._changeListeners = []; + this._box = parent.find("#" + guid); + if (!this._box) { + throw 'the select box was not found'; + } + this._box.change(function () { + _this.changed(); + }); + } + Object.defineProperty(SelectBoxBase.prototype, "box", { + /** + * + * @returns {jQuery} + */ + get: function () { + return this._box; + }, + enumerable: true, + configurable: true + }); + SelectBoxBase.prototype.changed = function () { + var v = this._box.val(); + for (var _i = 0, _a = this._changeListeners; _i < _a.length; _i++) { + var f = _a[_i]; + f(v); + } + }; + /** + * + * @param {selectChangeCallback} func + */ + SelectBoxBase.prototype.addChangeListener = function (func) { + this._changeListeners.push(func); + }; + Object.defineProperty(SelectBoxBase.prototype, "selectedValue", { + /** + * + * @returns {string|number} + */ + get: function () { + var theVal = this.box.val(); + if (theVal == null || typeof theVal == 'undefined') { + return null; + } + else if (isNaN(theVal)) { + return theVal; + } + else { + if (theVal.indexOf('.') > -1) { + return parseFloat(theVal); + } + else { + return parseInt(theVal); + } + } + }, + /** + * + * @param {string|number} v + * @protected + */ + set: function (v) { + this.box.val(v); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectBoxBase.prototype, "selectedText", { + get: function () { + return this.box.find('option:selected').text(); + }, + enumerable: true, + configurable: true + }); + return SelectBoxBase; +}()); +exports.SelectBoxBase = SelectBoxBase; +nm.SelectBoxBase = SelectBoxBase; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = SelectBoxBase; +//# sourceMappingURL=SelectBoxBase.js.map \ No newline at end of file diff --git a/dist/domUtil/SelectBoxBase.js.map b/dist/domUtil/SelectBoxBase.js.map new file mode 100644 index 0000000000000000000000000000000000000000..aa912aedf37eb324f96a499d60d019c7cbd6bfee --- /dev/null +++ b/dist/domUtil/SelectBoxBase.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SelectBoxBase.js","sourceRoot":"","sources":["../../src-ts/domUtil/SelectBoxBase.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH;;GAEG;AACH,yBAAqB,kBAAkB,CAAC,CAAA;AACxC,wBAAoB,iBAAiB,CAAC,CAAA;AACtC,IAAM,EAAE,GAAG,iBAAO,CAAC,SAAS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CAAC;;;OAAA;IAEL,oBAAC;AAAD,CAAC,AA1GD,IA0GC;AA1GY,qBAAa,gBA0GzB,CAAA;AAED,EAAE,CAAC,aAAa,GAAG,aAAa,CAAC;AAEjC;kBAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/dist/domUtil/animate-buttons.d.ts b/dist/domUtil/animate-buttons.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8761a4dc64ce961efef2e33e98de51b35deeb835 --- /dev/null +++ b/dist/domUtil/animate-buttons.d.ts @@ -0,0 +1,38 @@ +import Timer = NodeJS.Timer; +export declare class MediaControl { + _container: JQuery; + _min: number; + _max: number; + _playInterval: number; + _step: number; + _currentValue: number; + _playing: boolean; + _$btnStop: JQuery; + _$slider: JQuery; + _$valLabelVal: JQuery; + _$valLabelMin: JQuery; + _$valLabelMax: JQuery; + _interval: Timer; + _showAsDate: boolean; + _func: Function; + constructor(element: JQuery | HTMLElement | string, min?: number, max?: number, val?: number, step?: number, func?: Function, playInterval?: number, showAsDate?: boolean); + stopPlaying(): void; + playing: boolean; + min: number; + max: number; + step: number; + currentValue: number; + /** + * set min and max value with step + * @param {number} newMin the new min + * @param {number} newMax the new mas + * @param {number} [newValue=newMin] the value to set + * @param {number} [newStep=(newMax-newMin)/20] step value + */ + setMinMaxValueStep(newMin: any, newMax: any, newValue: any, newStep: any): void; + /** + * + * @param {mediaCallback} newFunc the callback on change + */ + changeFunction: any; +} diff --git a/dist/domUtil/animate-buttons.js b/dist/domUtil/animate-buttons.js new file mode 100644 index 0000000000000000000000000000000000000000..e5bf8cc78e8361d5bb6ef10b47ed242c42aa7f0f --- /dev/null +++ b/dist/domUtil/animate-buttons.js @@ -0,0 +1,204 @@ +"use strict"; +/** + * Created by gavorhes on 11/2/2015. + */ +var $ = require('jquery'); +var provide_1 = require('../util/provide'); +var range_change_1 = require('./range-change'); +var nm = provide_1.default('jQueryPlugin'); +/** + * @callback mediaCallback + * @param {number} tm + */ +function timeToLocalDateString(tm) { + "use strict"; + var d = new Date(tm); + var p1 = d.toLocaleTimeString().split(' '); + var p2 = p1[0].split(':'); + p2 = p2.slice(0, 2); + return d.toLocaleDateString() + '<br>' + p2.join(':') + ' ' + p1[1]; +} +var MediaControl = (function () { + function MediaControl(element, min, max, val, step, func, playInterval, showAsDate) { + var _this = this; + if (min === void 0) { min = 0; } + if (max === void 0) { max = 100; } + if (val === void 0) { val = 0; } + if (step === void 0) { step = 5; } + if (func === void 0) { func = function () { }; } + if (playInterval === void 0) { playInterval = 5; } + if (showAsDate === void 0) { showAsDate = false; } + if (typeof element == 'string') { + this._container = $('#' + element); + } + else if (typeof element['style'] !== 'undefined') { + this._container = $(element); + } + else { + this._container = element; + } + this._container.addClass('media-control-container'); + this._playInterval = playInterval; + this._interval = undefined; + this._func = func; + this._showAsDate = showAsDate; + this._currentValue = undefined; + this._min = undefined; + this._max = undefined; + this._step = undefined; + this._playing = false; + var htmlStr = '<span class="media-player-button media-back"></span>' + + '<span class="media-player-button media-play"></span>' + + '<span class="media-player-button media-pause media-disabled"></span>' + + '<span class="media-player-button media-stop media-disabled" ></span>' + + '<span class="media-player-button media-ahead"></span>' + + "<input type=\"range\">" + + "<div class=\"media-control-value-label-container\">" + + "<span class=\"media-control-value-label-min\"></span>" + + "<span class=\"media-control-value-label-val\"></span>" + + "<span class=\"media-control-value-label-max\"></span>" + + "</div>"; + this._container.append(htmlStr); + // let btnPause = this._container.find('.media-pause'); + var btnPlay = this._container.find('.media-play'); + this._$btnStop = this._container.find('.media-stop'); + var btnAhead = this._container.find('.media-ahead'); + var btnBack = this._container.find('.media-back'); + this._$slider = this._container.find('input[type=range]'); + this._$valLabelMin = this._container.find('.media-control-value-label-min'); + this._$valLabelVal = this._container.find('.media-control-value-label-val'); + this._$valLabelMax = this._container.find('.media-control-value-label-max'); + this.setMinMaxValueStep(min, max, val, step); + range_change_1.rangeChange(this._$slider, function (newVal) { _this.currentValue = newVal; }, 100); + var ___this = this; + btnPlay.click(function () { + var $this = $(this); + $this.addClass('media-disabled'); + ___this._$btnStop.removeClass('media-disabled'); + btnAhead.addClass('media-locked'); + btnBack.addClass('media-locked'); + ___this._$slider.prop('disabled', true); + ___this._playing = true; + ___this._interval = setInterval(function () { + ___this.currentValue += ___this._step; + }, ___this._playInterval); + }); + this._$btnStop.click(function () { + clearInterval(___this._interval); + var $this = $(this); + $this.addClass('media-disabled'); + btnPlay.removeClass('media-disabled'); + btnAhead.removeClass('media-locked'); + btnBack.removeClass('media-locked'); + ___this._$slider.prop('disabled', false); + ___this._playing = false; + }); + btnAhead.click(function () { + ___this.currentValue = ___this.currentValue + ___this._step; + }); + btnBack.click(function () { + ___this.currentValue = ___this.currentValue - ___this._step; + }); + } + MediaControl.prototype.stopPlaying = function () { + if (this._playing) { + this._$btnStop.trigger('click'); + } + }; + Object.defineProperty(MediaControl.prototype, "playing", { + get: function () { + return this._playing; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MediaControl.prototype, "min", { + get: function () { + return this._min; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MediaControl.prototype, "max", { + get: function () { + return this._max; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MediaControl.prototype, "step", { + get: function () { + return this._step; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MediaControl.prototype, "currentValue", { + get: function () { + return this._currentValue; + }, + set: function (newValue) { + if (newValue > this._max) { + newValue = this._min; + } + else if (newValue < this._min) { + newValue = this._max; + } + this._currentValue = newValue; + this._$slider.val(this._currentValue.toFixed(2)); + if (this._showAsDate) { + this._$valLabelVal.html(timeToLocalDateString(this.currentValue)); + } + else { + this._$valLabelVal.html(this.currentValue.toString()); + } + this._func(newValue); + }, + enumerable: true, + configurable: true + }); + /** + * set min and max value with step + * @param {number} newMin the new min + * @param {number} newMax the new mas + * @param {number} [newValue=newMin] the value to set + * @param {number} [newStep=(newMax-newMin)/20] step value + */ + MediaControl.prototype.setMinMaxValueStep = function (newMin, newMax, newValue, newStep) { + this._min = newMin; + this._max = newMax; + newValue = typeof newValue == 'number' ? newValue : newMin; + newStep = typeof newStep == 'number' ? newStep : (newMax - newMin) / 20; + this._currentValue = newValue; + this._step = newStep; + this._$slider.prop('min', this.min.toString()); + this._$slider.prop('max', this.max.toString()); + this._$slider.prop('step', this.step.toString()); + this._$slider.val(this.currentValue.toString()); + if (this._showAsDate) { + this._$valLabelMin.html(timeToLocalDateString(this._min)); + this._$valLabelVal.html(timeToLocalDateString(this.currentValue)); + this._$valLabelMax.html(timeToLocalDateString(this._max)); + } + else { + this._$valLabelMin.html(this._min.toString()); + this._$valLabelVal.html(this.currentValue.toString()); + this._$valLabelMax.html(this._max.toString()); + } + }; + Object.defineProperty(MediaControl.prototype, "changeFunction", { + /** + * + * @param {mediaCallback} newFunc the callback on change + */ + set: function (newFunc) { + this._func = newFunc; + }, + enumerable: true, + configurable: true + }); + return MediaControl; +}()); +exports.MediaControl = MediaControl; +nm.MediaControl = MediaControl; +//# sourceMappingURL=animate-buttons.js.map \ No newline at end of file diff --git a/dist/domUtil/animate-buttons.js.map b/dist/domUtil/animate-buttons.js.map new file mode 100644 index 0000000000000000000000000000000000000000..662c079efe1c7441e4e259861d842d63c5b58a26 --- /dev/null +++ b/dist/domUtil/animate-buttons.js.map @@ -0,0 +1 @@ +{"version":3,"file":"animate-buttons.js","sourceRoot":"","sources":["../../src-ts/domUtil/animate-buttons.ts"],"names":[],"mappings":";AAGA;;GAEG;AAEH,IAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,wBAAoB,iBAAiB,CAAC,CAAA;AACtC,6BAA0B,gBAAgB,CAAC,CAAA;AAG3C,IAAI,EAAE,GAAG,iBAAO,CAAC,cAAc,CAAC,CAAC;AAEjC;;;GAGG;AAEH,+BAA+B,EAAE;IAC7B,YAAY,CAAC;IACb,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC;IACrB,IAAI,EAAE,GAAG,CAAC,CAAC,kBAAkB,EAAE,CAAC,KAAK,CAA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I,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEhD,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;YACnB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAC1D,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;YAClE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC9C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;YACtD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAClD,CAAC;IACL,CAAC;IAMD,sBAAI,wCAAc;QAJlB;;;WAGG;aACH,UAAmB,OAAO;YACtB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;QACzB,CAAC;;;OAAA;IACL,mBAAC;AAAD,CAAC,AAlMD,IAkMC;AAlMY,oBAAY,eAkMxB,CAAA;AAED,EAAE,CAAC,YAAY,GAAG,YAAY,CAAC"} \ No newline at end of file diff --git a/dist/domUtil/range-change.d.ts b/dist/domUtil/range-change.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..944ff5f3972b1c150883f5f3499c79221d3a3d5e --- /dev/null +++ b/dist/domUtil/range-change.d.ts @@ -0,0 +1,28 @@ +/** + * callback on range change interaction, context of this is the firing dom element + * @callback rangeChangeCallback + * @param {number} newValue + * @param {number} ratio value from 0 to 1 relative of the value to the min and max + * @param {object} evt + */ +/*** + * callback funcion after the slider has been moved + */ +export interface rangeChangedCallback { + /** + * + * @param newValue new value of the slider + * @param ratio ratio from low to high, 0 to 1 + * @param evt the original event + */ + (newValue: number, ratio: number, evt: Event): any; +} +/** + * Add a variety of listeners for range inputs applied to a common callback + * @param $slider - jquery reference to the slider + * @param {rangeChangeCallback} callback - the callback + * @param {number} [changeTimeout=75] before the callback is called + * @this {jQuery} + * @returns {jQuery} the jQuery object + */ +export declare function rangeChange($slider: JQuery, callback: rangeChangedCallback, changeTimeout: number): any; diff --git a/dist/domUtil/range-change.js b/dist/domUtil/range-change.js new file mode 100644 index 0000000000000000000000000000000000000000..95ae2ec5e137edd935b5884681ae7b10d0686d33 --- /dev/null +++ b/dist/domUtil/range-change.js @@ -0,0 +1,94 @@ +"use strict"; +var mouseIn = false; +var mouseDown = false; +var timeout = null; +var dragged = false; +var lastVal; +var $ = require('jquery'); +/** + * Created by gavorhes on 11/2/2015. + */ +function triggerCallback(callback, evt) { + "use strict"; + var val = parseFloat(this.value); + var min = parseFloat(this.min); + var max = parseFloat(this.max); + var step = parseFloat(this.step); + if (max - val < step) { + val = max; + } + var percent = (val - min) / (max - min); + if (typeof lastVal == 'number' && val == lastVal) { + return; + } + lastVal = val; + callback(val, percent, evt); +} +/** + * Add a variety of listeners for range inputs applied to a common callback + * @param $slider - jquery reference to the slider + * @param {rangeChangeCallback} callback - the callback + * @param {number} [changeTimeout=75] before the callback is called + * @this {jQuery} + * @returns {jQuery} the jQuery object + */ +function rangeChange($slider, callback, changeTimeout) { + changeTimeout = typeof changeTimeout == 'number' ? changeTimeout : 75; + $slider.mouseenter(function () { + mouseIn = true; + }); + $slider.mouseleave(function () { + mouseIn = false; + mouseDown = false; + }); + $slider.mousedown(function () { + mouseDown = true; + }); + $slider.mouseup(function () { + mouseDown = false; + }); + $slider.mousemove( + /** + * + * @param {object} evt - event properties + * @this {HTMLElement} + */ + function (evt) { + if (!(mouseIn && mouseDown)) { + return; + } + dragged = true; + if (lastVal == this['value']) { + return; + } + lastVal = this['value']; + if (timeout != null) { + clearTimeout(timeout); + } + var _this = this; + timeout = setTimeout(function () { + triggerCallback.call(_this, callback, evt); + timeout = null; + }, changeTimeout); + }); + $slider.keyup( + /** + * + * @param {object} evt - event properties + */ + function (evt) { + if (evt.keyCode == 37 || evt.keyCode == 39) { + triggerCallback.call(this, callback, evt); + } + }); + $slider.change(function (evt) { + if (dragged) { + dragged = false; + return; + } + triggerCallback.call(this, callback, evt); + }); + return this; +} +exports.rangeChange = rangeChange; +//# sourceMappingURL=range-change.js.map \ No newline at end of file diff --git a/dist/domUtil/range-change.js.map b/dist/domUtil/range-change.js.map new file mode 100644 index 0000000000000000000000000000000000000000..04f579863c8ce957ffb9775d7da60235da58e41a --- /dev/null +++ b/dist/domUtil/range-change.js.map @@ -0,0 +1 @@ +{"version":3,"file":"range-change.js","sourceRoot":"","sources":["../../src-ts/domUtil/range-change.ts"],"names":[],"mappings":";AAEA,IAAI,OAAO,GAAG,KAAK,CAAC;AACpB,IAAI,SAAS,GAAG,KAAK,CAAC;AACtB,IAAI,OAAO,GAAG,IAAI,CAAC;AACnB,IAAI,OAAO,GAAG,KAAK,CAAC;AACpB,IAAI,OAAO,CAAC;AACZ,IAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAyB5B;;GAEG;AAEH,yBAAyB,QAA8B,EAAE,GAAG;IACxD,YAAY,CAAC;IAEb,IAAI,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,IAAI,GAAG,UAAU,CAAC,IAAI,C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C3B,MAAM,CAAC;QACX,CAAC;QACD,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QAExB,EAAE,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC;YAClB,YAAY,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;QAED,IAAI,KAAK,GAAG,IAAI,CAAC;QAEjB,OAAO,GAAG,UAAU,CAAC;YACjB,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;YAC3C,OAAO,GAAG,IAAI,CAAC;QAEnB,CAAC,EAAE,aAAa,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,KAAK;IACT;;;OAGG;IACH,UAAU,GAAG;QACb,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,IAAI,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;YACzC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,MAAM,CAAC,UAAU,GAAG;QACxB,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACV,OAAO,GAAG,KAAK,CAAC;YAEhB,MAAM,CAAC;QACX,CAAC;QACD,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC;AAChB,CAAC;AAzEe,mBAAW,cAyE1B,CAAA"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..fa69a5a9d218e56f92bd5aa7e54a4cb8302b5f02 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,2 @@ +"use strict"; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f9117bdf31534c869c064be60643f3aaaa096017 --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src-ts/index.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib-ts/jquery-plugin/animate-buttons.d.ts b/dist/jquery-plugin/animate-buttons.d.ts similarity index 100% rename from lib-ts/jquery-plugin/animate-buttons.d.ts rename to dist/jquery-plugin/animate-buttons.d.ts diff --git a/lib-ts/jquery-plugin/animate-buttons.js b/dist/jquery-plugin/animate-buttons.js similarity index 99% rename from lib-ts/jquery-plugin/animate-buttons.js rename to dist/jquery-plugin/animate-buttons.js index 05c8955807604bc1a2f1ffa2becac55ae495e3bb..662d68373c7808082ce2c3dd2bd5078bc2324f47 100644 --- a/lib-ts/jquery-plugin/animate-buttons.js +++ b/dist/jquery-plugin/animate-buttons.js @@ -3,7 +3,7 @@ */ "use strict"; var $ = require('jquery'); -var provide_1 = require('../util/provide'); +var provide_1 = require('./provide'); var nm = provide_1.default('jQueryPlugin'); /** * @callback mediaCallback diff --git a/lib-ts/jquery-plugin/animate-buttons.js.map b/dist/jquery-plugin/animate-buttons.js.map similarity index 100% rename from lib-ts/jquery-plugin/animate-buttons.js.map rename to dist/jquery-plugin/animate-buttons.js.map diff --git a/dist/jquery-plugin/day-range.d.ts b/dist/jquery-plugin/day-range.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..68533b2e24fe9869ec9bcb69b42adb7bba372e75 --- /dev/null +++ b/dist/jquery-plugin/day-range.d.ts @@ -0,0 +1,21 @@ +export declare class DayRange { + _workingDayRange: number; + _$startDate: JQuery; + _$endDate: JQuery; + _maxDateRange: number; + _startDate: Date; + _endDate: Date; + /** + * constructor for the date range + * @param {number} dayRange number of days + * @param {jQuery|HTMLElement|*} jQueryRef reference to the jquery element + */ + constructor(dayRange: any, jQueryRef: any); + /** + * + * @param val + */ + startDate: Date; + endDate: Date; +} +export default DayRange; diff --git a/dist/jquery-plugin/day-range.js b/dist/jquery-plugin/day-range.js new file mode 100644 index 0000000000000000000000000000000000000000..aac449f4c452c491023ab527a41a6c5d90b8c8e3 --- /dev/null +++ b/dist/jquery-plugin/day-range.js @@ -0,0 +1,96 @@ +"use strict"; +var provide_1 = require('../util/provide'); +var nm = provide_1.default('jQueryPlugin'); +var $ = require('jquery'); +require('jquery-ui'); +var DayRange = (function () { + /** + * constructor for the date range + * @param {number} dayRange number of days + * @param {jQuery|HTMLElement|*} jQueryRef reference to the jquery element + */ + function DayRange(dayRange, jQueryRef) { + this._workingDayRange = dayRange - 1; + var pickerHtml = '<label for="start-date" style="width: 78px; display: inline-block; margin:5px;">Start Date</label>' + + '<input type="text" readonly id="start-date" class="date-pick" style="width: 90px;">' + + '<br><label for="end-date" style="width: 78px; display: inline-block; margin:5px;">End Date</label>' + + '<input type="text" readonly id="end-date" class="date-pick" style="width: 90px;">'; + jQueryRef.append(pickerHtml); + this._$startDate = $('#start-date'); + this._$endDate = $('#end-date'); + this._$startDate['datepicker'](); + this._$endDate['datepicker'](); + this._startDate = null; + this._endDate = null; + var dte1 = new Date(); + dte1.setHours(0, 0, 0, 0); + var dte2 = new Date(dte1.getTime()); + dte2.setDate(dte2.getDate() + dayRange); + dte2.setHours(23, 59, 59, 0); + this._maxDateRange = dte2.getTime() - dte1.getTime(); + var _this = this; + //add event listeners + this._$startDate.change(function () { + _this.startDate = this.value; + }); + this._$endDate.change(function () { + _this.endDate = this.value; + }); + // initialize + this.endDate = new Date(); + } + Object.defineProperty(DayRange.prototype, "startDate", { + get: function () { + return this._startDate; + }, + /** + * + * @param val + */ + set: function (val) { + this._startDate = val; + this._startDate.setHours(0, 0, 0, 0); + this._$startDate.val(this._startDate.toLocaleDateString()); + if (this.endDate == null || + this._endDate.getTime() - this._startDate.getTime() > this._maxDateRange || + this._endDate.getTime() - this._startDate.getTime() < 24 * 60 * 60 * 1000) { + var tmpDate = new Date(this._startDate.getTime()); + tmpDate.setDate(tmpDate.getDate() + this._workingDayRange); + this.endDate = new Date(tmpDate.getTime()); + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DayRange.prototype, "endDate", { + get: function () { + return this._endDate; + }, + set: function (val) { + this._endDate = val; + this._endDate.setHours(23, 59, 59, 0); + this._$endDate.val(this._endDate.toLocaleDateString()); + if (this._startDate == null || this._endDate.getTime() - this.startDate.getTime() > this._maxDateRange || this._endDate.getTime() - this._startDate.getTime() < 24 * 60 * 60 * 1000) { + var tmpDate = new Date(this._endDate.getTime()); + tmpDate.setDate(tmpDate.getDate() - this._workingDayRange); + this.startDate = new Date(tmpDate.getTime()); + } + }, + enumerable: true, + configurable: true + }); + return DayRange; +}()); +exports.DayRange = DayRange; +nm.DayRange = DayRange; +/** + * Adds day range control + * @param {number} dayRange the number of days + * @returns {DayRange} the day range object + */ +jQuery.fn.dayRange = function (dayRange) { + return new DayRange(dayRange, this); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = DayRange; +//# sourceMappingURL=day-range.js.map \ No newline at end of file diff --git a/dist/jquery-plugin/day-range.js.map b/dist/jquery-plugin/day-range.js.map new file mode 100644 index 0000000000000000000000000000000000000000..91e5b98eb6f12262dca953d7ca7713b0d785b339 --- /dev/null +++ b/dist/jquery-plugin/day-range.js.map @@ -0,0 +1 @@ +{"version":3,"file":"day-range.js","sourceRoot":"","sources":["../../src-ts/jquery-plugin/day-range.ts"],"names":[],"mappings":";AACA,wBAAoB,iBAAiB,CAAC,CAAA;AACtC,IAAI,EAAE,GAAG,iBAAO,CAAC,cAAc,CAAC,CAAC;AAEjC,IAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,OAAO,CAAC,WAAW,CAAC,CAAC;AAErB;IAQI;;;;OAIG;IACH,kBAAY,QAAQ,EAAE,SAAS;QAC3B,IAAI,CAAC,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AAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YACtC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,CAAC;YACvD,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;gBAClL,IAAI,OAAO,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;gBAChD,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC;gBAC3D,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;YACjD,CAAC;QACL,CAAC;;;OAZA;IAaL,eAAC;AAAD,CAAC,AA5FD,IA4FC;AA5FY,gBAAQ,WA4FpB,CAAA;AAED,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAEvB;;;;GAIG;AACH,MAAM,CAAC,EAAE,CAAC,QAAQ,GAAG,UAAU,QAAQ;IACnC,MAAM,CAAC,IAAI,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF;kBAAe,QAAQ,CAAC"} \ No newline at end of file diff --git a/lib-ts/jquery-plugin/range-change.d.ts b/dist/jquery-plugin/range-change.d.ts similarity index 100% rename from lib-ts/jquery-plugin/range-change.d.ts rename to dist/jquery-plugin/range-change.d.ts diff --git a/lib-ts/jquery-plugin/range-change.js b/dist/jquery-plugin/range-change.js similarity index 100% rename from lib-ts/jquery-plugin/range-change.js rename to dist/jquery-plugin/range-change.js diff --git a/lib-ts/jquery-plugin/range-change.js.map b/dist/jquery-plugin/range-change.js.map similarity index 100% rename from lib-ts/jquery-plugin/range-change.js.map rename to dist/jquery-plugin/range-change.js.map diff --git a/dist/jquery/floatthead.d.ts b/dist/jquery/floatthead.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b9d7f5ed4d1735fd67c2c615d1cc80f17018883c --- /dev/null +++ b/dist/jquery/floatthead.d.ts @@ -0,0 +1,20 @@ +/** + * implement the default window scroll + * @param {jQuery} $table - jquery reference to table + * @param {object} [options={}] float options + */ +export declare function windowScroll($table: any, options: any): void; +/** + * + * @param {jQuery} $table - jquery reference to table + * @param {jQuery} $tableContainer - jquery reference to table + * @param {object} [options={}] float options + */ +export declare function overflowScroll($table: JQuery, $tableContainer: JQuery, options?: any): void; +/** + * + * @param {jQuery} $table - jquery reference to table + * @param {jQuery} $responsiveContainer - jquery reference to table + * @param {object} [options={}] float options + */ +export declare function responsiveScroll($table: JQuery, $responsiveContainer: JQuery, options?: any): void; diff --git a/dist/jquery/floatthead.js b/dist/jquery/floatthead.js new file mode 100644 index 0000000000000000000000000000000000000000..7d13dce89d2e661c0f0936a3239703ecad3b6b77 --- /dev/null +++ b/dist/jquery/floatthead.js @@ -0,0 +1,49 @@ +"use strict"; +/** + * Created by gavorhes on 6/22/2016. + */ +var $ = require('jquery'); +global['jQuery'] = $; +require('floatthead'); +/** + * implement the default window scroll + * @param {jQuery} $table - jquery reference to table + * @param {object} [options={}] float options + */ +function windowScroll($table, options) { + "use strict"; + options = options || {}; + $table['floatThead'](options); +} +exports.windowScroll = windowScroll; +/** + * + * @param {jQuery} $table - jquery reference to table + * @param {jQuery} $tableContainer - jquery reference to table + * @param {object} [options={}] float options + */ +function overflowScroll($table, $tableContainer, options) { + "use strict"; + options = options || {}; + options.scrollContainer = function (t) { + return $tableContainer; + }; + $table['floatThead'](options); +} +exports.overflowScroll = overflowScroll; +/** + * + * @param {jQuery} $table - jquery reference to table + * @param {jQuery} $responsiveContainer - jquery reference to table + * @param {object} [options={}] float options + */ +function responsiveScroll($table, $responsiveContainer, options) { + "use strict"; + options = options || {}; + options.responsiveContainer = function (t) { + return $responsiveContainer; + }; + $table['floatThead'](options); +} +exports.responsiveScroll = responsiveScroll; +//# sourceMappingURL=floatthead.js.map \ No newline at end of file diff --git a/dist/jquery/floatthead.js.map b/dist/jquery/floatthead.js.map new file mode 100644 index 0000000000000000000000000000000000000000..34d7cd3cfda0b1cd647f851de90812a7c0ec104c --- /dev/null +++ b/dist/jquery/floatthead.js.map @@ -0,0 +1 @@ +{"version":3,"file":"floatthead.js","sourceRoot":"","sources":["../../src-ts/jquery/floatthead.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,IAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAErB,OAAO,CAAC,YAAY,CAAC,CAAC;AAItB;;;;GAIG;AACH,sBAA6B,MAAM,EAAE,OAAO;IACxC,YAAY,CAAC;IACb,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;IAExB,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AALe,oBAAY,eAK3B,CAAA;AAED;;;;;GAKG;AACH,wBAA+B,MAAc,EAAE,eAAuB,EAAE,OAAQ;IAC5E,YAAY,CAAC;IACb,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;IAExB,OAAO,CAAC,eAAe,GAAG,UAAC,CAAC;QACxB,MAAM,CAAC,eAAe,CAAC;IAC3B,CAAC,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AATe,sBAAc,iBAS7B,CAAA;AAED;;;;;GAKG;AACH,0BAAiC,MAAc,EAAE,oBAA4B,EAAE,OAAQ;IACnF,YAAY,CAAC;IACb,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;IAExB,OAAO,CAAC,mBAAmB,GAAG,UAAC,CAAC;QAC5B,MAAM,CAAC,oBAAoB,CAAC;IAChC,CAAC,CAAC;IAEF,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AATe,wBAAgB,mBAS/B,CAAA"} \ No newline at end of file diff --git a/dist/layers/LayerBase.d.ts b/dist/layers/LayerBase.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6bfe7700a15f9b78193a9365c63791730b9bc056 --- /dev/null +++ b/dist/layers/LayerBase.d.ts @@ -0,0 +1,187 @@ +/// <reference path="../../definitions/jquery.d.ts" /> +/// <reference path="../../definitions/node.d.ts" /> +import { ol } from 'custom-ol'; +export interface LayerBaseOptions { + id?: string; + name?: string; + opacity?: number; + visible?: boolean; + minZoom?: number; + maxZoom?: number; + params?: any; + zIndex?: number; + loadCallback?: Function; + legendCollapse?: boolean; + legendCheckbox?: boolean; + legendContent?: string; +} +/** + * The base layer class + * @abstract + */ +export declare abstract class LayerBase { + _legendCheckbox: boolean; + _url: string; + _opacity: number; + _minZoom: number; + _maxZoom: number; + _visible: boolean; + _loaded: boolean; + _zIndex: number; + _legendContent: string; + _params: any; + id: string; + _name: string; + _source: ol.source.Source; + animate: boolean; + _legendCollapse: boolean; + _maxResolution: number; + _minResolution: number; + _$legendDiv: JQuery; + loadCallback: Function; + _olLayer: ol.layer.Layer; + _applyCollapseCalled: boolean; + /** + * The base layer for all others + * @param {string} url - url for source + * @param {object} options - config + * @param {string} [options.id=makeGuid()] - layer id + * @param {string} [options.name=Unnamed Layer] - layer name + * @param {number} [options.opacity=1] - opacity + * @param {boolean} [options.visible=true] - default visible + * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28 + * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28 + * @param {object} [options.params={}] - the get parameters to include to retrieve the layer + * @param {number} [options.zIndex=0] - the z index for the layer + * @param {function} [options.loadCallback] - function to call on load, context this is the layer object + * @param {boolean} [options.legendCollapse=false] - if the legend item should be initially collapsed + * @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); + /** + * base load function, sets _loaded = true if it is not already + * @protected + * @returns {boolean} if already loaded + */ + _load(): boolean; + /** + * Get the legend html, be sure to only add to the DOM once + * @returns {string} html for layer wrapped in a div + */ + getLegendDiv(): string; + /** + * + * @param {string|undefined} additionalContent - additional content to add to legend + * @private + */ + _addLegendContent(additionalContent: any): void; + /** + * add additional content to the legend + * @param {string} [additionalContent=] - additonal content to add + */ + addLegendContent(additionalContent: any): void; + applyCollapse(): any; + /** + * trick to refresh the layer + */ + refresh(): void; + /** + * get the legend content + * @type {string} + */ + /** + * set the legend content directly + * @param {string} newVal - new content + * @protected + */ + legendContent: string; + /** + * get the map get params + * @type {object} + */ + /** + * set the map get params + * @param {object} newParams - new get params + * @protected + */ + params: any; + /** + * get the minimum resolution + * @type {number|*} + */ + minResolution: number; + /** + * get the maximum resolution + * @type {number|*} + */ + maxResolution: number; + /** + * get min zoom + * @type {number|*} + */ + minZoom: number; + /** + * get max zoom + * @type {number|*} + */ + maxZoom: number; + /** + * get the url + * @type {string} + */ + url: string; + /** + * Get the layer visibility + * @type {boolean} + */ + /** + * set the visibility + * @param visibility + */ + visible: boolean; + protected setVisible(visibility: boolean): void; + /** + * Get the layer opacity + * @type {number} + */ + /** + * Set the layer opacity + * @param {number} opacity - layer opacity + */ + opacity: number; + /** + * Get the layer name + * @type {string} + */ + /** + * set the layer name + * @param {string} newName - the new name + */ + name: string; + /** + * Check if the layer is loaded + * @type {boolean} + */ + loaded: boolean; + /** + * get the layer source + * @type {*} + */ + source: ol.source.Source; + protected getSource(): ol.source.Source; + /** + * get the z index + */ + /** + * set the z index + */ + zIndex: number; + protected setZIndex(newZ: number): void; + /** + * the the ol layer + */ + olLayer: ol.layer.Layer; + protected getOlLayer(): ol.layer.Layer; +} +export default LayerBase; diff --git a/lib-ts/src-ts/layers/LayerBase.js b/dist/layers/LayerBase.js similarity index 100% rename from lib-ts/src-ts/layers/LayerBase.js rename to dist/layers/LayerBase.js diff --git a/dist/layers/LayerBase.js.map b/dist/layers/LayerBase.js.map new file mode 100644 index 0000000000000000000000000000000000000000..350912d54a19ffbc9b01e1519ae269b569c40ebb --- /dev/null +++ b/dist/layers/LayerBase.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LayerBase.js","sourceRoot":"","sources":["../../src-ts/layers/LayerBase.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oDAAoD;AACpD,IAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,yBAAqB,kBAAkB,CAAC,CAAA;AACxC,IAAY,qBAAqB,WAAM,oCAAoC,CAAC,CAAA;AAC5E,wBAAoB,iBAAiB,CAAC,CAAA;AAEtC,IAAM,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAmB7B;;;GAGG;AACH;IA0BI;;;;;;;;;;;;;;;;OAgBG;IACH,mBAAY,GAAW,EAAE,OAA0B;QAC/C,OAAO,GAAG,OAAO,IAAI,EAAsB,CAAC;QAE5C,EAAE,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC;YAC1B,MAAM,aAAa,CAAC;QACxB,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAGhB,IAAI,CAAC,OAAO,GAAG,OAAO,OAAO,CAAC,MAAM,IAAI,QAAQ,GAAG,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC;QACvE,IAAI,CAAC,eAAe,GAAG,OAAO,OAAO,CAAC,cAAc,IAAI,SAAS,GAAG,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC;QACnG,IAAI,CAAC,eAAe,GAAG,OAAO,OAAO,CAAC,cAAc,IAAI,SAAS,GA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U,EAAE,CAAC;QAC7B,CAAC;;;OAAA;IAES,8BAAU,GAApB;QACI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IACL,gBAAC;AAAD,CAAC,AA1YD,IA0YC;AA1YqB,iBAAS,YA0Y9B,CAAA;AAED,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;AACzB;kBAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/dist/layers/LayerBaseVector.d.ts b/dist/layers/LayerBaseVector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a5095e25c71d165c68fa774e0c1ee24e27c4a57a --- /dev/null +++ b/dist/layers/LayerBaseVector.d.ts @@ -0,0 +1,149 @@ +/// <reference path="../../definitions/jquery.d.ts" /> +/// <reference path="../../definitions/node.d.ts" /> +import { LayerBase, LayerBaseOptions } from './LayerBase'; +import MapMoveCls from '../olHelpers/mapMoveCls'; +import { ol } from 'custom-ol'; +export interface makeMapMoveParams { + /** + * + * @param lyr + * @param extent + * @param zoomLevel + */ + (lyr: LayerBaseVector, extent: Array<number>, zoomLevel?: number): any; +} +export interface LayerBaseVectorOptions extends LayerBaseOptions { + autoLoad?: boolean; + style?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction; + onDemand?: boolean; + onDemandDelay?: number; + mapMoveMakeGetParams?: makeMapMoveParams; + mapMoveObj?: MapMoveCls; +} +/** + * The Vector layer base + * @augments LayerBase + * @abstract + */ +export declare class LayerBaseVector extends LayerBase { + _olLayer: ol.layer.Vector; + _source: ol.source.Vector; + _style: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction; + _autoLoad: boolean; + _onDemand: boolean; + _onDemandDelay: number; + _mapMoveMakeGetParams: makeMapMoveParams; + _mapMoveParams: any; + _mapMove: MapMoveCls; + _projectionMap: ol.proj.Projection; + _projection4326: ol.proj.Projection; + /** + * The base vector layer + * @param {string} url - pass an empty string to prevent default load and add from a json source + * @param {object} options - config + * @param {string} [options.id] - layer id + * @param {string} [options.name=Unnamed Layer] - layer name + * @param {number} [options.opacity=1] - opacity + * @param {boolean} [options.visible=true] - default visible + * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28 + * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28 + * @param {object} [options.params={}] the get parameters to include to retrieve the layer + * @param {number} [options.zIndex=0] the z index for the layer + * @param {function} [options.loadCallback] function to call on load, context this is the layer object + * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed + * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility + * @param {boolean} [options.legendContent] additional content to add to the legend + * + * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible + * @param {object} [options.style=undefined] the layer style, use openlayers default style if not defined + * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move + * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called + * @param {mapMoveMakeGetParams} [options.mapMoveMakeGetParams=function(lyr, extent, zoomLevel){}] function to create additional map move params + * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages + * + */ + constructor(url: string, options: LayerBaseVectorOptions); + /** + * dummy to be overridden + * @param {object} featureCollection - geojson or esrijson object + */ + addFeatures(featureCollection: any): void; + /** + * Before call to map move callback, can prevent call by returning false + * @param {number} zoom - zoom level + * @param {string} [evtType=undefined] undefined for initial load, otherwise one of 'change:center', 'change:resolution' + * @returns {boolean} if the call should proceed + */ + mapMoveBefore(zoom: any, evtType: any): boolean; + /** + * callback to generate the parameters passed in the get request + * @param {object} extent - extent object + * @param {number} extent.minX - minX + * @param {number} extent.minY - minY + * @param {number} extent.maxX - maxX + * @param {number} extent.maxY - maxY + * @param {number} zoomLevel - zoom level + */ + mapMoveMakeGetParams(extent: any, zoomLevel: any): void; + /** + * callback function on map move + * @param {object} d - the json response + */ + mapMoveCallback(d: any): void; + /** + * clear features in the layer + */ + clear(): void; + /** + * get on demand delay in miliseconds + */ + onDemandDelay: number; + /** + * get if the layer is autoloaded + */ + autoLoad: boolean; + /** + * get the style definition + */ + /** + * set the style + * @param style - the style or function + */ + style: ol.style.StyleFunction | Array<ol.style.Style> | ol.style.Style; + /** + * get the map CRS if it is defined by the map move object + */ + mapCrs: string; + mapProj: ol.proj.Projection; + /** + * get the map move object + * @type {MapMoveCls|*} + */ + mapMove: MapMoveCls; + /** + * map move params + * @type {object} + */ + mapMoveParams: any; + /** + * Set the layer visibility + * @type {boolean} + * @override + */ + visible: boolean; + /** + * get the layer vector source + * @override + */ + source: ol.source.Vector; + /** + * array of ol features + */ + features: Array<ol.Feature>; + /** + * + */ + olLayer: ol.layer.Vector; + protected setZIndex(newZ: number): void; +} +export default LayerBaseVector; diff --git a/dist/layers/LayerBaseVector.js b/dist/layers/LayerBaseVector.js new file mode 100644 index 0000000000000000000000000000000000000000..aa2b1ecaa48e87ee7be8e36fbda10dde16053f5e --- /dev/null +++ b/dist/layers/LayerBaseVector.js @@ -0,0 +1,291 @@ +/// <reference path="../../definitions/jquery.d.ts" /> +/// <reference path="../../definitions/node.d.ts" /> +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var LayerBase_1 = require('./LayerBase'); +var mapMove_1 = require('../olHelpers/mapMove'); +var provide_1 = require('../util/provide'); +var custom_ol_1 = require('custom-ol'); +var $ = require('jquery'); +var g = new custom_ol_1.ol.Map({}); +var nm = provide_1.default('layers'); +/** + * The Vector layer base + * @augments LayerBase + * @abstract + */ +var LayerBaseVector = (function (_super) { + __extends(LayerBaseVector, _super); + /** + * The base vector layer + * @param {string} url - pass an empty string to prevent default load and add from a json source + * @param {object} options - config + * @param {string} [options.id] - layer id + * @param {string} [options.name=Unnamed Layer] - layer name + * @param {number} [options.opacity=1] - opacity + * @param {boolean} [options.visible=true] - default visible + * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28 + * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28 + * @param {object} [options.params={}] the get parameters to include to retrieve the layer + * @param {number} [options.zIndex=0] the z index for the layer + * @param {function} [options.loadCallback] function to call on load, context this is the layer object + * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed + * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility + * @param {boolean} [options.legendContent] additional content to add to the legend + * + * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible + * @param {object} [options.style=undefined] the layer style, use openlayers default style if not defined + * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move + * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called + * @param {mapMoveMakeGetParams} [options.mapMoveMakeGetParams=function(lyr, extent, zoomLevel){}] function to create additional map move params + * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages + * + */ + function LayerBaseVector(url, options) { + _super.call(this, url, options); + options = options; + //prevent regular load if no url has been provided + if (this.url.trim() == '') { + this._loaded = true; + } + this._style = typeof options.style == 'undefined' ? undefined : options.style; + if (this.visible) { + this._autoLoad = true; + } + else { + this._autoLoad = (typeof options['autoLoad'] == 'boolean' ? options['autoLoad'] : false); + } + this._onDemand = typeof options.onDemand == 'boolean' ? options.onDemand : false; + this._onDemandDelay = typeof options.onDemandDelay == 'number' ? options.onDemandDelay : 300; + if (options.mapMoveObj) { + this._mapMove = options.mapMoveObj; + } + else { + this._mapMove = this._onDemand ? mapMove_1.default : undefined; + } + this._mapMoveMakeGetParams = typeof options.mapMoveMakeGetParams == 'function' ? options.mapMoveMakeGetParams : + function () { return {}; }; + if (this._onDemand) { + this._loaded = true; + this._mapMoveParams = {}; + this._mapMove.checkInit(); + this._mapMove.addVectorLayer(this); + } + this._source = new custom_ol_1.ol.source.Vector(); + this._olLayer = new custom_ol_1.ol.layer.Vector({ + source: this._source, + visible: this.visible, + style: this.style, + minResolution: this._minResolution, + maxResolution: this._maxResolution, + zIndex: this._zIndex + }); + this._projectionMap = null; + this._projection4326 = new custom_ol_1.ol.proj.Projection({ code: "EPSG:4326" }); + } + /** + * dummy to be overridden + * @param {object} featureCollection - geojson or esrijson object + */ + LayerBaseVector.prototype.addFeatures = function (featureCollection) { + console.log('Layer vector base addFeatures is a placeholder and does nothing'); + }; + /** + * Before call to map move callback, can prevent call by returning false + * @param {number} zoom - zoom level + * @param {string} [evtType=undefined] undefined for initial load, otherwise one of 'change:center', 'change:resolution' + * @returns {boolean} if the call should proceed + */ + LayerBaseVector.prototype.mapMoveBefore = function (zoom, evtType) { + if (this.minZoom !== undefined) { + if (zoom < this.minZoom) { + return false; + } + } + if (this.maxZoom !== undefined) { + if (zoom > this.maxZoom) { + return false; + } + } + return this.visible; + }; + /** + * callback to generate the parameters passed in the get request + * @param {object} extent - extent object + * @param {number} extent.minX - minX + * @param {number} extent.minY - minY + * @param {number} extent.maxX - maxX + * @param {number} extent.maxY - maxY + * @param {number} zoomLevel - zoom level + */ + LayerBaseVector.prototype.mapMoveMakeGetParams = function (extent, zoomLevel) { + this._mapMoveParams = {}; + $.extend(this._mapMoveParams, this.params); + $.extend(this._mapMoveParams, this._mapMoveMakeGetParams(this, extent, zoomLevel)); + }; + /** + * callback function on map move + * @param {object} d - the json response + */ + LayerBaseVector.prototype.mapMoveCallback = function (d) { + if (this.source) { + this._source.clear(); + } + }; + /** + * clear features in the layer + */ + LayerBaseVector.prototype.clear = function () { + if (this._source) { + this._source.clear(); + } + }; + Object.defineProperty(LayerBaseVector.prototype, "onDemandDelay", { + /** + * get on demand delay in miliseconds + */ + get: function () { + return this._onDemandDelay; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBaseVector.prototype, "autoLoad", { + /** + * get if the layer is autoloaded + */ + get: function () { + return this._autoLoad; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBaseVector.prototype, "style", { + /** + * get the style definition + */ + get: function () { + return this._style; + }, + /** + * set the style + * @param style - the style or function + */ + set: function (style) { + this._style = style; + this.olLayer.setStyle(this._style); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBaseVector.prototype, "mapCrs", { + /** + * get the map CRS if it is defined by the map move object + */ + get: function () { + return this.mapProj == null ? null : this.mapProj.getCode(); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBaseVector.prototype, "mapProj", { + get: function () { + if (this._projectionMap != null) { + return this._projectionMap; + } + if (this._mapMove) { + this._projectionMap = this._mapMove.map.getView().getProjection(); + return this._projectionMap; + } + else { + return null; + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBaseVector.prototype, "mapMove", { + /** + * get the map move object + * @type {MapMoveCls|*} + */ + get: function () { + return this._mapMove; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBaseVector.prototype, "mapMoveParams", { + /** + * map move params + * @type {object} + */ + get: function () { + return this._mapMoveParams; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBaseVector.prototype, "visible", { + get: function () { + return this._visible; + }, + /** + * Set the layer visibility + * @type {boolean} + * @override + */ + set: function (visibility) { + _super.prototype.setVisible.call(this, visibility); + if (this._onDemand) { + this.mapMove.triggerLyrLoad(this); + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBaseVector.prototype, "source", { + /** + * get the layer vector source + * @override + */ + get: function () { + return this.getSource(); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBaseVector.prototype, "features", { + /** + * array of ol features + */ + get: function () { + return this.source.getFeatures(); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBaseVector.prototype, "olLayer", { + /** + * + */ + get: function () { + return _super.prototype.getOlLayer.call(this); + }, + enumerable: true, + configurable: true + }); + LayerBaseVector.prototype.setZIndex = function (newZ) { + this.olLayer.setZIndex(newZ); + }; + return LayerBaseVector; +}(LayerBase_1.LayerBase)); +exports.LayerBaseVector = LayerBaseVector; +nm.LayerBaseVector = LayerBaseVector; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = LayerBaseVector; +//# sourceMappingURL=LayerBaseVector.js.map \ No newline at end of file diff --git a/dist/layers/LayerBaseVector.js.map b/dist/layers/LayerBaseVector.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e61a77e0571e25a0013b1ba7f363789578cca14b --- /dev/null +++ b/dist/layers/LayerBaseVector.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LayerBaseVector.js","sourceRoot":"","sources":["../../src-ts/layers/LayerBaseVector.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,oDAAoD;;;;;;;AAGpD,0BAA0C,aAAa,CAAC,CAAA;AACxD,wBAAoB,sBAAsB,CAAC,CAAA;AAE3C,wBAAoB,iBAAiB,CAAC,CAAA;AACtC,0BAAiB,WAAW,CAAC,CAAA;AAC7B,IAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE5B,IAAI,CAAC,GAAG,IAAI,cAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAEvB,IAAM,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAwB7B;;;;GAIG;AACH;IAAqC,mCAAS;IAe1C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,yBAAY,GAAW,EAAE,OAA+B;QACpD,kBAAM,GAAG,EAAE,OAAO,CAAC,CAAC;QAEpB,OAAO,GAAG,OAAiC,CAAC;QAE5C,kDAAkD;QAClD,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACxB,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,OAAO,OAAO,CAAC,KAAK,IAAI,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC;QAE9E,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YACf,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAC1B,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,IAAI,CAAC,SAAS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5QD,CAAqC,qBAAS,GA4Q7C;AA5QY,uBAAe,kBA4Q3B,CAAA;AAED,EAAE,CAAC,eAAe,GAAG,eAAe,CAAC;AACrC;kBAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/dist/layers/LayerBaseVectorGeoJson.d.ts b/dist/layers/LayerBaseVectorGeoJson.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f825259ede10d4e1cfe502711b3622b9b58afa16 --- /dev/null +++ b/dist/layers/LayerBaseVectorGeoJson.d.ts @@ -0,0 +1,68 @@ +/** + * Created by gavorhes on 11/2/2015. + */ +import { LayerBaseVector, LayerBaseVectorOptions } from './LayerBaseVector'; +import { ol } from 'custom-ol'; +import { MapMoveCls } from "../olHelpers/mapMoveCls"; +export interface LayerBaseVectorGeoJsonOptions extends LayerBaseVectorOptions { + transform?: CrsTransform; + mapMoveObj?: MapMoveCls; +} +export interface CrsTransform { + dataProjection: ol.proj.Projection | string; + featureProjection: ol.proj.Projection | string; +} +/** + * The Vector GeoJson Layer + * @augments LayerBaseVector + */ +declare class LayerBaseVectorGeoJson extends LayerBaseVector { + _geoJsonFormat: ol.format.GeoJSON; + _transform: CrsTransform; + /** + * @param {string|undefined|null} url - resource url, set to '' to make blank layer + * @param {object} options - config + * @param {string} [options.id] - layer id + * @param {string} [options.name=Unnamed Layer] - layer name + * @param {number} [options.opacity=1] - opacity + * @param {boolean} [options.visible=true] - default visible + * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28 + * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28 + * @param {object} [options.params={}] the get parameters to include to retrieve the layer + * @param {number} [options.zIndex=0] the z index for the layer + * @param {function} [options.loadCallback] function to call on load, context this is the layer object + * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed + * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility + * @param {boolean} [options.legendContent] additional content to add to the legend + * + * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible + * @param {object} [options.style=undefined] the layer style, use openlayers default style if not defined + * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move + * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called + * + * @param {object} [options.transform={}] SR transform, set as false for no transform + * @param {string} options.transform.dataProjection=EPSG:4326 the data CRS + * @param {string} options.transform.featureProjection=EPSG:3857 the feature/map CRS + * @param {mapMoveMakeGetParams} [options.mapMoveMakeGetParams=function(lyr, extent, zoomLevel){}] function to create additional map move params + * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages + */ + constructor(url: any, options?: LayerBaseVectorGeoJsonOptions); + /** + * add feature collection + * @param {object} featureCollection - as geojson object + */ + addFeatures(featureCollection: JSON): void; + /** + * trigger load features + * @protected + * @returns {boolean} if already loaded + */ + _load(): boolean; + /** + * callback function on map move + * @param {object} d the json response + * @override + */ + mapMoveCallback(d: any): void; +} +export default LayerBaseVectorGeoJson; diff --git a/dist/layers/LayerBaseVectorGeoJson.js b/dist/layers/LayerBaseVectorGeoJson.js new file mode 100644 index 0000000000000000000000000000000000000000..539a743955a42b66f8c4de744a4c03e9b347c12c --- /dev/null +++ b/dist/layers/LayerBaseVectorGeoJson.js @@ -0,0 +1,101 @@ +/** + * Created by gavorhes on 11/2/2015. + */ +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var LayerBaseVector_1 = require('./LayerBaseVector'); +var provide_1 = require('../util/provide'); +var custom_ol_1 = require('custom-ol'); +var nm = provide_1.default('layers'); +var $ = require('jquery'); +/** + * The Vector GeoJson Layer + * @augments LayerBaseVector + */ +var LayerBaseVectorGeoJson = (function (_super) { + __extends(LayerBaseVectorGeoJson, _super); + /** + * @param {string|undefined|null} url - resource url, set to '' to make blank layer + * @param {object} options - config + * @param {string} [options.id] - layer id + * @param {string} [options.name=Unnamed Layer] - layer name + * @param {number} [options.opacity=1] - opacity + * @param {boolean} [options.visible=true] - default visible + * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28 + * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28 + * @param {object} [options.params={}] the get parameters to include to retrieve the layer + * @param {number} [options.zIndex=0] the z index for the layer + * @param {function} [options.loadCallback] function to call on load, context this is the layer object + * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed + * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility + * @param {boolean} [options.legendContent] additional content to add to the legend + * + * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible + * @param {object} [options.style=undefined] the layer style, use openlayers default style if not defined + * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move + * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called + * + * @param {object} [options.transform={}] SR transform, set as false for no transform + * @param {string} options.transform.dataProjection=EPSG:4326 the data CRS + * @param {string} options.transform.featureProjection=EPSG:3857 the feature/map CRS + * @param {mapMoveMakeGetParams} [options.mapMoveMakeGetParams=function(lyr, extent, zoomLevel){}] function to create additional map move params + * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages + */ + function LayerBaseVectorGeoJson(url, options) { + url = typeof url == 'string' ? url : ''; + _super.call(this, url, options); + this._geoJsonFormat = new custom_ol_1.ol.format.GeoJSON(); + this._transform = options.transform || { dataProjection: "EPSG:4326", featureProjection: "EPSG:3857" }; + if (this.autoLoad || this.visible) { + this._load(); + } + } + /** + * add feature collection + * @param {object} featureCollection - as geojson object + */ + LayerBaseVectorGeoJson.prototype.addFeatures = function (featureCollection) { + if (this._transform.dataProjection == 'EPSG:3857' && this._transform.featureProjection == 'EPSG:3857') { + this._source.addFeatures(this._geoJsonFormat.readFeatures(featureCollection)); + } + else { + this._source.addFeatures(this._geoJsonFormat.readFeatures(featureCollection, this._transform)); + } + }; + /** + * trigger load features + * @protected + * @returns {boolean} if already loaded + */ + LayerBaseVectorGeoJson.prototype._load = function () { + var _this = this; + if (_super.prototype._load.call(this)) { + return true; + } + $.get(this._url, this._params, function (d) { + _this.addFeatures(d); + _this.loadCallback(_this); + }, 'json').fail(function () { + this._loaded = false; + }); + return false; + }; + /** + * callback function on map move + * @param {object} d the json response + * @override + */ + LayerBaseVectorGeoJson.prototype.mapMoveCallback = function (d) { + _super.prototype.mapMoveCallback.call(this, d); + this._source.addFeatures(this._geoJsonFormat.readFeatures(d, this._transform)); + }; + return LayerBaseVectorGeoJson; +}(LayerBaseVector_1.LayerBaseVector)); +nm.LayerBaseVectorGeoJson = LayerBaseVectorGeoJson; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = LayerBaseVectorGeoJson; +//# sourceMappingURL=LayerBaseVectorGeoJson.js.map \ No newline at end of file diff --git a/dist/layers/LayerBaseVectorGeoJson.js.map b/dist/layers/LayerBaseVectorGeoJson.js.map new file mode 100644 index 0000000000000000000000000000000000000000..cf60309025598d2dd2c82d9c75848738162f3094 --- /dev/null +++ b/dist/layers/LayerBaseVectorGeoJson.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LayerBaseVectorGeoJson.js","sourceRoot":"","sources":["../../src-ts/layers/LayerBaseVectorGeoJson.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;AAEH,gCAAsD,mBAAmB,CAAC,CAAA;AAC1E,wBAAoB,iBAAiB,CAAC,CAAA;AACtC,0BAAiB,WAAW,CAAC,CAAA;AAE7B,IAAI,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAC3B,IAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAY5B;;;GAGG;AACH;IAAqC,0CAAe;IAIhD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,gCAAY,GAAG,EAAE,OAAuC;QACpD,GAAG,GAAG,OAAO,GAAG,IAAI,QAAQ,GAAG,GAAG,GAAG,EAAE,CAAC;QACxC,kBAAM,GAAG,EAAE,OAAO,CAAC,CAAC;QAEpB,IA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CAAC;QACzB,CAAC,CACJ,CAAC;QAEF,MAAM,CAAC,KAAK,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,gDAAe,GAAf,UAAgB,CAAC;QACb,gBAAK,CAAC,eAAe,YAAC,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,UAAoB,CAAC,CAAC,CAAC;IAC7F,CAAC;IACL,6BAAC;AAAD,CAAC,AA1FD,CAAqC,iCAAe,GA0FnD;AAED,EAAE,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;AACnD;kBAAe,sBAAsB,CAAC"} \ No newline at end of file diff --git a/dist/layers/LayerEsriMapServer.d.ts b/dist/layers/LayerEsriMapServer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3bfec65c23776380d4b6133c3260d42679859c95 --- /dev/null +++ b/dist/layers/LayerEsriMapServer.d.ts @@ -0,0 +1,55 @@ +/** + * Created by gavorhes on 12/7/2015. + */ +import { LayerBase, LayerBaseOptions } from './LayerBase'; +import { ol } from 'custom-ol'; +export interface LayerEsriMapServerOptions extends LayerBaseOptions { + addPopup?: boolean; + showLayers?: Array<number>; + useEsriStyle?: boolean; +} +/** + * esri mapserver layer + * @augments LayerBase + */ +export declare class LayerEsriMapServer extends LayerBase { + _esriFormat: ol.format.EsriJSON; + _popupRequest: JQueryXHR; + /** + * The base layer for all others + * @param {string} url - resource url + * @param {object} [options] - config + * @param {string} [options.id] - layer id + * @param {string} [options.name=Unnamed Layer] - layer name + * @param {number} [options.opacity=1] - opacity + * @param {boolean} [options.visible=true] - default visible + * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28 + * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28 + * @param {object} [options.params={}] the get parameters to include to retrieve the layer + * @param {number} [options.zIndex=0] the z index for the layer + * @param {function} [options.loadCallback] function to call on load, context this is the layer object + * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed + * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility + * @param {boolean} [options.legendContent] additional content to add to the legend + * @param {boolean} [options.addPopup=false] if a popup should be added + * @param {undefined|Array<number>} [options.showLayers=undefined] if a popup should be added + */ + constructor(url: any, options?: LayerEsriMapServerOptions); + /** + * add additional content to the legend + * @param {string} [additionalContent=''] additional content for legend + */ + addLegendContent(additionalContent?: string): void; + getPopupInfo(queryParams: any): void; + /** + * + * @returns {ol.source.TileArcGISRest} the vector source + */ + source: ol.source.TileArcGISRest; + /** + * + * @returns the ol layer + */ + olLayer: ol.layer.Tile; +} +export default LayerEsriMapServer; diff --git a/lib-ts/src-ts/layers/LayerEsriMapServer.js b/dist/layers/LayerEsriMapServer.js similarity index 98% rename from lib-ts/src-ts/layers/LayerEsriMapServer.js rename to dist/layers/LayerEsriMapServer.js index 0b4537b0de704b15df18dd5d818530bbff82edd6..bc5fec586dd3c16684c2bfa317cf79f11c672bc4 100644 --- a/lib-ts/src-ts/layers/LayerEsriMapServer.js +++ b/dist/layers/LayerEsriMapServer.js @@ -23,7 +23,7 @@ var LayerEsriMapServer = (function (_super) { /** * The base layer for all others * @param {string} url - resource url - * @param {object} options - config + * @param {object} [options] - config * @param {string} [options.id] - layer id * @param {string} [options.name=Unnamed Layer] - layer name * @param {number} [options.opacity=1] - opacity @@ -138,7 +138,8 @@ var LayerEsriMapServer = (function (_super) { configurable: true }); return LayerEsriMapServer; -}(LayerBase_1.default)); +}(LayerBase_1.LayerBase)); +exports.LayerEsriMapServer = LayerEsriMapServer; nm.LayerEsriMapServer = LayerEsriMapServer; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = LayerEsriMapServer; diff --git a/dist/layers/LayerEsriMapServer.js.map b/dist/layers/LayerEsriMapServer.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f6a38a2f0fdcdbd3b0e30e01bf93a7b253f7d3b5 --- /dev/null +++ b/dist/layers/LayerEsriMapServer.js.map @@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L,CAAC;gBAED,SAAS,IAAI,UAAU,CAAC;gBAExB,kBAAQ,CAAC,yBAAyB,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;aAC1G;QACL,CAAC,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC;YACd,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC;QAC/B,CAAC,CAAC,CAAC;IACP,CAAC;IAMD,sBAAI,sCAAM;QAJV;;;WAGG;aACH;YACI,MAAM,CAAC,gBAAK,CAAC,SAAS,WAA8B,CAAC;QACzD,CAAC;;;OAAA;IAMD,sBAAI,uCAAO;QAJX;;;WAGG;aACH;YACI,MAAM,CAAC,gBAAK,CAAC,UAAU,WAAmB,CAAC;QAC/C,CAAC;;;OAAA;IACL,yBAAC;AAAD,CAAC,AA7ID,CAAwC,qBAAS,GA6IhD;AA7IY,0BAAkB,qBA6I9B,CAAA;AACD,EAAE,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AAC3C;kBAAe,kBAAkB,CAAC"} \ No newline at end of file diff --git a/dist/layers/LayerItsInventory.d.ts b/dist/layers/LayerItsInventory.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..571051f63d55ff03a1aac6a42278f5c20f4a1af1 --- /dev/null +++ b/dist/layers/LayerItsInventory.d.ts @@ -0,0 +1,67 @@ +/** + * Created by gavorhes on 12/8/2015. + */ +import LayerBaseVectorGeoJson from './LayerBaseVectorGeoJson'; +/** + * Its Layer class + * @augments LayerBaseVectorGeoJson + */ +declare class LayerItsInventory extends LayerBaseVectorGeoJson { + /** + * ITS device layer, types available at http://transportal.cee.wisc.edu/its/inventory/ + * @param {object} options - config + * @param {string} [options.id] - layer id + * @param {string} [options.name=Unnamed Layer] - layer name + * @param {number} [options.opacity=1] - opacity + * @param {boolean} [options.visible=true] - default visible + * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28 + * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28 + * @param {object} [options.params={}] the get parameters to include to retrieve the layer + * @param {number} [options.zIndex=0] the z index for the layer + * @param {function} [options.loadCallback] function to call on load, context this is the layer object + * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed + * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility + * @param {boolean} [options.legendContent] additional content to add to the legend + * + * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible + * @param {object|*} [options.style=undefined] the layer style, use openlayers default style if not defined + * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move + * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called + * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages + * + * @param {string} options.itsType the ITS device type, use the url flag at http://transportal.cee.wisc.edu/its/inventory/ + * @param {boolean} [options.addPopup=true] if the popup should be added automatically + * + * @param {string} [options.itsIcon=undefined] the ITS device type icon image see http://transportal.cee.wisc.edu/its/inventory/icons/ + * + * @param {object} [options.itsLineStyle=undefined] A single line style + * @param {string} options.itsLineStyle.color the line color as rgb or hex + * @param {number} [options.itsLineStyle.width=5] the line width + * + * @param {object} [options.itsIconConfig=undefined] The icon subtype configuration + * @param {string} options.itsIconConfig.prop The property used to define icon attribute symbolization + * @param {string} options.itsIconConfig.defaultName The default name to be used if no other match is found + * @param {string} options.itsIconConfig.defaultIcon The default icon to be used for no other matches + * @param {object} [options.itsIconConfig.iconArray=[]] an array, items with format [property, name, img] + * + * @param {object} [options.itsLineConfig=undefined] The property used to define icon attribute symbolization + * @param {string} options.itsLineConfig.prop The property used to define icon attribute symbolization + * @param {string} [options.itsLineConfig.defaultName=Other] The default name to be used if no other match is found + * @param {string} [options.itsLineConfig.defaultColor=red] The default line color to be used for no other matches + * @param {number} [options.itsLineConfig.defaultWidth] The default line width to be used for no other matches + * @param {object} [options.itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width = 5] + */ + constructor(options: any); + /** + * callback to generate the parameters passed in the get request + * @callback makeGetParams + * @param {object} extent - extent object + * @param {number} extent.minX - minX + * @param {number} extent.minY - minY + * @param {number} extent.maxX - maxX + * @param {number} extent.maxY - maxY + * @param {number} zoomLevel - zoom level + */ + mapMoveMakeGetParams(extent: any, zoomLevel: any): void; +} +export default LayerItsInventory; diff --git a/dist/layers/LayerItsInventory.js b/dist/layers/LayerItsInventory.js new file mode 100644 index 0000000000000000000000000000000000000000..c2748565325466b5f0dc762b22fc636fcc9d8ff0 --- /dev/null +++ b/dist/layers/LayerItsInventory.js @@ -0,0 +1,305 @@ +/** + * Created by gavorhes on 12/8/2015. + */ +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var LayerBaseVectorGeoJson_1 = require('./LayerBaseVectorGeoJson'); +var mapPopup_1 = require('../olHelpers/mapPopup'); +var provide_1 = require('../util/provide'); +var custom_ol_1 = require('custom-ol'); +var nm = provide_1.default('layers'); +var $ = require('jquery'); +function checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig) { + "use strict"; + //make sure one and only one configuration is defined; + var configCount = 0; + if (typeof itsIcon == 'string') { + configCount++; + } + if (typeof itsLineStyle == 'object') { + itsLineStyle.width = typeof itsLineStyle.width == 'number' ? itsLineStyle.width : 5; + itsLineStyle.color = typeof itsLineStyle.color == 'string' ? itsLineStyle.color : 'red'; + configCount++; + } + if (typeof itsIconConfig == 'object') { + itsIconConfig.defaultName = itsIconConfig.defaultName || 'Other'; + if (typeof itsIconConfig.iconArray == 'undefined') { + itsIconConfig.iconArray = []; + } + configCount++; + } + if (typeof itsLineConfig == 'object') { + itsLineConfig.defaultName = itsLineConfig.defaultName || 'Other'; + itsLineConfig.defaultWidth = itsLineConfig.defaultWidth || 5; + itsLineConfig.defaultColor = itsLineConfig.defaultColor || 'red'; + if (typeof itsLineConfig.lineArray == 'undefined') { + itsLineConfig.lineArray = []; + } + // set the width if not defined + for (var i = 0; i < itsLineConfig.lineArray.length; i++) { + if (itsLineConfig.lineArray[i].length == 3) { + itsLineConfig.lineArray[i].push(5); + } + } + configCount++; + } + if (configCount > 1) { + throw 'Only one style config can be defined'; + } +} +/** + * + * @param {string} [itsIcon=undefined] the ITS device type icon image see http://transportal.cee.wisc.edu/its/inventory/icons/ + * + * @param {object} [itsLineStyle=undefined] A single line style + * @param {string} itsLineStyle.color the line color as rgb or hex + * @param {number} [itsLineStyle.width=5] the line width + * + * @param {object} [itsIconConfig=undefined] The icon subtype configuration + * @param {string} itsIconConfig.prop The property used to define icon attribute symbolization + * @param {string} itsIconConfig.defaultName The default name to be used if no other match is found + * @param {string} itsIconConfig.defaultIcon The default icon to be used for no other matches + * @param {object} [itsIconConfig.iconArray=[]] an array, items with format [property, name, img] + * + * @param {object} [itsLineConfig=undefined] The property used to define icon attribute symbolization + * @param {string} itsLineConfig.prop The property used to define icon attribute symbolization + * @param {string} [itsLineConfig.defaultName=Other] The default name to be used if no other match is found + * @param {string} [itsLineConfig.defaultColor=red] The default line color to be used for no other matches + * @param {number} [itsLineConfig.defaultWidth=5] The default line width to be used for no other matches + * @param {object} [itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width] + * @returns {*} undefined, style, or style function + */ +function defineStyle(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig) { + "use strict"; + checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig); + var _iconUrlRoot = 'http://transportal.cee.wisc.edu/its/inventory/icons/'; + if (itsIcon) { + return new custom_ol_1.ol.style.Style({ + image: new custom_ol_1.ol.style.Icon({ + src: _iconUrlRoot + itsIcon, + crossOrigin: 'anonymous' + }) + }); + } + else if (itsLineStyle) { + return new custom_ol_1.ol.style.Style({ + stroke: new custom_ol_1.ol.style.Stroke({ + color: itsLineStyle.color, + width: itsLineStyle.width + }) + }); + } + else if (itsIconConfig) { + return function (feature, resolution) { + var symbolProp = feature.getProperties()[itsIconConfig.prop]; + var iconUrl = _iconUrlRoot + itsIconConfig.defaultIcon; + for (var i = 0; i < itsIconConfig.iconArray.length; i++) { + var thisProp = itsIconConfig.iconArray[i]; + if (symbolProp.trim().toLocaleLowerCase() == thisProp[0].trim().toLocaleLowerCase()) { + iconUrl = _iconUrlRoot + thisProp[2]; + break; + } + } + return [new custom_ol_1.ol.style.Style({ + image: new custom_ol_1.ol.style.Icon({ + src: iconUrl, + crossOrigin: 'anonymous' + }) + })]; + }; + } + else if (itsLineConfig) { + return function (feature) { + var symbolProp = feature.getProperties()[itsLineConfig.prop]; + var colr = itsLineConfig.defaultColor || 'red'; + var width = itsLineConfig.defaultWidth || 5; + for (var i = 0; i < itsLineConfig.lineArray.length; i++) { + var thisProp = itsLineConfig.lineArray[i]; + if (symbolProp.trim().toLocaleLowerCase() == thisProp[0].trim().toLocaleLowerCase()) { + colr = thisProp[2]; + width = thisProp[3]; + break; + } + } + return [new custom_ol_1.ol.style.Style({ + stroke: new custom_ol_1.ol.style.Stroke({ + color: colr, + width: width + }) + })]; + }; + } + else { + return undefined; + } +} +/** + * + * @param {string} [itsIcon=undefined] the ITS device type icon image see http://transportal.cee.wisc.edu/its/inventory/icons/ + * + * @param {object} [itsLineStyle=undefined] A single line style + * @param {string} itsLineStyle.color the line color as rgb or hex + * @param {number} [itsLineStyle.width=5] the line width + * + * @param {object} [itsIconConfig=undefined] The icon subtype configuration + * @param {string} itsIconConfig.prop The property used to define icon attribute symbolization + * @param {string} itsIconConfig.defaultName The default name to be used if no other match is found + * @param {string} itsIconConfig.defaultIcon The default icon to be used for no other matches + * @param {object} [itsIconConfig.iconArray=[]] an array, items with format [property, name, img] + * + * @param {object} [itsLineConfig=undefined] The property used to define icon attribute symbolization + * @param {string} itsLineConfig.prop The property used to define icon attribute symbolization + * @param {string} [itsLineConfig.defaultName=Other] The default name to be used if no other match is found + * @param {string} [itsLineConfig.defaultColor=red] The default line color to be used for no other matches + * @param {number} [itsLineConfig.defaultWidth=5] The default line width to be used for no other matches + * @param {object} [itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width] + * @returns {string} html to be added to the legend + */ +function defineLegend(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig) { + "use strict"; + var iconHeight = 17; + checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig); + var _iconUrlRoot = 'http://transportal.cee.wisc.edu/its/inventory/icons/'; + if (itsIcon) { + return "<img src=\"" + (_iconUrlRoot + itsIcon) + "\" class=\"legend-layer-icon\" height=\"" + iconHeight + "\">"; + } + else if (itsLineStyle) { + return "<hr style=\"height: " + itsLineStyle.width + "px; background-color: " + itsLineStyle.color + "\">"; + } + else if (itsIconConfig) { + var outHtml = ''; + outHtml += '<ul>'; + for (var _i = 0, _a = itsIconConfig.iconArray; _i < _a.length; _i++) { + var a = _a[_i]; + outHtml += "<li><span class=\"legend-layer-subitem\">" + a[1] + "</span><img src=\"" + (_iconUrlRoot + a[2]) + "\" class=\"legend-layer-icon\" height=\"" + iconHeight + "\">"; + } + outHtml += ("<li><span class=\"legend-layer-subitem\">" + itsIconConfig.defaultName + "</span>") + + ("<img src=\"" + (_iconUrlRoot + itsIconConfig.defaultIcon) + "\" class=\"legend-layer-icon\" height=\"" + iconHeight + "\"></li>"); + outHtml += '</ul>'; + return outHtml; + } + else if (itsLineConfig) { + var outHtml = ''; + outHtml += '<ul>'; + for (var _b = 0, _c = itsLineConfig.lineArray; _b < _c.length; _b++) { + var ls = _c[_b]; + outHtml += ("<li><span class=\"legend-layer-subitem\">" + ls[1] + "</span>") + + ("<hr style=\"height: " + ls[3] + "px; background-color: " + ls[2] + "\">"); + } + outHtml += ("<li><span class=\"legend-layer-subitem\">" + itsLineConfig.defaultName + "</span>") + + ("<hr style=\"height: " + itsLineConfig.defaultWidth + "px; background-color: " + itsLineConfig.defaultColor + "\"></li>"); + outHtml += '</ul>'; + return outHtml; + } + else { + return ''; + } +} +/** + * Its Layer class + * @augments LayerBaseVectorGeoJson + */ +var LayerItsInventory = (function (_super) { + __extends(LayerItsInventory, _super); + /** + * ITS device layer, types available at http://transportal.cee.wisc.edu/its/inventory/ + * @param {object} options - config + * @param {string} [options.id] - layer id + * @param {string} [options.name=Unnamed Layer] - layer name + * @param {number} [options.opacity=1] - opacity + * @param {boolean} [options.visible=true] - default visible + * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28 + * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28 + * @param {object} [options.params={}] the get parameters to include to retrieve the layer + * @param {number} [options.zIndex=0] the z index for the layer + * @param {function} [options.loadCallback] function to call on load, context this is the layer object + * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed + * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility + * @param {boolean} [options.legendContent] additional content to add to the legend + * + * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible + * @param {object|*} [options.style=undefined] the layer style, use openlayers default style if not defined + * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move + * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called + * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages + * + * @param {string} options.itsType the ITS device type, use the url flag at http://transportal.cee.wisc.edu/its/inventory/ + * @param {boolean} [options.addPopup=true] if the popup should be added automatically + * + * @param {string} [options.itsIcon=undefined] the ITS device type icon image see http://transportal.cee.wisc.edu/its/inventory/icons/ + * + * @param {object} [options.itsLineStyle=undefined] A single line style + * @param {string} options.itsLineStyle.color the line color as rgb or hex + * @param {number} [options.itsLineStyle.width=5] the line width + * + * @param {object} [options.itsIconConfig=undefined] The icon subtype configuration + * @param {string} options.itsIconConfig.prop The property used to define icon attribute symbolization + * @param {string} options.itsIconConfig.defaultName The default name to be used if no other match is found + * @param {string} options.itsIconConfig.defaultIcon The default icon to be used for no other matches + * @param {object} [options.itsIconConfig.iconArray=[]] an array, items with format [property, name, img] + * + * @param {object} [options.itsLineConfig=undefined] The property used to define icon attribute symbolization + * @param {string} options.itsLineConfig.prop The property used to define icon attribute symbolization + * @param {string} [options.itsLineConfig.defaultName=Other] The default name to be used if no other match is found + * @param {string} [options.itsLineConfig.defaultColor=red] The default line color to be used for no other matches + * @param {number} [options.itsLineConfig.defaultWidth] The default line width to be used for no other matches + * @param {object} [options.itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width = 5] + */ + function LayerItsInventory(options) { + if (typeof options.itsType !== 'string') { + throw 'its type must be defined'; + } + var addToLegend = ''; + // define a style with the helper function if it is not explicitly defined + if (typeof options.style == 'undefined') { + options.style = defineStyle(options.itsIcon, options.itsLineStyle, options.itsIconConfig, options.itsLineConfig); + addToLegend = defineLegend(options.itsIcon, options.itsLineStyle, options.itsIconConfig, options.itsLineConfig); + } + options.params = typeof options.params == 'object' ? options.params : {}; + $.extend(options.params, { format: 'JSON', resource: options.itsType }); + _super.call(this, 'http://transportal.cee.wisc.edu/its/inventory/', options); + //add any additional content to the legend + this.addLegendContent(addToLegend); + options.addPopup = typeof options.addPopup == 'boolean' ? options.addPopup : true; + if (options.addPopup) { + mapPopup_1.default.addVectorPopup(this, function (props) { + return ("<iframe src=\"http://transportal.cee.wisc.edu/its/inventory/?feature=" + props['featureGuid'] + "\" ") + + "height=\"250\" width=\"350\"></iframe>"; + }); + } + } + /** + * callback to generate the parameters passed in the get request + * @callback makeGetParams + * @param {object} extent - extent object + * @param {number} extent.minX - minX + * @param {number} extent.minY - minY + * @param {number} extent.maxX - maxX + * @param {number} extent.maxY - maxY + * @param {number} zoomLevel - zoom level + */ + LayerItsInventory.prototype.mapMoveMakeGetParams = function (extent, zoomLevel) { + _super.prototype.mapMoveMakeGetParams.call(this, extent, zoomLevel); + var lowerLeft = new custom_ol_1.ol.geom.Point([extent.minX, extent.minY]); + lowerLeft.transform(this.mapProj, this._projection4326); + var lowerLeftCoordinates = lowerLeft.getCoordinates(); + var upperRight = new custom_ol_1.ol.geom.Point([extent.maxX, extent.maxY]); + upperRight.transform(this.mapProj, this._projection4326); + var upperRightCoordinates = upperRight.getCoordinates(); + $.extend(this.mapMoveParams, { + L: lowerLeftCoordinates[0], + R: upperRightCoordinates[0], + B: lowerLeftCoordinates[1], + T: upperRightCoordinates[1] + }); + }; + return LayerItsInventory; +}(LayerBaseVectorGeoJson_1.default)); +nm.LayerItsInventory = LayerItsInventory; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = LayerItsInventory; +//# sourceMappingURL=LayerItsInventory.js.map \ No newline at end of file diff --git a/dist/layers/LayerItsInventory.js.map b/dist/layers/LayerItsInventory.js.map new file mode 100644 index 0000000000000000000000000000000000000000..546df1e9bfeb89ec40279097689cd5d4078948a3 --- /dev/null +++ b/dist/layers/LayerItsInventory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LayerItsInventory.js","sourceRoot":"","sources":["../../src-ts/layers/LayerItsInventory.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;AAEH,uCAAmC,0BAA0B,CAAC,CAAA;AAC9D,yBAAqB,uBAAuB,CAAC,CAAA;AAC7C,wBAAoB,iBAAiB,CAAC,CAAA;AACtC,0BAAiB,WAAW,CAAC,CAAA;AAC7B,IAAI,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAC3B,IAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAG5B,0BAA0B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa;IACzE,YAAY,CAAC;IAEb,sDAAsD;IACtD,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,EAAE,CAAC,CAAC,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC;QAC7B,WAAW,EAAE,CAAC;IAClB,CAAC;IAED,EAAE,CAAC,CAAC,OAAO,YAAY,IAAI,QAAQ,CAAC,CAAC,CAAC;QAClC,YAAY,CAAC,KAAK,GAAG,OAAO,YAAY,CAAC,KAAK,IAAI,QAAQ,GAAG,YAAY,CAAC,KAAK,GA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AAM,EAAE,SAAS;QAClC,gBAAK,CAAC,oBAAoB,YAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC9C,IAAI,SAAS,GAAG,IAAI,cAAE,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,cAAE,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,AA5GD,CAAgC,gCAAsB,GA4GrD;AAED,EAAE,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AACzC;kBAAe,iBAAiB,CAAC"} \ No newline at end of file diff --git a/dist/olHelpers/esriToOlStyle.d.ts b/dist/olHelpers/esriToOlStyle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5de40e17fcc0e4e3d954088ea1417bd1b213328e --- /dev/null +++ b/dist/olHelpers/esriToOlStyle.d.ts @@ -0,0 +1,47 @@ +import { ol } from 'custom-ol'; +export interface EsriResponse { + drawingInfo: { + renderer: EsriRenderer; + }; + geometryType: string; +} +export interface EsriRenderer { + type: string; + symbol: EsriSymbol; + uniqueValueInfos: Array<{ + label: string; + value: any; + symbol: EsriSymbol; + }>; +} +export interface EsriSymbol { + size: number; + type: string; + outline: { + color: string; + width: number; + }; + color: string; + width: number; +} +/** + * style and legend object + * @typedef {object} styleAndLegend + * @property {styleFunc} style - style function + * @property {string} legend - legend content + */ +/** + * + * @param {object} esriResponse - layer info + * @returns {styleAndLegend} style and legend object + */ +export declare function makeFeatureServiceLegendAndSymbol(esriResponse: EsriResponse): { + style: ol.style.Style | ol.style.Style[] | ol.style.StyleFunction; + legend: string; +}; +/** + * make map service legent + * @param {object} esriResponse - layer info + * @returns {string} legend content + */ +export declare function makeMapServiceLegend(esriResponse: any): string; diff --git a/dist/olHelpers/esriToOlStyle.js b/dist/olHelpers/esriToOlStyle.js new file mode 100644 index 0000000000000000000000000000000000000000..46ab613b5c213d43d0750f6c5d3167235bfca3d1 --- /dev/null +++ b/dist/olHelpers/esriToOlStyle.js @@ -0,0 +1,357 @@ +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +/** + * Created by gavorhes on 1/4/2016. + */ +var provide_1 = require('../util/provide'); +var custom_ol_1 = require('custom-ol'); +var nm = provide_1.default('olHelpers.esriToOlStyle'); +/** + * This callback is displayed as part of the Requester class. + * @callback styleFunc + * @param {ol.Feature} feat - openlayers feature + * @param {number} resolution - map resolution + */ +/** + * + * @param {Array<number>} colorArray - input color array + * @param {number} opacity - the opacity 0 to 1 + * @returns {string} rgba string + * @private + */ +function _colorArrayToRgba(colorArray, opacity) { + "use strict"; + return "rgba(" + colorArray[0] + "," + colorArray[1] + "," + colorArray[2] + "," + opacity + ")"; +} +/** + * escape html charcters + * @param {string} str - input string + * @returns {string} escaped string + */ +function htmlEscape(str) { + return String(str) + .replace(/&/g, '&') + .replace(/"/g, '"') + .replace(/'/g, ''') + .replace(/</g, '<') + .replace(/>/g, '>'); +} +nm.htmlEscape = htmlEscape; +var CommonSymbol = (function () { + /** + * + * @param symbolObj + * @param {number} opacity + */ + function CommonSymbol(symbolObj, opacity) { + this.symbolObj = symbolObj; + this.opacity = opacity; + this.olStyle = undefined; + this.legendHtml = ''; + } + return CommonSymbol; +}()); +var PointSymbol = (function (_super) { + __extends(PointSymbol, _super); + function PointSymbol(symbolObj, opacity) { + _super.call(this, symbolObj, opacity); + switch (this.symbolObj.type) { + case 'esriSMS': + var innerColor = _colorArrayToRgba(this.symbolObj.color, this.opacity); + var outerColor = _colorArrayToRgba(this.symbolObj.outline.color, this.opacity); + var outlineWidth = this.symbolObj.outline.width; + var radius = this.symbolObj.size; + this.olStyle = new custom_ol_1.ol.style.Style({ + image: new custom_ol_1.ol.style.Circle({ + radius: radius, + fill: new custom_ol_1.ol.style.Fill({ + color: innerColor + }), + stroke: new custom_ol_1.ol.style.Stroke({ color: outerColor, width: outlineWidth }) + }) + }); + this.legendHtml = "<span class=\"legend-layer-icon\" style=\"color: " + innerColor + "\">●</span>"; + break; + case 'esriPMS': + this.olStyle = new custom_ol_1.ol.style.Style({ + image: new custom_ol_1.ol.style.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; + default: + console.log(this.symbolObj); + alert('Point symbol does not handle symbol type: ' + this.symbolObj['type']); + } + } + return PointSymbol; +}(CommonSymbol)); +var LineSymbol = (function (_super) { + __extends(LineSymbol, _super); + function LineSymbol(symbolObj, opacity) { + _super.call(this, symbolObj, opacity); + switch (this.symbolObj.type) { + case 'esriSLS': + var innerColor = _colorArrayToRgba(this.symbolObj.color, this.opacity); + var lineWidth = this.symbolObj.width; + this.olStyle = new custom_ol_1.ol.style.Style({ + stroke: new custom_ol_1.ol.style.Stroke({ + color: innerColor, + //lineDash: [4], + width: lineWidth + }) + }); + this.legendHtml = "<span class=\"legend-layer-icon\" "; + this.legendHtml += "style=\""; + this.legendHtml += "background-color: " + innerColor + ";"; + this.legendHtml += "width: 40px;"; + this.legendHtml += "height: 4px;"; + this.legendHtml += "position: relative;"; + this.legendHtml += "display: inline-block;"; + this.legendHtml += "top: -1px;"; + this.legendHtml += "\"></span>"; + break; + default: + console.log(this.symbolObj); + alert('Line symbol does not handle symbol type: ' + this.symbolObj['type']); + } + } + return LineSymbol; +}(CommonSymbol)); +var PolygonSymbol = (function (_super) { + __extends(PolygonSymbol, _super); + function PolygonSymbol(symbolObj, opacity) { + _super.call(this, symbolObj, opacity); + switch (this.symbolObj['type']) { + case 'esriSFS': + 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 custom_ol_1.ol.style.Style({ + stroke: new custom_ol_1.ol.style.Stroke({ + color: outerColor, + //lineDash: [4], + width: outlineWidth + }), + fill: new custom_ol_1.ol.style.Fill({ + color: innerColor + }) + }); + this.legendHtml = "<span class=\"legend-layer-icon\" "; + this.legendHtml += "style=\""; + this.legendHtml += "background-color: " + innerColor + ";"; + this.legendHtml += "border: solid " + outerColor + " 1px;"; + this.legendHtml += "width: 40px;"; + this.legendHtml += "height: 9px;"; + this.legendHtml += "position: relative;"; + this.legendHtml += "display: inline-block;"; + this.legendHtml += "top: 2px;"; + this.legendHtml += "\"></span>"; + break; + default: + console.log(this.symbolObj); + alert('Polygon symbol does handle symbol type: ' + this.symbolObj['type']); + } + } + return PolygonSymbol; +}(CommonSymbol)); +var SymbolGenerator = (function () { + function SymbolGenerator(esriResponse) { + this.opacity = (100 - (esriResponse['drawingInfo']['transparency'] || 0)) / 100; + this.renderer = esriResponse.drawingInfo.renderer; + this.olStyle = undefined; + this.legendHtml = ''; + } + return SymbolGenerator; +}()); +var SingleSymbol = (function (_super) { + __extends(SingleSymbol, _super); + /** + * + * @param {object} esriResponse - layer info + * @param {Constructor|*} SymbolClass - the symbol class to use + */ + function SingleSymbol(esriResponse, SymbolClass) { + _super.call(this, esriResponse); + this.symbol = this.renderer.symbol; + var symbolObj = new SymbolClass(this.symbol, this.opacity); + this.olStyle = symbolObj.olStyle; + this.legendHtml = symbolObj.legendHtml; + } + return SingleSymbol; +}(SymbolGenerator)); +var UniqueValueSymbol = (function (_super) { + __extends(UniqueValueSymbol, _super); + /** + * + * @param {object} esriResponse - layer info + * @param {Constructor|*} SymbolClass - the Symbol class definition + */ + function UniqueValueSymbol(esriResponse, SymbolClass) { + var _this = this; + _super.call(this, esriResponse); + this.uniqueValueInfos = this.renderer['uniqueValueInfos']; + this.propertyName = this.renderer['field1']; + this.defaultSymbol = this.renderer['defaultSymbol']; + if (this.defaultSymbol) { + var symbolObj = new SymbolClass(this.defaultSymbol, this.opacity); + this.defaultStyle = symbolObj.olStyle; + this.defaultLabelHtml = ("<span class=\"legend-layer-subitem\">" + htmlEscape(this.renderer['defaultLabel']) + "</span>") + symbolObj.legendHtml; + } + else { + this.defaultStyle = undefined; + this.defaultLabelHtml = 'other'; + } + this.valueArray = []; + this.labelArray = []; + this.legendArray = []; + this.propertyStyleLookup = {}; + for (var _i = 0, _a = this.uniqueValueInfos; _i < _a.length; _i++) { + var uniqueVal = _a[_i]; + this.labelArray.push(uniqueVal['label']); + this.valueArray.push(uniqueVal['value']); + var uniqueSym = new SymbolClass(uniqueVal.symbol, this.opacity); + this.legendArray.push(("<span class=\"legend-layer-subitem\">" + htmlEscape(uniqueVal['label']) + "</span>") + uniqueSym.legendHtml); + this.propertyStyleLookup[uniqueVal['value']] = uniqueSym.olStyle; + } + this.olStyle = function (feature) { + var checkProperties = feature.getProperties(); + var checkProperty = checkProperties[_this.propertyName]; + var returnValue; + if (_this.propertyStyleLookup[checkProperty] !== undefined) { + returnValue = [_this.propertyStyleLookup[checkProperty]]; + } + else { + returnValue = [_this.defaultStyle]; + } + return returnValue; + }; + if (this.defaultLabelHtml !== null) { + this.legendArray.push(this.defaultLabelHtml); + } + this.legendHtml = '<ul>'; + for (var _b = 0, _c = this.legendArray; _b < _c.length; _b++) { + var h = _c[_b]; + this.legendHtml += "<li>" + h + "</li>"; + } + this.legendHtml += '</ul>'; + } + return UniqueValueSymbol; +}(SymbolGenerator)); +/** + * style and legend object + * @typedef {object} styleAndLegend + * @property {styleFunc} style - style function + * @property {string} legend - legend content + */ +/** + * + * @param {object} esriResponse - layer info + * @returns {styleAndLegend} style and legend object + */ +function makeFeatureServiceLegendAndSymbol(esriResponse) { + "use strict"; + var renderer = esriResponse.drawingInfo.renderer; + var symbolLegendOut = null; + switch (renderer.type) { + case 'simple': + switch (esriResponse.geometryType) { + case 'esriGeometryPoint': + symbolLegendOut = new SingleSymbol(esriResponse, PointSymbol); + break; + case 'esriGeometryPolyline': + symbolLegendOut = new SingleSymbol(esriResponse, LineSymbol); + break; + case 'esriGeometryPolygon': + symbolLegendOut = new SingleSymbol(esriResponse, PolygonSymbol); + break; + default: + console.log(esriResponse); + alert(esriResponse.geometryType + ' not handled'); + } + break; + case 'uniqueValue': + switch (esriResponse.geometryType) { + case 'esriGeometryPoint': + symbolLegendOut = new UniqueValueSymbol(esriResponse, PointSymbol); + break; + case 'esriGeometryPolyline': + symbolLegendOut = new UniqueValueSymbol(esriResponse, LineSymbol); + break; + case 'esriGeometryPolygon': + symbolLegendOut = new UniqueValueSymbol(esriResponse, PolygonSymbol); + break; + default: + console.log(esriResponse); + alert(esriResponse['geometryType'] + ' not handled'); + } + break; + default: + alert('not handled renderer type: ' + renderer['type']); + } + if (symbolLegendOut == null) { + return { style: undefined, legend: '' }; + } + else { + return { style: symbolLegendOut.olStyle, legend: symbolLegendOut.legendHtml }; + } +} +exports.makeFeatureServiceLegendAndSymbol = makeFeatureServiceLegendAndSymbol; +nm.makeFeatureServiceLegendAndSymbol = makeFeatureServiceLegendAndSymbol; +/** + * + * @param {object} lyrObject - the layer as defined in the response + * @param {boolean} [iconsOnly=false] use only icons + * @returns {string} legend html + */ +function mapServiceLegendItem(lyrObject, iconsOnly) { + if (iconsOnly === void 0) { iconsOnly = false; } + iconsOnly = typeof iconsOnly == 'boolean' ? iconsOnly : false; + var layerName = lyrObject['layerName']; + var legendItems = lyrObject['legend']; + var legendHtml = ''; + if (legendItems.length == 1) { + legendHtml = "<img class=\"legend-layer-icon\" height=\"17\" src=\"data:image/png;base64," + legendItems[0]['imageData'] + "\">"; + } + else { + legendHtml += '<span class="legend-items-expander" title="Expand/Collapse">▼</span><ul>'; + for (var i = 0; i < legendItems.length; i++) { + legendHtml += "<li>"; + legendHtml += "<span class=\"legend-layer-subitem\">" + htmlEscape(legendItems[i]['label']) + "</span>"; + legendHtml += "<img class=\"legend-layer-icon\" height=\"17\" src=\"data:image/png;base64," + legendItems[i]['imageData'] + "\">"; + legendHtml += "</li>"; + } + legendHtml += '</ul>'; + } + if (!iconsOnly) { + legendHtml = ("<span class=\"legend-layer-subitem\">" + layerName + "</span>") + legendHtml; + } + return legendHtml; +} +/** + * make map service legent + * @param {object} esriResponse - layer info + * @returns {string} legend content + */ +function makeMapServiceLegend(esriResponse) { + "use strict"; + var newLegendHtml = ''; + var layers = esriResponse['layers']; + if (layers.length == 1) { + newLegendHtml += mapServiceLegendItem(layers[0], true); + } + else { + newLegendHtml += '<ul>'; + for (var i = 0; i < layers.length; i++) { + newLegendHtml += '<li>' + mapServiceLegendItem(layers[i]) + '</li>'; + } + newLegendHtml += '</ul>'; + } + return newLegendHtml; +} +exports.makeMapServiceLegend = makeMapServiceLegend; +nm.makeMapServiceLegend = makeMapServiceLegend; +//# sourceMappingURL=esriToOlStyle.js.map \ No newline at end of file diff --git a/dist/olHelpers/esriToOlStyle.js.map b/dist/olHelpers/esriToOlStyle.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0e4207cadbeac3afaec714a0ca0d9e13278cc576 --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AE,EAAE,CAAC;YACrC,aAAa,IAAI,MAAM,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;QACxE,CAAC;QACD,aAAa,IAAI,OAAO,CAAC;IAC7B,CAAC;IAED,MAAM,CAAC,aAAa,CAAC;AACzB,CAAC;AAlBe,4BAAoB,uBAkBnC,CAAA;AAED,EAAE,CAAC,oBAAoB,GAAG,oBAAoB,CAAC"} \ No newline at end of file diff --git a/dist/olHelpers/extentUtil.d.ts b/dist/olHelpers/extentUtil.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..34f326beacdc972ab167717fab16e35c2c570ece --- /dev/null +++ b/dist/olHelpers/extentUtil.d.ts @@ -0,0 +1,14 @@ +import { ol } from 'custom-ol'; +/** + * + * @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: any): ol.Extent | Array<number>; +/** + * given one or an array of layers, fit to the map + * @param {Array<LayerBaseVector>|Array<ol.layer.Vector>|LayerBaseVector|ol.layer.Vector} layers - array of layers or single + * @param {ol.Map} mp - the map to fit + * @param {number|undefined} [zoomOut=undefined] - levels to zoom out after fit + */ +export declare function fitToMap(layers: any, mp: ol.Map, zoomOut?: number): void; diff --git a/dist/olHelpers/extentUtil.js b/dist/olHelpers/extentUtil.js new file mode 100644 index 0000000000000000000000000000000000000000..319d756dbf6d16acdbb624aee4e089ee827b73ab --- /dev/null +++ b/dist/olHelpers/extentUtil.js @@ -0,0 +1,70 @@ +"use strict"; +/** + * Created by gavorhes on 7/18/2016. + */ +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"; + if (layers.constructor.name != 'Array') { + layers = [layers]; + } + var hasExtent = false; + var minX = 10E100; + var minY = 10E100; + var maxX = -10E100; + var maxY = -10E100; + for (var _i = 0, layers_1 = layers; _i < layers_1.length; _i++) { + var lyr = layers_1[_i]; + /** + * + * @type {ol.layer.Vector} + */ + var olLayer = lyr['olLayer'] || lyr; + if (olLayer.getSource().getFeatures().length > 0) { + hasExtent = true; + var ext = olLayer.getSource().getExtent(); + minX = ext[0] < minX ? ext[0] : minX; + minY = ext[1] < minY ? ext[1] : minY; + maxX = ext[2] > maxX ? ext[2] : maxX; + maxY = ext[3] > maxY ? ext[3] : maxY; + } + } + if (hasExtent) { + return [minX, minY, maxX, maxY]; + } + else { + return undefined; + } +} +exports.calculateExtent = calculateExtent; +nm.calculateExtent = calculateExtent; +/** + * given one or an array of layers, fit to the map + * @param {Array<LayerBaseVector>|Array<ol.layer.Vector>|LayerBaseVector|ol.layer.Vector} layers - array of layers or single + * @param {ol.Map} mp - the map to fit + * @param {number|undefined} [zoomOut=undefined] - levels to zoom out after fit + */ +function fitToMap(layers, mp, zoomOut) { + "use strict"; + /** + * + * @type {ol.Extent|undefined} + */ + var ext = calculateExtent(layers); + if (typeof ext == 'undefined') { + return; + } + mp.getView().fit(ext, mp.getSize()); + if (typeof zoomOut == 'number') { + mp.getView().setZoom(mp.getView().getZoom() - zoomOut); + } +} +exports.fitToMap = fitToMap; +nm.calculateExtent = calculateExtent; +//# sourceMappingURL=extentUtil.js.map \ No newline at end of file diff --git a/dist/olHelpers/extentUtil.js.map b/dist/olHelpers/extentUtil.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7cd0531833c3c12710ada4996e81bbc519ffee02 --- /dev/null +++ b/dist/olHelpers/extentUtil.js.map @@ -0,0 +1 @@ +{"version":3,"file":"extentUtil.js","sourceRoot":"","sources":["../../src-ts/olHelpers/extentUtil.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,wBAAoB,iBAAiB,CAAC,CAAA;AAItC,IAAM,EAAE,GAAG,iBAAO,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ED,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;QACZ,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;IAAC,IAAI,CAAC,CAAC;QACJ,MAAM,CAAC,SAAS,CAAC;IACrB,CAAC;AACL,CAAC;AAtCe,uBAAe,kBAsC9B,CAAA;AAED,EAAE,CAAC,eAAe,GAAG,eAAe,CAAC;AAGrC;;;;;GAKG;AACH,kBAAyB,MAAM,EAAE,EAAU,EAAE,OAAgB;IACzD,YAAY,CAAC;IAEb;;;OAGG;IACH,IAAI,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAElC,EAAE,CAAC,CAAC,OAAO,GAAG,IAAI,WAAW,CAAC,CAAA,CAAC;QAC3B,MAAM,CAAC;IACX,CAAC;IAED,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IAEpC,EAAE,CAAC,CAAC,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAA,CAAC;QAC5B,EAAE,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC;IAC3D,CAAC;AAEL,CAAC;AAnBe,gBAAQ,WAmBvB,CAAA;AAED,EAAE,CAAC,eAAe,GAAG,eAAe,CAAC"} \ No newline at end of file diff --git a/dist/olHelpers/layerSwipe.d.ts b/dist/olHelpers/layerSwipe.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..793b815eeca06a995b18eba620172907039cee32 --- /dev/null +++ b/dist/olHelpers/layerSwipe.d.ts @@ -0,0 +1,30 @@ +import { LayerBase } from "../layers/LayerBase"; +import { ol } from 'custom-ol'; +declare class LayerSwipe { + leftLayers: Array<LayerBase>; + rightLayers: Array<LayerBase>; + _percentRight: number; + _map: ol.Map; + $mapElement: JQuery; + $swiper: JQuery; + dragging: boolean; + offset: number; + /** + * + * @param {ol.Map} map - the map + * @param {string} [sliderContent=''] - additional html to be added inside the slider div + */ + constructor(map: ol.Map, sliderContent?: string); + /** + * + * @param {LayerBase|*} lyr - layer to be added to left side + */ + addLeftLayer(lyr: any): void; + /** + * + * @param {LayerBase|*} lyr - layer to be added to right side + */ + addRightLayer(lyr: any): void; + percentRight: number; +} +export default LayerSwipe; diff --git a/dist/olHelpers/layerSwipe.js b/dist/olHelpers/layerSwipe.js new file mode 100644 index 0000000000000000000000000000000000000000..5dcee48351a8aea27ae78cfc3adf366c6eb5efaa --- /dev/null +++ b/dist/olHelpers/layerSwipe.js @@ -0,0 +1,127 @@ +/** + * Created by gavorhes on 6/1/2016. + */ +"use strict"; +var provide_1 = require('../util/provide'); +var $ = require('jquery'); +var nm = provide_1.default('collections.layerSwipe'); +var LayerSwipe = (function () { + /** + * + * @param {ol.Map} map - the map + * @param {string} [sliderContent=''] - additional html to be added inside the slider div + */ + function LayerSwipe(map, sliderContent) { + var _this = this; + if (sliderContent === void 0) { sliderContent = ''; } + sliderContent = sliderContent || ''; + /** + * + * @type {Array<LayerBase>} + */ + this.leftLayers = []; + /** + * + * @type {Array<LayerBase>} + */ + this.rightLayers = []; + this._percentRight = 50; + this.offset = null; + this._map = map; + this.$mapElement = $(map.getTargetElement()); + this.$mapElement.append("<div class=\"layer-swiper\">" + sliderContent + "</div>"); + this.$swiper = this.$mapElement.find('.layer-swiper'); + this.percentRight = this.percentRight; + this.dragging = false; + this.$mapElement.mouseleave(function () { + _this.dragging = false; + }); + this.$swiper.bind('mousewheel DOMMouseScroll', function (evt) { + evt.preventDefault(); + }); + this.$swiper.mousedown(function (evt) { + _this.dragging = true; + _this.offset = evt.offsetX; + }); + $(window).mouseup(function () { + _this.dragging = false; + }); + this.$mapElement.mousemove(function (evt) { + if (_this.dragging) { + var mapLeft = _this.$mapElement.position().left; + var mapWidth = _this.$mapElement.width(); + _this.percentRight = 100 * (evt.pageX - _this.offset - mapLeft) / mapWidth; + } + }); + } + /** + * + * @param {LayerBase|*} lyr - layer to be added to left side + */ + LayerSwipe.prototype.addLeftLayer = function (lyr) { + var _this = this; + if (this.leftLayers.indexOf(lyr) != -1) { + return; + } + lyr.olLayer.on('precompose', function (event) { + var ctx = event['context']; + var width = ctx.canvas.width * (_this.percentRight / 100); + ctx.save(); + ctx.beginPath(); + ctx.rect(0, 0, width, ctx.canvas.height); + ctx.clip(); + }); + lyr.olLayer.on('postcompose', function (event) { + var ctx = event['context']; + ctx.restore(); + }); + this.leftLayers.push(lyr); + }; + /** + * + * @param {LayerBase|*} lyr - layer to be added to right side + */ + LayerSwipe.prototype.addRightLayer = function (lyr) { + var _this = this; + if (this.rightLayers.indexOf(lyr) != -1) { + return; + } + lyr.olLayer.on('precompose', function (event) { + var ctx = event['context']; + var width = ctx.canvas.width * (_this.percentRight / 100); + ctx.save(); + ctx.beginPath(); + ctx.rect(width, 0, ctx.canvas.width - width, ctx.canvas.height); + ctx.clip(); + }); + lyr.olLayer.on('postcompose', function (event) { + var ctx = event['context']; + ctx.restore(); + }); + this.rightLayers.push(lyr); + }; + Object.defineProperty(LayerSwipe.prototype, "percentRight", { + get: function () { + return this._percentRight; + }, + set: function (percent) { + var maxed = this.$swiper.position().left + this.$swiper.width() > this.$mapElement.width(); + if (percent < 0) { + return; + } + else if (maxed && percent > this.percentRight) { + return; + } + this._percentRight = percent; + this.$swiper.css('left', this._percentRight.toFixed(2) + "%"); + this._map.render(); + }, + enumerable: true, + configurable: true + }); + return LayerSwipe; +}()); +nm.LayerSwipe = LayerSwipe; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = LayerSwipe; +//# sourceMappingURL=layerSwipe.js.map \ No newline at end of file diff --git a/dist/olHelpers/layerSwipe.js.map b/dist/olHelpers/layerSwipe.js.map new file mode 100644 index 0000000000000000000000000000000000000000..62de2c56677f939244141d27ec92b1b37f324d00 --- /dev/null +++ b/dist/olHelpers/layerSwipe.js.map @@ -0,0 +1 @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C3B,GAAG,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,sBAAI,oCAAY;aAAhB;YACI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;QAC9B,CAAC;aAED,UAAiB,OAAe;YAC5B,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;YAE3F,EAAE,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;gBACd,MAAM,CAAC;YACX,CAAC;YAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;gBAC9C,MAAM,CAAC;YACX,CAAC;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"} \ No newline at end of file diff --git a/dist/olHelpers/mapInteractionBase.d.ts b/dist/olHelpers/mapInteractionBase.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2d7cd402198dd8e9381c52bf013ea2c07077b9ff --- /dev/null +++ b/dist/olHelpers/mapInteractionBase.d.ts @@ -0,0 +1,40 @@ +import { ol } from 'custom-ol'; +/** + * base interaction + */ +export declare class MapInteractionBase { + _map: ol.Map; + _initialized: boolean; + _subtype: string; + /** + * map interaction base + * @param subtype - the interaction subtype + */ + constructor(subtype: string); + /** + * base initializer, returns true for already initialized + * @param theMap - the ol Map + * @returns true for already initialized + */ + init(theMap: ol.Map): void; + /** + * get reference to the ol map object + * @returns {ol.Map} the map object + */ + map: ol.Map; + /** + * get if is initialized + * @returns {boolean} is initialized + */ + initialized: boolean; + /** + * Check the initialization status and throw exception if not valid yet + * @protected + */ + _checkInit(): void; + /** + * Check the initialization status and throw exception if not valid yet + */ + checkInit(): void; +} +export default MapInteractionBase; diff --git a/dist/olHelpers/mapInteractionBase.js b/dist/olHelpers/mapInteractionBase.js new file mode 100644 index 0000000000000000000000000000000000000000..b8bc2b5f2066f9e732dc654532936a63451490a2 --- /dev/null +++ b/dist/olHelpers/mapInteractionBase.js @@ -0,0 +1,77 @@ +"use strict"; +/** + * Created by gavorhes on 12/8/2015. + */ +var provide_1 = require('../util/provide'); +var nm = provide_1.default('olHelpers'); +/** + * base interaction + */ +var MapInteractionBase = (function () { + /** + * map interaction base + * @param subtype - the interaction subtype + */ + function MapInteractionBase(subtype) { + this._map = null; + this._initialized = false; + this._subtype = subtype; + } + /** + * base initializer, returns true for already initialized + * @param theMap - the ol Map + * @returns true for already initialized + */ + MapInteractionBase.prototype.init = function (theMap) { + if (!this._initialized) { + this._map = theMap; + this._initialized = true; + } + }; + Object.defineProperty(MapInteractionBase.prototype, "map", { + /** + * get reference to the ol map object + * @returns {ol.Map} the map object + */ + get: function () { + return this._map; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(MapInteractionBase.prototype, "initialized", { + /** + * get if is initialized + * @returns {boolean} is initialized + */ + get: function () { + return this._initialized; + }, + enumerable: true, + configurable: true + }); + /** + * Check the initialization status and throw exception if not valid yet + * @protected + */ + MapInteractionBase.prototype._checkInit = function () { + if (!this.initialized) { + var msg = this._subtype + " object not initialized"; + alert(msg); + console.log(msg); + throw msg; + } + }; + /** + * Check the initialization status and throw exception if not valid yet + */ + MapInteractionBase.prototype.checkInit = function () { + this._checkInit(); + }; + return MapInteractionBase; +}()); +exports.MapInteractionBase = MapInteractionBase; +nm.MapInteractionBase = MapInteractionBase; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = MapInteractionBase; +//# sourceMappingURL=mapInteractionBase.js.map \ No newline at end of file diff --git a/dist/olHelpers/mapInteractionBase.js.map b/dist/olHelpers/mapInteractionBase.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6d1cb768b202e29efc1293e27d15c9713de5a0a1 --- /dev/null +++ b/dist/olHelpers/mapInteractionBase.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mapInteractionBase.js","sourceRoot":"","sources":["../../src-ts/olHelpers/mapInteractionBase.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,wBAAoB,iBAAiB,CAAC,CAAA;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,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA,CAAC;YACpB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;YACnB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC7B,CAAC;IACL,CAAC;IAMD,sBAAI,mCAAG;QAJP;;;WAGG;aACH;YACI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;QACrB,CAAC;;;OAAA;IAMD,sBAAI,2CAAW;QAJf;;;WAGG;aACH;YACI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;QAC7B,CAAC;;;OAAA;IAED;;;OAGG;IACH,uCAAU,GAAV;QACI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;YACpB,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;QACd,CAAC;IACL,CAAC;IAED;;OAEG;IACH,sCAAS,GAAT;QACI,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IACL,yBAAC;AAAD,CAAC,AA9DD,IA8DC;AA9DY,0BAAkB,qBA8D9B,CAAA;AAED,EAAE,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AAC3C;kBAAe,kBAAkB,CAAC"} \ No newline at end of file diff --git a/lib-ts/src-ts/olHelpers/mapMove.d.ts b/dist/olHelpers/mapMove.d.ts similarity index 100% rename from lib-ts/src-ts/olHelpers/mapMove.d.ts rename to dist/olHelpers/mapMove.d.ts diff --git a/lib-ts/src-ts/olHelpers/mapMove.js b/dist/olHelpers/mapMove.js similarity index 100% rename from lib-ts/src-ts/olHelpers/mapMove.js rename to dist/olHelpers/mapMove.js diff --git a/dist/olHelpers/mapMove.js.map b/dist/olHelpers/mapMove.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a6d883949e5f5db39f9a2442ee9b05c711a14f94 --- /dev/null +++ b/dist/olHelpers/mapMove.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mapMove.js","sourceRoot":"","sources":["../../src-ts/olHelpers/mapMove.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,2BAAuB,cAAc,CAAC,CAAA;AAMtC;kBAAe,IAAI,oBAAU,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/olHelpers/mapMoveCls.d.ts b/dist/olHelpers/mapMoveCls.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d60a791ff0177128b7ded770929c52c2a8462d2 --- /dev/null +++ b/dist/olHelpers/mapMoveCls.d.ts @@ -0,0 +1,75 @@ +import LayerBaseVector from "../layers/LayerBaseVector"; +import MapInteractionBase from './mapInteractionBase'; +import { ol } from 'custom-ol'; +import { extentObject } from '../_internalnterfaces'; +import Timer = NodeJS.Timer; +export interface mapMoveCallbackFunction { + /** + * + * @param extent extent as predefined object minX, minX, maxX, maxY + * @param zoomLevel current zoom level + * @param evtType the event type 'change:center', 'change:resolution' + */ + (extent: extentObject, zoomLevel: number, evtType?: string): any; +} +/** + * assists with map move interactions, trigger callback functions + * @augments MapInteractionBase + */ +export declare class MapMoveCls extends MapInteractionBase { + _mapExtent: extentObject; + _zoomLevel: number; + _lookupLayer: Object; + _arrLayer: Array<LayerBaseVector>; + _arrLyrTimeout: Array<Timer>; + _mapMoveCallbackTimeout: Array<Timer>; + _mapMoveCallbackDelays: Array<number>; + _mapMoveCallbacksLookup: Object; + _mapMoveCallbackContext: Array<Object>; + _mapMoveCallbacks: Array<mapMoveCallbackFunction>; + _arrLyrRequest: Array<any>; + /** + * constructor called implicitly + */ + constructor(); + /** + * initialize the map move object + * @param theMap - the ol map + */ + init(theMap: ol.Map): void; + _updateMapExtent(): void; + /** + * return the map extent + */ + mapExtent: extentObject; + /** + * Trigger the layer load + * @param lyr the layer being acted on + * @param index index of the layer + * @param eventType the event triggering the load, as 'change:center' or 'change:resolution' + */ + triggerLyrLoad(lyr: LayerBaseVector, index?: number, eventType?: string): void; + /** + * trigger the map move call back at the given index + * @param ind - the index of the layer + * @param eventType=undefined the event triggering the load as 'change:center' or 'change:resolution' + * @param functionId=undefined the function id used to reference the added callback function + */ + triggerMoveCallback(ind: number, eventType?: string, functionId?: string): void; + /** + * Add a layer to the interaction + * @param lyr - layer to add + * @param triggerOnAdd - if the layer should be loaded on add + */ + addVectorLayer(lyr: LayerBaseVector, triggerOnAdd?: boolean): void; + /** + * add a callback to the map move event + * @param func - callback function + * @param context - the context to use for this function + * @param delay=50 the delay before call load + * @param triggerOnAdd if the layer should be loaded on add to mapMove + * @param functionId optional id to reference the function later for outside triggering + */ + addCallback(func: mapMoveCallbackFunction, context: any, delay?: number, triggerOnAdd?: boolean, functionId?: string): void; +} +export default MapMoveCls; diff --git a/lib-ts/src-ts/olHelpers/mapMoveCls.js b/dist/olHelpers/mapMoveCls.js similarity index 98% rename from lib-ts/src-ts/olHelpers/mapMoveCls.js rename to dist/olHelpers/mapMoveCls.js index 253ea315add7c2cd98e67f03d8912e7f1ffe6b13..4b450595fe0658cc0b381eae252a811306738f7d 100644 --- a/lib-ts/src-ts/olHelpers/mapMoveCls.js +++ b/dist/olHelpers/mapMoveCls.js @@ -39,10 +39,7 @@ var MapMoveCls = (function (_super) { */ MapMoveCls.prototype.init = function (theMap) { var _this = this; - var isInitialized = _super.prototype.init.call(this, theMap); - if (_super.prototype.init.call(this, theMap)) { - return isInitialized; - } + _super.prototype.init.call(this, theMap); this.map.getView().on(['change:center', 'change:resolution'], function (e) { _this._updateMapExtent(); // trigger the layer updates diff --git a/dist/olHelpers/mapMoveCls.js.map b/dist/olHelpers/mapMoveCls.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7a36fb08f05103d8fe5c0b8c11549ffecd2b8376 --- /dev/null +++ b/dist/olHelpers/mapMoveCls.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mapMoveCls.js","sourceRoot":"","sources":["../../src-ts/olHelpers/mapMoveCls.ts"],"names":[],"mappings":";;;;;;AAEA,mCAA+B,sBAAsB,CAAC,CAAA;AACtD,IAAY,YAAY,WAAM,sBAAsB,CAAC,CAAA;AACrD,wBAAoB,iBAAiB,CAAC,CAAA;AACtC,yBAAqB,kBAAkB,CAAC,CAAA;AAIxC,IAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,IAAM,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAchC;;;GAGG;AACH;IAAgC,8BAAkB;IAa9C;;OAEG;IACH;QACI,kBAAM,UAAU,CAAC,CAAC;QAClB,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,E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AAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;QACtD,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,KAAK,IAAI,QAAQ,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC;QACxE,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;QAC5F,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAExC,YAAY,GAAG,OAAO,YAAY,IAAI,SAAS,GAAG,YAAY,GAAG,IAAI,CAAC;QAEtE,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;YACf,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC;gBAChC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC5B,CAAC;YACD,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAChE,CAAC;IACL,CAAC;IACL,iBAAC;AAAD,CAAC,AAlQD,CAAgC,4BAAkB,GAkQjD;AAlQY,kBAAU,aAkQtB,CAAA;AAED,EAAE,CAAC,UAAU,GAAG,UAAU,CAAC;AAC3B;kBAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/lib-ts/src-ts/olHelpers/mapPopup.d.ts b/dist/olHelpers/mapPopup.d.ts similarity index 100% rename from lib-ts/src-ts/olHelpers/mapPopup.d.ts rename to dist/olHelpers/mapPopup.d.ts diff --git a/lib-ts/src-ts/olHelpers/mapPopup.js b/dist/olHelpers/mapPopup.js similarity index 100% rename from lib-ts/src-ts/olHelpers/mapPopup.js rename to dist/olHelpers/mapPopup.js diff --git a/dist/olHelpers/mapPopup.js.map b/dist/olHelpers/mapPopup.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e4f9ae6c8c2c6b6c31c1b7a4fe5d1a7f493f150b --- /dev/null +++ b/dist/olHelpers/mapPopup.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mapPopup.js","sourceRoot":"","sources":["../../src-ts/olHelpers/mapPopup.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,4BAAwB,eAAe,CAAC,CAAA;AAMxC;kBAAe,IAAI,qBAAW,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/olHelpers/mapPopupCls.d.ts b/dist/olHelpers/mapPopupCls.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ec773bfc1701827e02bd41ae79ff537081aafac6 --- /dev/null +++ b/dist/olHelpers/mapPopupCls.d.ts @@ -0,0 +1,150 @@ +/// <reference path="../../definitions/jquery.d.ts" /> +/** + * Created by gavorhes on 11/3/2015. + */ +import MapInteractionBase from './mapInteractionBase'; +import { ol } from 'custom-ol'; +import { LayerBaseVector } from "../layers/LayerBaseVector"; +import LayerEsriMapServer from "../layers/LayerEsriMapServer"; +export interface popupChangedFunction { + ($popContent: JQuery): any; +} +/** + * + */ +export interface popupCallback { + /** + * Callback function for the popup + * @param featureProperties + * @param jqRef + */ + (featureProperties: Object, jqRef: JQuery): string | boolean; +} +export declare class FeatureLayerProperties { + feature: ol.Feature; + layer: LayerEsriMapServer; + layerIndex: number; + selectionLayer: ol.layer.Vector; + popupContent: string; + esriLayerName: string; + /** + * + * @param feature the feature + * @param layer - the layer in the popup + * @param layerIndex - index of the layer + * @param selectionLayer - the ol selection layer + * @param [esriLayerName=undefined] - esri layer name + */ + constructor(feature: ol.Feature, layer: LayerEsriMapServer, layerIndex: number, selectionLayer: ol.layer.Vector, esriLayerName?: string); + layerName: string; +} +/** + * map popup class + * @augments MapInteractionBase + */ +declare class MapPopupCls extends MapInteractionBase { + _popupOpen: boolean; + _passThroughLayerFeatureArray: Array<FeatureLayerProperties>; + _currentPopupIndex: number; + _popupContentLength: number; + _esriMapServiceLayers: Array<LayerEsriMapServer>; + _$popupCloser: JQuery; + _$popupContent: JQuery; + _$popupContainer: JQuery; + _popupOverlay: ol.Overlay; + _arrPopupLayers: Array<LayerBaseVector>; + _popupCoordinate: ol.Coordinate; + _popupChangedFunctions: Array<popupChangedFunction>; + _mapClickFunctions: Array<Function>; + _selectionLayerLookup: Object; + _arrPopupLayerIds: Array<string>; + _arrPopupLayerNames: Array<string>; + _arrPopupOlLayers: Array<ol.layer.Vector>; + _arrPopupContentFunction: Array<popupCallback>; + _selectionLayers: Array<ol.layer.Vector>; + /** + * Definition for openlayers style function + * @callback olStyleFunction + * ¶m feature the openlayers vector feature + * $param + */ + /** + * map popup constructor + */ + constructor(); + /** + * map popup initialization + * @param {ol.Map} theMap - the ol map + */ + init(theMap: ol.Map): boolean; + /** + * helper to select features + * @private + */ + _triggerFeatSelect(): void; + /** + * + * @param feature - the ol feature + * @param {LayerEsriMapServer} lyr - the map server layer + * @param {string} popupContent - popup content + * @param {string} esriName - esri layer name + */ + addMapServicePopupContent(feature: ol.Feature, lyr: LayerEsriMapServer, popupContent: string, esriName: string): void; + /** + * + * @param pixel - the ol pixel + * @returns feature layer properties + * @private + */ + _featuresAtPixel(pixel: ol.Pixel): Array<FeatureLayerProperties>; + closePopup(): boolean; + /** + * + * @param chgFunction - popup change function + */ + addPopupChangedFunction(chgFunction: popupChangedFunction): void; + /** + * + * @param {LayerBase|*} lyr - the layer being acted on + * @param {object} [selectionStyle={}] the selection style configuration + * @param {string} [selectionStyle.color=rgba(255,170,0,0.5)] the selection color + * @param {number} [selectionStyle.width=10] the selection width for linear features + * @param {object|function} [selectionStyle.olStyle=undefined] an openlayers style object or function + * @returns the new selection layer + * @private + */ + _addPopupLayer(lyr: any, selectionStyle: any): ol.layer.Vector; + /** + * Add popup to the map + * @param {LayerBase|*} lyr The layer that the popup with act on + * @param {popupCallback} popupContentFunction - popup content function that makes popup info + * @param {object} [selectionStyle={}] the selection style configuration + * @param {string} [selectionStyle.color=rgba(255,170,0,0.5)] the selection color + * @param {number} [selectionStyle.width=10] the selection width for linear features + * @param {object|function} [selectionStyle.olStyle=undefined] an openlayers style object or function + * @returns {object} a reference to the ol selection layer + */ + addVectorPopup(lyr: LayerBaseVector, popupContentFunction: popupCallback, selectionStyle?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction): ol.layer.Vector; + /** + * + * @param {LayerBase} lyr - layer + */ + removeVectorPopup(lyr: any): void; + /** + * + * @param {LayerEsriMapServer} lyr - map server layer + * @param {object} [selectionStyle={}] the selection style configuration + * @param {string} [selectionStyle.color=rgba(255,170,0,0.5)] the selection color + * @param {number} [selectionStyle.width=10] the selection width for linear features + * @param {object|function} [selectionStyle.olStyle=undefined] an openlayers style object or function + * @returns {object} a reference to the ol selection layer + */ + addMapServicePopup(lyr: any, selectionStyle?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction): ol.layer.Vector; + clearSelection(): void; + /** + * Add a function to be called when the map is clicked but before any popups are implemented + * @param {function} func - the map click function + */ + addMapClickFunction(func: Function): void; +} +export default MapPopupCls; diff --git a/dist/olHelpers/mapPopupCls.js b/dist/olHelpers/mapPopupCls.js new file mode 100644 index 0000000000000000000000000000000000000000..24417a3cc338ece201856fe7a25d0a49111c6937 --- /dev/null +++ b/dist/olHelpers/mapPopupCls.js @@ -0,0 +1,415 @@ +/// <reference path="../../definitions/jquery.d.ts"/> +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +/** + * Created by gavorhes on 11/3/2015. + */ +var mapInteractionBase_1 = require('./mapInteractionBase'); +var provide_1 = require('../util/provide'); +var custom_ol_1 = require('custom-ol'); +var $ = require('jquery'); +var nm = provide_1.default('olHelpers'); +var FeatureLayerProperties = (function () { + /** + * + * @param feature the feature + * @param layer - the layer in the popup + * @param layerIndex - index of the layer + * @param selectionLayer - the ol selection layer + * @param [esriLayerName=undefined] - esri layer name + */ + function FeatureLayerProperties(feature, layer, layerIndex, selectionLayer, esriLayerName) { + this.feature = feature; + this.layer = layer; + this.layerIndex = layerIndex; + this.selectionLayer = selectionLayer; + this.popupContent = ''; + this.esriLayerName = typeof esriLayerName == 'string' ? esriLayerName : undefined; + } + Object.defineProperty(FeatureLayerProperties.prototype, "layerName", { + get: function () { + if (typeof this.esriLayerName == 'string') { + return this.esriLayerName; + } + else { + return this.layer.name; + } + }, + enumerable: true, + configurable: true + }); + return FeatureLayerProperties; +}()); +exports.FeatureLayerProperties = FeatureLayerProperties; +/** + * map popup class + * @augments MapInteractionBase + */ +var MapPopupCls = (function (_super) { + __extends(MapPopupCls, _super); + /** + * Definition for openlayers style function + * @callback olStyleFunction + * ¶m feature the openlayers vector feature + * $param + */ + /** + * map popup constructor + */ + function MapPopupCls() { + _super.call(this, 'map popup'); + this._arrPopupLayerIds = []; + this._arrPopupLayerNames = []; + this._arrPopupLayers = []; + this._arrPopupOlLayers = []; + this._arrPopupContentFunction = []; + this._$popupContainer = undefined; + this._$popupContent = undefined; + this._$popupCloser = undefined; + this._popupOverlay = undefined; + this._selectionLayers = []; + this._selectionLayerLookup = {}; + this._mapClickFunctions = []; + //let a = function($jqueryContent){console.log($jqueryContent)}; + //this._popupChangedLookup = {'a': a}; + this._popupChangedFunctions = []; + this._esriMapServiceLayers = []; + this._popupOpen = false; + this._popupCoordinate = null; + this._passThroughLayerFeatureArray = []; + this._currentPopupIndex = -1; + this._popupContentLength = 0; + } + /** + * map popup initialization + * @param {ol.Map} theMap - the ol map + */ + MapPopupCls.prototype.init = function (theMap) { + var _this = this; + _super.prototype.init.call(this, theMap); + var $map; + var target = this.map.getTarget(); + if (typeof target == 'string') { + $map = $('#' + target); + } + else { + $map = $(target); + } + $map.append('<div class="ol-popup">' + + '<span class="ol-popup-closer">X</span>' + + '<div class="popup-content"></div>' + + '</div>'); + this._$popupContainer = $map.find('.ol-popup'); + this._$popupContent = $map.find('.popup-content'); + this._$popupCloser = $map.find('.ol-popup-closer'); + this._popupOverlay = new custom_ol_1.ol.Overlay({ element: this._$popupContainer[0], autoPan: true, + autoPanAnimation: { + duration: 250, + source: theMap.getView().getCenter() + } }); + this._map.addOverlay(this._popupOverlay); + this._$popupCloser.click(function (evt) { + _this.closePopup(); + }); + // display popup on click + this._map.on('singleclick', function (evt) { + _this.closePopup(); + _this._popupCoordinate = evt['coordinate']; + if (_this._esriMapServiceLayers.length > 0) { + var queryParams = { + geometry: evt['coordinate'].join(','), + geometryType: 'esriGeometryPoint', + layers: 'all', + sr: _this._map.getView().getProjection().getCode().split(':')[1], + mapExtent: _this._map.getView().calculateExtent(_this._map.getSize()).join(','), + imageDisplay: _this._map.getSize().join(',') + ',96', + returnGeometry: true, + tolerance: 15, + f: 'pjson' + }; + for (var _i = 0, _a = _this._esriMapServiceLayers; _i < _a.length; _i++) { + var l = _a[_i]; + l.getPopupInfo(queryParams); + } + } + var layerFeatureObjectArray = _this._featuresAtPixel(evt['pixel']); + _this._passThroughLayerFeatureArray = []; + _this._currentPopupIndex = -1; + for (var i = 0; i < layerFeatureObjectArray.length; i++) { + var featObj = layerFeatureObjectArray[i]; + var props = featObj.feature.getProperties(); + var popupContentResponse = _this._arrPopupContentFunction[featObj.layerIndex](props, _this._$popupContent); + //skip if return was false + if (popupContentResponse === false) { + } + else if (typeof popupContentResponse == 'string') { + featObj.popupContent = popupContentResponse; + _this._passThroughLayerFeatureArray.push(featObj); + } + else { + featObj.selectionLayer.getSource().addFeature(featObj.feature); + } + } + _this._popupContentLength = _this._passThroughLayerFeatureArray.length; + _this._currentPopupIndex = -1; + var popupHtml = '<div class="ol-popup-nav">'; + popupHtml += '<span class="previous-popup ol-popup-nav-arrow">◀</span>'; + popupHtml += '<span class="next-popup ol-popup-nav-arrow">▶</span>'; + popupHtml += "<span class=\"current-popup-item-number\" style=\"font-weight: bold;\"></span>"; + popupHtml += "<span> of </span>"; + popupHtml += "<span class=\"popup-content-length\" style=\"font-weight: bold;\">" + _this._popupContentLength + "</span>"; + popupHtml += "<span> - </span>"; + popupHtml += "<span class=\"current-popup-layer-name\"></span>"; + popupHtml += '</div>'; + popupHtml += '<div class="ol-popup-inner">'; + popupHtml += '</div>'; + _this._$popupContent.html(popupHtml); + _this._$popupContent.find('.previous-popup').click(function () { + if (_this._popupContentLength == 1) { + return; + } + if (_this._currentPopupIndex == 0) { + _this._currentPopupIndex = _this._popupContentLength - 1; + } + else { + _this._currentPopupIndex--; + } + _this._triggerFeatSelect(); + }); + var nextPopup = _this._$popupContent.find('.next-popup'); + nextPopup.click(function () { + if (_this._popupContentLength == 1 && _this._currentPopupIndex > -1) { + return; + } + if (_this._currentPopupIndex == _this._popupContentLength - 1) { + _this._currentPopupIndex = 0; + } + else { + _this._currentPopupIndex++; + } + _this._triggerFeatSelect(); + }); + if (_this._popupContentLength > 0) { + nextPopup.trigger('click'); + _this._popupOverlay.setPosition(_this._popupCoordinate); + _this._$popupContent.scrollTop(0); + _this._popupOpen = true; + } + }); + //change mouse cursor when over marker + this._map.on('pointermove', function (evt) { + if (evt['dragging']) { + return; + } + var pixel = _this.map.getEventPixel(evt['originalEvent']); + var hit = _this.map.hasFeatureAtPixel(pixel, function (lyrCandidate) { + for (var _i = 0, _a = _this._arrPopupOlLayers; _i < _a.length; _i++) { + var olLayer = _a[_i]; + if (lyrCandidate == olLayer) { + return true; + } + } + return false; + }); + _this.map.getTargetElement().style.cursor = hit ? 'pointer' : ''; + }); + return true; + }; + /** + * helper to select features + * @private + */ + MapPopupCls.prototype._triggerFeatSelect = function () { + var $currentPopupItemNumber = this._$popupContent.find('.current-popup-item-number'); + var $innerPopup = this._$popupContent.find('.ol-popup-inner'); + var $layerNameSpan = this._$popupContent.find('.current-popup-layer-name'); + this.clearSelection(); + var lyrFeatObj = this._passThroughLayerFeatureArray[this._currentPopupIndex]; + $currentPopupItemNumber.html((this._currentPopupIndex + 1).toFixed()); + $layerNameSpan.html(lyrFeatObj.layerName); + $innerPopup.html(lyrFeatObj.popupContent); + lyrFeatObj.selectionLayer.getSource().addFeature(lyrFeatObj.feature); + for (var _i = 0, _a = this._popupChangedFunctions; _i < _a.length; _i++) { + var f = _a[_i]; + f(this._$popupContent); + } + }; + /** + * + * @param feature - the ol feature + * @param {LayerEsriMapServer} lyr - the map server layer + * @param {string} popupContent - popup content + * @param {string} esriName - esri layer name + */ + MapPopupCls.prototype.addMapServicePopupContent = function (feature, lyr, popupContent, esriName) { + var featLayerObject = new FeatureLayerProperties(feature, lyr, this._popupContentLength, this._selectionLayerLookup[lyr.id], esriName); + featLayerObject.popupContent = popupContent; + this._passThroughLayerFeatureArray.push(featLayerObject); + this._popupContentLength++; + $('.popup-content-length').html(this._popupContentLength.toFixed()); + if (!this._popupOpen) { + this._$popupContent.find('.next-popup').trigger('click'); + this._popupOverlay.setPosition(this._popupCoordinate); + this._$popupContent.scrollTop(0); + this._popupOpen = true; + } + }; + /** + * + * @param pixel - the ol pixel + * @returns feature layer properties + * @private + */ + MapPopupCls.prototype._featuresAtPixel = function (pixel) { + var _this = this; + var layerFeatureObjectArray = []; + this.map.forEachFeatureAtPixel(pixel, function (feature, layer) { + var lyrIndex = _this._arrPopupOlLayers.indexOf(layer); + //TODO fix this + // if (lyrIndex > -1) { + // layerFeatureObjectArray.push(new FeatureLayerProperties( + // feature, this._arrPopupLayers[lyrIndex], lyrIndex, this._selectionLayers[lyrIndex])); + // } + }); + return layerFeatureObjectArray; + }; + MapPopupCls.prototype.closePopup = function () { + this._checkInit(); + this._popupOpen = false; + this._popupOverlay.setPosition(undefined); + this._$popupCloser[0].blur(); + this.clearSelection(); + this._$popupContent.html(''); + return false; + }; + ; + /** + * + * @param chgFunction - popup change function + */ + MapPopupCls.prototype.addPopupChangedFunction = function (chgFunction) { + this._popupChangedFunctions.push(chgFunction); + }; + /** + * + * @param {LayerBase|*} lyr - the layer being acted on + * @param {object} [selectionStyle={}] the selection style configuration + * @param {string} [selectionStyle.color=rgba(255,170,0,0.5)] the selection color + * @param {number} [selectionStyle.width=10] the selection width for linear features + * @param {object|function} [selectionStyle.olStyle=undefined] an openlayers style object or function + * @returns the new selection layer + * @private + */ + MapPopupCls.prototype._addPopupLayer = function (lyr, selectionStyle) { + this._checkInit(); + selectionStyle = selectionStyle || {}; + selectionStyle.color = selectionStyle.color || 'rgba(255,170,0,0.5)'; + selectionStyle.width = selectionStyle.width || 10; + var theStyle; + if (selectionStyle.olStyle) { + theStyle = selectionStyle.olStyle; + } + else { + theStyle = new custom_ol_1.ol.style.Style({ + stroke: new custom_ol_1.ol.style.Stroke({ + color: selectionStyle.color, + width: selectionStyle.width + }), + image: new custom_ol_1.ol.style.Circle({ + radius: 7, + fill: new custom_ol_1.ol.style.Fill({ color: selectionStyle.color }), + stroke: new custom_ol_1.ol.style.Stroke({ color: selectionStyle.color, width: 1 }) + }), + fill: new custom_ol_1.ol.style.Fill({ + color: selectionStyle.color + }) + }); + } + var selectionLayer = new custom_ol_1.ol.layer.Vector({ + source: new custom_ol_1.ol.source.Vector(), + style: theStyle, + zIndex: 100 + }); + this._selectionLayers.push(selectionLayer); + this._selectionLayerLookup[lyr.id] = selectionLayer; + this.map.addLayer(selectionLayer); + return selectionLayer; + }; + /** + * Add popup to the map + * @param {LayerBase|*} lyr The layer that the popup with act on + * @param {popupCallback} popupContentFunction - popup content function that makes popup info + * @param {object} [selectionStyle={}] the selection style configuration + * @param {string} [selectionStyle.color=rgba(255,170,0,0.5)] the selection color + * @param {number} [selectionStyle.width=10] the selection width for linear features + * @param {object|function} [selectionStyle.olStyle=undefined] an openlayers style object or function + * @returns {object} a reference to the ol selection layer + */ + MapPopupCls.prototype.addVectorPopup = function (lyr, popupContentFunction, selectionStyle) { + var selectionLayer = this._addPopupLayer(lyr, selectionStyle); + this._arrPopupLayerIds.push(lyr.id); + this._arrPopupLayerNames.push(lyr.name); + this._arrPopupLayers.push(lyr); + this._arrPopupOlLayers.push(lyr.olLayer); + this._arrPopupContentFunction.push(popupContentFunction); + return selectionLayer; + }; + ; + /** + * + * @param {LayerBase} lyr - layer + */ + MapPopupCls.prototype.removeVectorPopup = function (lyr) { + var idx = this._arrPopupLayerIds.indexOf(lyr.id); + if (idx > -1) { + this._arrPopupLayerIds.splice(idx, 1); + this._arrPopupLayerNames.splice(idx, 1); + this._arrPopupLayers.splice(idx, 1); + this._arrPopupOlLayers.splice(idx, 1); + this._arrPopupContentFunction.splice(idx, 1); + this._selectionLayers.splice(idx, 1); + delete this._selectionLayerLookup[lyr.id]; + } + }; + /** + * + * @param {LayerEsriMapServer} lyr - map server layer + * @param {object} [selectionStyle={}] the selection style configuration + * @param {string} [selectionStyle.color=rgba(255,170,0,0.5)] the selection color + * @param {number} [selectionStyle.width=10] the selection width for linear features + * @param {object|function} [selectionStyle.olStyle=undefined] an openlayers style object or function + * @returns {object} a reference to the ol selection layer + */ + MapPopupCls.prototype.addMapServicePopup = function (lyr, selectionStyle) { + var selectionLayer = this._addPopupLayer(lyr, selectionStyle); + this._esriMapServiceLayers.push(lyr); + return selectionLayer; + }; + MapPopupCls.prototype.clearSelection = function () { + this._checkInit(); + for (var i = 0; i < this._selectionLayers.length; i++) { + this._selectionLayers[i].getSource().clear(); + } + for (var _i = 0, _a = this._mapClickFunctions; _i < _a.length; _i++) { + var f = _a[_i]; + f(); + } + }; + ; + /** + * Add a function to be called when the map is clicked but before any popups are implemented + * @param {function} func - the map click function + */ + MapPopupCls.prototype.addMapClickFunction = function (func) { + this._mapClickFunctions.push(func); + }; + return MapPopupCls; +}(mapInteractionBase_1.default)); +nm.MapPopupCls = MapPopupCls; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = MapPopupCls; +//# sourceMappingURL=mapPopupCls.js.map \ No newline at end of file diff --git a/dist/olHelpers/mapPopupCls.js.map b/dist/olHelpers/mapPopupCls.js.map new file mode 100644 index 0000000000000000000000000000000000000000..91532bd4441c1b36d8799f32448ebe75d42065a9 --- /dev/null +++ b/dist/olHelpers/mapPopupCls.js.map @@ -0,0 +1 @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CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACrC,OAAO,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,wCAAkB,GAAlB,UAAmB,GAAG,EAAE,cAA4E;QAChG,IAAI,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QAC9D,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAErC,MAAM,CAAC,cAAc,CAAC;IAC1B,CAAC;IAED,oCAAc,GAAd;QACI,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACpD,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC;QACjD,CAAC;QACD,GAAG,CAAC,CAAU,UAAuB,EAAvB,KAAA,IAAI,CAAC,kBAAkB,EAAvB,cAAuB,EAAvB,IAAuB,CAAC;YAAjC,IAAI,CAAC,SAAA;YACN,CAAC,EAAE,CAAC;SACP;IACL,CAAC;;IAED;;;OAGG;IACH,yCAAmB,GAAnB,UAAoB,IAAc;QAC9B,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IACL,kBAAC;AAAD,CAAC,AA9bD,CAA0B,4BAAkB,GA8b3C;AACD,EAAE,CAAC,WAAW,GAAG,WAAW,CAAC;AAC7B;kBAAe,WAAW,CAAC"} \ No newline at end of file diff --git a/lib-ts/src-ts/olHelpers/propertiesZoomStyle.d.ts b/dist/olHelpers/propertiesZoomStyle.d.ts similarity index 100% rename from lib-ts/src-ts/olHelpers/propertiesZoomStyle.d.ts rename to dist/olHelpers/propertiesZoomStyle.d.ts diff --git a/lib-ts/src-ts/olHelpers/propertiesZoomStyle.js b/dist/olHelpers/propertiesZoomStyle.js similarity index 100% rename from lib-ts/src-ts/olHelpers/propertiesZoomStyle.js rename to dist/olHelpers/propertiesZoomStyle.js diff --git a/dist/olHelpers/propertiesZoomStyle.js.map b/dist/olHelpers/propertiesZoomStyle.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3c0657750789646db24f3e5b02c0dc140e4fc3f2 --- /dev/null +++ b/dist/olHelpers/propertiesZoomStyle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"propertiesZoomStyle.js","sourceRoot":"","sources":["../../src-ts/olHelpers/propertiesZoomStyle.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,wBAAoB,iBAAiB,CAAC,CAAA;AACtC,IAAY,qBAAqB,WAAM,yBAAyB,CAAC,CAAA;AAEjE,IAAM,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAGhC;;;;;;GAMG;AAEH;;;;GAIG;AACH,6BAA6B,SAAS;IAClC,EAAE,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,CAAA,CAAC;QACxB,MAAM,CAAC,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,UAAU,OAAmB,EAAE,UAAU;QAC5C,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC;IAC3F,CAAC,CAAC;AACN,CAAC;AAED,EAAE,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;AAC7C;kBAAe,mBAAmB,CAAC"} \ No newline at end of file diff --git a/lib-ts/src-ts/olHelpers/quickMap.d.ts b/dist/olHelpers/quickMap.d.ts similarity index 100% rename from lib-ts/src-ts/olHelpers/quickMap.d.ts rename to dist/olHelpers/quickMap.d.ts diff --git a/lib-ts/src-ts/olHelpers/quickMap.js b/dist/olHelpers/quickMap.js similarity index 100% rename from lib-ts/src-ts/olHelpers/quickMap.js rename to dist/olHelpers/quickMap.js diff --git a/dist/olHelpers/quickMap.js.map b/dist/olHelpers/quickMap.js.map new file mode 100644 index 0000000000000000000000000000000000000000..dcbd5831e4bee64747c4ebe4350402e2304bc9b3 --- /dev/null +++ b/dist/olHelpers/quickMap.js.map @@ -0,0 +1 @@ +{"version":3,"file":"quickMap.js","sourceRoot":"","sources":["../../src-ts/olHelpers/quickMap.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,6BAA4C,gBAAgB,CAAC,CAAA;AAC7D,wBAAoB,iBAAiB,CAAC,CAAA;AACtC,wBAAoB,WAAW,CAAC,CAAA;AAChC,yBAAqB,YAAY,CAAC,CAAA;AAClC,IAAI,EAAE,GAAG,iBAAO,CAAC,WAAW,CAAC,CAAC;AAG9B;;;;;;;;;;;;;;;GAeG;AACH,kBAAyB,OAA0B;IAC/C,IAAI,CAAC,GAAG,2BAAY,CAAC,OAAO,CAAC,CAAC;IAC9B,iBAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChB,kBAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEjB,MAAM,CAAC,CAAC,CAAC;AACb,CAAC;AANe,gBAAQ,WAMvB,CAAA;AAGD,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACvB;kBAAe,QAAQ,CAAC"} \ No newline at end of file diff --git a/lib-ts/src-ts/olHelpers/quickMapBase.d.ts b/dist/olHelpers/quickMapBase.d.ts similarity index 100% rename from lib-ts/src-ts/olHelpers/quickMapBase.d.ts rename to dist/olHelpers/quickMapBase.d.ts diff --git a/lib-ts/src-ts/olHelpers/quickMapBase.js b/dist/olHelpers/quickMapBase.js similarity index 100% rename from lib-ts/src-ts/olHelpers/quickMapBase.js rename to dist/olHelpers/quickMapBase.js diff --git a/dist/olHelpers/quickMapBase.js.map b/dist/olHelpers/quickMapBase.js.map new file mode 100644 index 0000000000000000000000000000000000000000..db811da8cbd2611131bab6ee0da5f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IAED,IAAI,GAAG,GAAG,IAAI,cAAE,CAAC,GAAG,CAAC;QACjB,MAAM,EAAE,CAAC,QAAQ,CAAC;QAClB,MAAM,EAAE,OAAO,CAAC,KAAK;QACrB,QAAQ,EAAE,cAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;YAC1B,kBAAkB,EAAE,EAAC,WAAW,EAAE,KAAK,EAAC;SAC3C,CAAC;QACF,IAAI,EAAE,IAAI,cAAE,CAAC,IAAI,CAAC;YACd,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;YAC5C,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,OAAO,CAAC,OAAO;SAC3B,CAAC;KACL,CAAC,CAAC;IAEH,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QACrB,oCAAoC;QACpC,GAAG,CAAC,UAAU,CAAC,IAAI,cAAE,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,GAAG,CAAC;AACf,CAAC;AAxEe,oBAAY,eAwE3B,CAAA;AAED,EAAE,CAAC,YAAY,GAAG,YAAY,CAAC;AAC/B;kBAAe,YAAY,CAAC"} \ No newline at end of file diff --git a/lib-ts/src-ts/olHelpers/zoomResolutionConvert.d.ts b/dist/olHelpers/zoomResolutionConvert.d.ts similarity index 100% rename from lib-ts/src-ts/olHelpers/zoomResolutionConvert.d.ts rename to dist/olHelpers/zoomResolutionConvert.d.ts diff --git a/lib-ts/src-ts/olHelpers/zoomResolutionConvert.js b/dist/olHelpers/zoomResolutionConvert.js similarity index 100% rename from lib-ts/src-ts/olHelpers/zoomResolutionConvert.js rename to dist/olHelpers/zoomResolutionConvert.js diff --git a/dist/olHelpers/zoomResolutionConvert.js.map b/dist/olHelpers/zoomResolutionConvert.js.map new file mode 100644 index 0000000000000000000000000000000000000000..fabd0840604a8744e0b2cba0fbc690a95e093858 --- /dev/null +++ b/dist/olHelpers/zoomResolutionConvert.js.map @@ -0,0 +1 @@ +{"version":3,"file":"zoomResolutionConvert.js","sourceRoot":"","sources":["../../src-ts/olHelpers/zoomResolutionConvert.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,wBAAoB,iBAAiB,CAAC,CAAA;AACtC,IAAM,EAAE,GAAG,iBAAO,CAAC,iCAAiC,CAAC,CAAC;AAEtD,IAAI,cAAc,GAAG;IACjB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;IACnB,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,qBAAqB;IACrB,qBAAqB,CAAC,IAAI;CAC7B,CAAC;AAEF;;;;GAIG;AACH,0BAAiC,SAAS;IACtC,YAAY,CAAC;IAEb,EAAE,CAAC,CAAC,OAAO,SAAS,IAAI,QAAQ,CAAC,CAAC,CAAC;QAC/B,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,IAAI,SAAS,IAAI,CAAC,IAAI,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC;YAC3D,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACrC,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,OAAO,CAAC,GAAG,CAAC,kCAAgC,SAAW,CAAC,CAAC;YAEzD,MAAM,CAAC,SAAS,CAAC;QACrB,CAAC;IACL,CAAC;IAAC,IAAI,CAAC,CAAC;QACJ,MAAM,CAAC,SAAS,CAAC;IACrB,CAAC;AACL,CAAC;AAde,wBAAgB,mBAc/B,CAAA;AACD,EAAE,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AAGvC;;;;GAIG;AACH,0BAAiC,UAAU;IACvC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAC,CAAC;QAC5C,EAAE,CAAC,CAAC,UAAU,IAAI,cAAc,CAAC,CAAC,CAAE,CAAC,CAAA,CAAC;YAClC,MAAM,CAAC,CAAC,CAAC;QACb,CAAC;IACL,CAAC;IAED,MAAM,CAAC,CAAC,CAAC;AACb,CAAC;AARe,wBAAgB,mBAQ/B,CAAA;AAED,EAAE,CAAC,gBAAgB,GAAG,gBAAgB,CAAC"} \ No newline at end of file diff --git a/dist/src-ts/_internalnterfaces.d.ts b/dist/src-ts/_internalnterfaces.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c98298e4b6789edd6769f95941990b31023eb755 --- /dev/null +++ b/dist/src-ts/_internalnterfaces.d.ts @@ -0,0 +1,9 @@ +/** + * Created by gavorhes on 9/21/2016. + */ +export interface extentObject { + minX: number; + minY: number; + maxX: number; + maxY: number; +} diff --git a/dist/src-ts/_internalnterfaces.js b/dist/src-ts/_internalnterfaces.js new file mode 100644 index 0000000000000000000000000000000000000000..8c927201057a8bbdd2a13e0c2ead299d387fb281 --- /dev/null +++ b/dist/src-ts/_internalnterfaces.js @@ -0,0 +1,5 @@ +/** + * Created by gavorhes on 9/21/2016. + */ +"use strict"; +//# sourceMappingURL=_internalnterfaces.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/_internalnterfaces.js.map b/dist/src-ts/_internalnterfaces.js.map similarity index 100% rename from lib-ts/src-ts/_internalnterfaces.js.map rename to dist/src-ts/_internalnterfaces.js.map diff --git a/dist/src-ts/_test/my_little_test.d.ts b/dist/src-ts/_test/my_little_test.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib-ts/src-ts/_test/my_little_test.js b/dist/src-ts/_test/my_little_test.js similarity index 92% rename from lib-ts/src-ts/_test/my_little_test.js rename to dist/src-ts/_test/my_little_test.js index 1b0031f78890128d98a08ea4eba6d93bae3ce033..d6540f30381d999892aa818796398a750ac35cb1 100644 --- a/lib-ts/src-ts/_test/my_little_test.js +++ b/dist/src-ts/_test/my_little_test.js @@ -1,6 +1,6 @@ "use strict"; // -var quickMap_1 = require('../olHelpers/quickMap'); +var quickMap_1 = require('../olHelpers/quickMap.d'); console.log('eat this fish'); console.log('eat this fish'); console.log('eat this fish'); diff --git a/lib-ts/src-ts/_test/my_little_test.js.map b/dist/src-ts/_test/my_little_test.js.map similarity index 100% rename from lib-ts/src-ts/_test/my_little_test.js.map rename to dist/src-ts/_test/my_little_test.js.map diff --git a/dist/src-ts/index.d.ts b/dist/src-ts/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib-ts/src-ts/index.js b/dist/src-ts/index.js similarity index 100% rename from lib-ts/src-ts/index.js rename to dist/src-ts/index.js diff --git a/lib-ts/src-ts/index.js.map b/dist/src-ts/index.js.map similarity index 100% rename from lib-ts/src-ts/index.js.map rename to dist/src-ts/index.js.map diff --git a/lib-ts/src-ts/layers/LayerBase.d.ts b/dist/src-ts/layers/LayerBase.d.ts similarity index 100% rename from lib-ts/src-ts/layers/LayerBase.d.ts rename to dist/src-ts/layers/LayerBase.d.ts diff --git a/dist/src-ts/layers/LayerBase.js b/dist/src-ts/layers/LayerBase.js new file mode 100644 index 0000000000000000000000000000000000000000..06029f1da91111d2cb29f2d035320b53832f0737 --- /dev/null +++ b/dist/src-ts/layers/LayerBase.js @@ -0,0 +1,384 @@ +"use strict"; +/// <reference path="../../definitions/jquery.d.ts" /> +/// <reference path="../../definitions/node.d.ts" /> +var $ = require('jquery'); +var makeGuid_1 = require('../util/makeGuid.d'); +var zoomResolutionConvert = require('../olHelpers/zoomResolutionConvert.d'); +var provide_1 = require('../util/provide.d'); +var nm = provide_1.default('layers'); +/** + * The base layer class + * @abstract + */ +var LayerBase = (function () { + /** + * The base layer for all others + * @param {string} url - url for source + * @param {object} options - config + * @param {string} [options.id=makeGuid()] - layer id + * @param {string} [options.name=Unnamed Layer] - layer name + * @param {number} [options.opacity=1] - opacity + * @param {boolean} [options.visible=true] - default visible + * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28 + * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28 + * @param {object} [options.params={}] - the get parameters to include to retrieve the layer + * @param {number} [options.zIndex=0] - the z index for the layer + * @param {function} [options.loadCallback] - function to call on load, context this is the layer object + * @param {boolean} [options.legendCollapse=false] - if the legend item should be initially collapsed + * @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 + */ + function LayerBase(url, options) { + options = options || {}; + if (typeof url !== 'string') { + throw 'Invalid URL'; + } + this._url = url; + this._params = typeof options.params == 'object' ? options.params : {}; + this._legendCollapse = typeof options.legendCollapse == 'boolean' ? options.legendCollapse : false; + this._legendCheckbox = typeof options.legendCheckbox == 'boolean' ? options.legendCheckbox : true; + this.id = options.id || makeGuid_1.default(); + this._name = options.name || 'Unnamed Layer'; + this.animate = false; + this._opacity = typeof options.opacity == 'number' ? options.opacity : 1; + if (this._opacity > 1) { + this._opacity = 1; + } + else if (this._opacity < 0) { + this._opacity = 0; + } + this._visible = typeof options.visible === 'boolean' ? options.visible : true; + this._source = undefined; + /** + * + * @protected + */ + this._olLayer = undefined; + this._loaded = false; + this._maxResolution = zoomResolutionConvert.zoomToResolution(options.minZoom); + if (typeof this._maxResolution !== 'undefined') { + this._maxResolution += 0.00001; + } + this._minResolution = zoomResolutionConvert.zoomToResolution(options.maxZoom); + this._minZoom = typeof options.minZoom == 'number' ? options.minZoom : undefined; + this._maxZoom = typeof options.maxZoom == 'number' ? options.maxZoom : undefined; + this._zIndex = typeof options.zIndex == 'number' ? options.zIndex : 0; + this.loadCallback = typeof options.loadCallback == 'function' ? options.loadCallback : function () { + }; + this._legendContent = ''; + if (this._legendCheckbox) { + this._legendContent += ("<input type=\"checkbox\" " + (this.visible ? 'checked' : '') + " ") + + ("class=\"legend-check\" id=\"" + this.id + "-legend-layer-check\"><span></span>"); + this._legendContent += "<label for=\"" + this.id + "-legend-layer-check\" class=\"legend-layer-name\">" + this.name + "</label>"; + } + else { + this._legendContent += "<label class=\"legend-layer-name\">" + this.name + "</label>"; + } + this._$legendDiv = null; + this._applyCollapseCalled = false; + this._addLegendContent(typeof options.legendContent === 'string' ? options.legendContent : undefined); + } + /** + * base load function, sets _loaded = true if it is not already + * @protected + * @returns {boolean} if already loaded + */ + LayerBase.prototype._load = function () { + if (this.loaded == true) { + return true; + } + else { + this._loaded = true; + return false; + } + }; + /** + * Get the legend html, be sure to only add to the DOM once + * @returns {string} html for layer wrapped in a div + */ + LayerBase.prototype.getLegendDiv = function () { + return "<div class=\"legend-layer-div\" id=\"" + this.id + "-legend-layer-div\">" + this._legendContent + "</div>"; + }; + /** + * + * @param {string|undefined} additionalContent - additional content to add to legend + * @private + */ + LayerBase.prototype._addLegendContent = function (additionalContent) { + additionalContent = typeof additionalContent == 'string' ? additionalContent : ''; + var addCollapse = additionalContent.indexOf('<ul>') > -1; + if (addCollapse) { + additionalContent = '<span class="legend-items-expander" title="Expand/Collapse">▼</span>' + additionalContent; + } + this._legendContent += additionalContent; + this._$legendDiv = $("#" + this.id + "-legend-layer-div"); + if (this._$legendDiv.length > 0) { + this._$legendDiv.append(additionalContent); + this.applyCollapse(); + } + }; + /** + * add additional content to the legend + * @param {string} [additionalContent=] - additonal content to add + */ + LayerBase.prototype.addLegendContent = function (additionalContent) { + this._addLegendContent(additionalContent); + }; + LayerBase.prototype.applyCollapse = function () { + if (this._applyCollapseCalled) { + console.log('collapse already applied'); + return undefined; + } + this._$legendDiv = $("#" + this.id + "-legend-layer-div"); + if (this._$legendDiv.length > 0) { + var $expander = this._$legendDiv.find('.legend-items-expander'); + if ($expander.length > 0) { + this._applyCollapseCalled = true; + $expander.click(function () { + var $this = $(this); + $this.siblings('ul').slideToggle(); + if ($this.hasClass('legend-layer-group-collapsed')) { + $this.removeClass('legend-layer-group-collapsed'); + $this.html('▼'); + } + else { + $this.addClass('legend-layer-group-collapsed'); + $this.html('▶'); + } + }); + if (this._legendCollapse) { + $expander.trigger('click'); + } + } + } + }; + /** + * trick to refresh the layer + */ + LayerBase.prototype.refresh = function () { + if (this.source) { + this.source.refresh(); + } + }; + Object.defineProperty(LayerBase.prototype, "legendContent", { + /** + * get the legend content + * @type {string} + */ + get: function () { + return this._legendContent; + }, + /** + * set the legend content directly + * @param {string} newVal - new content + * @protected + */ + set: function (newVal) { + this._legendContent = newVal; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBase.prototype, "params", { + /** + * get the map get params + * @type {object} + */ + get: function () { + return this._params; + }, + /** + * set the map get params + * @param {object} newParams - new get params + * @protected + */ + set: function (newParams) { + this._params = newParams; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBase.prototype, "minResolution", { + /** + * get the minimum resolution + * @type {number|*} + */ + get: function () { + return this._minResolution; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBase.prototype, "maxResolution", { + /** + * get the maximum resolution + * @type {number|*} + */ + get: function () { + return this._maxResolution; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBase.prototype, "minZoom", { + /** + * get min zoom + * @type {number|*} + */ + get: function () { + return this._minZoom; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBase.prototype, "maxZoom", { + /** + * get max zoom + * @type {number|*} + */ + get: function () { + return this._maxZoom; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBase.prototype, "url", { + /** + * get the url + * @type {string} + */ + get: function () { + return this._url; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBase.prototype, "visible", { + /** + * Get the layer visibility + * @type {boolean} + */ + get: function () { + return this._visible; + }, + /** + * set the visibility + * @param visibility + */ + set: function (visibility) { + this.setVisible(visibility); + }, + enumerable: true, + configurable: true + }); + LayerBase.prototype.setVisible = function (visibility) { + this._visible = visibility; + if (this.olLayer) { + this.olLayer.setVisible(this._visible); + if (visibility && !this._loaded) { + this._load(); + } + } + }; + Object.defineProperty(LayerBase.prototype, "opacity", { + /** + * Get the layer opacity + * @type {number} + */ + get: function () { + return this._opacity; + }, + /** + * Set the layer opacity + * @param {number} opacity - layer opacity + */ + set: function (opacity) { + this._opacity = opacity; + if (this.olLayer) { + this.olLayer.setOpacity(this._opacity); + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBase.prototype, "name", { + /** + * Get the layer name + * @type {string} + */ + get: function () { + return this._name; + }, + /** + * set the layer name + * @param {string} newName - the new name + */ + set: function (newName) { + this._name = newName; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBase.prototype, "loaded", { + /** + * Check if the layer is loaded + * @type {boolean} + */ + get: function () { + return this._loaded; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerBase.prototype, "source", { + /** + * get the layer source + * @type {*} + */ + get: function () { + return this.getSource(); + }, + enumerable: true, + configurable: true + }); + LayerBase.prototype.getSource = function () { + return this._source; + }; + Object.defineProperty(LayerBase.prototype, "zIndex", { + /** + * get the z index + */ + get: function () { + return this._zIndex; + }, + /** + * set the z index + */ + set: function (newZ) { + this._zIndex = newZ; + }, + enumerable: true, + configurable: true + }); + LayerBase.prototype.setZIndex = function (newZ) { + }; + Object.defineProperty(LayerBase.prototype, "olLayer", { + /** + * the the ol layer + */ + get: function () { + return this.getOlLayer(); + }, + enumerable: true, + configurable: true + }); + LayerBase.prototype.getOlLayer = function () { + return this._olLayer; + }; + return LayerBase; +}()); +exports.LayerBase = LayerBase; +nm.LayerBase = LayerBase; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = LayerBase; +//# sourceMappingURL=LayerBase.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/layers/LayerBase.js.map b/dist/src-ts/layers/LayerBase.js.map similarity index 100% rename from lib-ts/src-ts/layers/LayerBase.js.map rename to dist/src-ts/layers/LayerBase.js.map diff --git a/lib-ts/src-ts/layers/LayerBaseVector.d.ts b/dist/src-ts/layers/LayerBaseVector.d.ts similarity index 100% rename from lib-ts/src-ts/layers/LayerBaseVector.d.ts rename to dist/src-ts/layers/LayerBaseVector.d.ts diff --git a/lib-ts/src-ts/layers/LayerBaseVector.js b/dist/src-ts/layers/LayerBaseVector.js similarity index 98% rename from lib-ts/src-ts/layers/LayerBaseVector.js rename to dist/src-ts/layers/LayerBaseVector.js index b467f9d65103fafa81cdcf1ec8997ed532c26285..c7b743a20efbed267e1ba3d4d15d2774a7ce11f2 100644 --- a/lib-ts/src-ts/layers/LayerBaseVector.js +++ b/dist/src-ts/layers/LayerBaseVector.js @@ -6,9 +6,9 @@ var __extends = (this && this.__extends) || function (d, b) { function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var LayerBase_1 = require('./LayerBase'); -var mapMove_1 = require('../olHelpers/mapMove'); -var provide_1 = require('../util/provide'); +var LayerBase_1 = require('./LayerBase.d'); +var mapMove_1 = require('../olHelpers/mapMove.d'); +var provide_1 = require('../util/provide.d'); var custom_ol_1 = require('custom-ol'); var $ = require('jquery'); var g = new custom_ol_1.ol.Map({}); diff --git a/lib-ts/src-ts/layers/LayerBaseVector.js.map b/dist/src-ts/layers/LayerBaseVector.js.map similarity index 100% rename from lib-ts/src-ts/layers/LayerBaseVector.js.map rename to dist/src-ts/layers/LayerBaseVector.js.map diff --git a/lib-ts/src-ts/layers/LayerEsriMapServer.d.ts b/dist/src-ts/layers/LayerEsriMapServer.d.ts similarity index 100% rename from lib-ts/src-ts/layers/LayerEsriMapServer.d.ts rename to dist/src-ts/layers/LayerEsriMapServer.d.ts diff --git a/dist/src-ts/layers/LayerEsriMapServer.js b/dist/src-ts/layers/LayerEsriMapServer.js new file mode 100644 index 0000000000000000000000000000000000000000..d8f1e3516a6e330c712e2f73d291653b602de49c --- /dev/null +++ b/dist/src-ts/layers/LayerEsriMapServer.js @@ -0,0 +1,145 @@ +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +/** + * Created by gavorhes on 12/7/2015. + */ +var LayerBase_1 = require('./LayerBase.d'); +var esriToOl = require('../olHelpers/esriToOlStyle.d'); +var mapPopup_1 = require('../olHelpers/mapPopup.d'); +var provide_1 = require('../util/provide.d'); +var custom_ol_1 = require('custom-ol'); +var nm = provide_1.default('layers'); +var $ = require('jquery'); +/** + * esri mapserver layer + * @augments LayerBase + */ +var LayerEsriMapServer = (function (_super) { + __extends(LayerEsriMapServer, _super); + /** + * The base layer for all others + * @param {string} url - resource url + * @param {object} options - config + * @param {string} [options.id] - layer id + * @param {string} [options.name=Unnamed Layer] - layer name + * @param {number} [options.opacity=1] - opacity + * @param {boolean} [options.visible=true] - default visible + * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28 + * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28 + * @param {object} [options.params={}] the get parameters to include to retrieve the layer + * @param {number} [options.zIndex=0] the z index for the layer + * @param {function} [options.loadCallback] function to call on load, context this is the layer object + * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed + * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility + * @param {boolean} [options.legendContent] additional content to add to the legend + * @param {boolean} [options.addPopup=false] if a popup should be added + * @param {undefined|Array<number>} [options.showLayers=undefined] if a popup should be added + */ + function LayerEsriMapServer(url, options) { + _super.call(this, url, options); + this._source = new custom_ol_1.ol.source.TileArcGISRest({ + url: this.url == '' ? undefined : this.url, + params: typeof options.showLayers == 'undefined' ? undefined : { layers: 'show:' + options.showLayers.join(',') } + }); + this._olLayer = new custom_ol_1.ol.layer.Tile({ + source: this._source, + visible: this.visible, + opacity: this.opacity, + minResolution: this._minResolution, + maxResolution: this._maxResolution, + zIndex: this._zIndex + }); + options.addPopup = typeof options.addPopup == 'boolean' ? options.addPopup : false; + this._esriFormat = new custom_ol_1.ol.format.EsriJSON(); + this._popupRequest = null; + this.addLegendContent(); + if (options.addPopup) { + mapPopup_1.default.addMapServicePopup(this); + } + } + /** + * add additional content to the legend + * @param {string} [additionalContent=''] additional content for legend + */ + LayerEsriMapServer.prototype.addLegendContent = function (additionalContent) { + var urlCopy = this.url; + if (urlCopy[urlCopy.length - 1] !== '/') { + urlCopy += '/'; + } + urlCopy += 'legend?f=pjson&callback=?'; + var _this = this; + var superAddLegend = _super.prototype.addLegendContent; + $.get(urlCopy, {}, function (d) { + var newHtml = esriToOl.makeMapServiceLegend(d); + superAddLegend.call(_this, newHtml); + }, 'json'); + }; + LayerEsriMapServer.prototype.getPopupInfo = function (queryParams) { + if (!this.visible) { + return; + } + var urlCopy = this.url; + if (urlCopy[urlCopy.length - 1] != '/') { + urlCopy += '/'; + } + urlCopy += 'identify?callback=?'; + var _this = this; + if (this._popupRequest != null) { + this._popupRequest.abort(); + } + this._popupRequest = $.get(urlCopy, queryParams, function (d) { + for (var _i = 0, _a = d['results']; _i < _a.length; _i++) { + var r = _a[_i]; + var popupHtml = '<table class="esri-popup-table">'; + for (var a in r['attributes']) { + if (r['attributes'].hasOwnProperty(a)) { + var attrVal = r['attributes'][a]; + if (attrVal == null || attrVal.toString().toLowerCase() == 'null') { + continue; + } + var attr = a; + if (attr.length > 14) { + attr = attr.slice(0, 11) + '...'; + } + popupHtml += "<tr><td>" + attr + "</td><td>" + attrVal + "</td></tr>"; + } + } + popupHtml += '</table>'; + mapPopup_1.default.addMapServicePopupContent(_this._esriFormat.readFeature(r), _this, popupHtml, r['layerName']); + } + }, 'json').always(function () { + _this._popupRequest = null; + }); + }; + Object.defineProperty(LayerEsriMapServer.prototype, "source", { + /** + * + * @returns {ol.source.TileArcGISRest} the vector source + */ + get: function () { + return _super.prototype.getSource.call(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LayerEsriMapServer.prototype, "olLayer", { + /** + * + * @returns the ol layer + */ + get: function () { + return _super.prototype.getOlLayer.call(this); + }, + enumerable: true, + configurable: true + }); + return LayerEsriMapServer; +}(LayerBase_1.default)); +nm.LayerEsriMapServer = LayerEsriMapServer; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = LayerEsriMapServer; +//# sourceMappingURL=LayerEsriMapServer.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/layers/LayerEsriMapServer.js.map b/dist/src-ts/layers/LayerEsriMapServer.js.map similarity index 100% rename from lib-ts/src-ts/layers/LayerEsriMapServer.js.map rename to dist/src-ts/layers/LayerEsriMapServer.js.map diff --git a/lib-ts/src-ts/olHelpers/esriToOlStyle.d.ts b/dist/src-ts/olHelpers/esriToOlStyle.d.ts similarity index 100% rename from lib-ts/src-ts/olHelpers/esriToOlStyle.d.ts rename to dist/src-ts/olHelpers/esriToOlStyle.d.ts diff --git a/lib-ts/src-ts/olHelpers/esriToOlStyle.js b/dist/src-ts/olHelpers/esriToOlStyle.js similarity index 99% rename from lib-ts/src-ts/olHelpers/esriToOlStyle.js rename to dist/src-ts/olHelpers/esriToOlStyle.js index f8d520c50ed3ca882e631b1afda255be21a1c7f3..47f44c642037f49c77e17ff068e7f2a39b58c9ba 100644 --- a/lib-ts/src-ts/olHelpers/esriToOlStyle.js +++ b/dist/src-ts/olHelpers/esriToOlStyle.js @@ -7,7 +7,7 @@ var __extends = (this && this.__extends) || function (d, b) { /** * Created by gavorhes on 1/4/2016. */ -var provide_1 = require('../util/provide'); +var provide_1 = require('../util/provide.d'); var custom_ol_1 = require('custom-ol'); var nm = provide_1.default('olHelpers.esriToOlStyle'); /** diff --git a/lib-ts/src-ts/olHelpers/esriToOlStyle.js.map b/dist/src-ts/olHelpers/esriToOlStyle.js.map similarity index 100% rename from lib-ts/src-ts/olHelpers/esriToOlStyle.js.map rename to dist/src-ts/olHelpers/esriToOlStyle.js.map diff --git a/lib-ts/src-ts/olHelpers/mapInteractionBase.d.ts b/dist/src-ts/olHelpers/mapInteractionBase.d.ts similarity index 100% rename from lib-ts/src-ts/olHelpers/mapInteractionBase.d.ts rename to dist/src-ts/olHelpers/mapInteractionBase.d.ts diff --git a/lib-ts/src-ts/olHelpers/mapInteractionBase.js b/dist/src-ts/olHelpers/mapInteractionBase.js similarity index 97% rename from lib-ts/src-ts/olHelpers/mapInteractionBase.js rename to dist/src-ts/olHelpers/mapInteractionBase.js index 10436da0bdec27bf415fc3cb9c618f2514c0ac56..5d82c115d5f4de3b355b99190147eee46f137f54 100644 --- a/lib-ts/src-ts/olHelpers/mapInteractionBase.js +++ b/dist/src-ts/olHelpers/mapInteractionBase.js @@ -2,7 +2,7 @@ /** * Created by gavorhes on 12/8/2015. */ -var provide_1 = require('../util/provide'); +var provide_1 = require('../util/provide.d'); var nm = provide_1.default('olHelpers'); /** * base interaction diff --git a/lib-ts/src-ts/olHelpers/mapInteractionBase.js.map b/dist/src-ts/olHelpers/mapInteractionBase.js.map similarity index 100% rename from lib-ts/src-ts/olHelpers/mapInteractionBase.js.map rename to dist/src-ts/olHelpers/mapInteractionBase.js.map diff --git a/dist/src-ts/olHelpers/mapMove.d.ts b/dist/src-ts/olHelpers/mapMove.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..963afaee1d4749f44b9fcbd6bb58a6ccbc84209e --- /dev/null +++ b/dist/src-ts/olHelpers/mapMove.d.ts @@ -0,0 +1,6 @@ +/** + * Created by gavorhes on 11/3/2015. + */ +import MapMoveCls from './mapMoveCls'; +declare var _default: MapMoveCls; +export default _default; diff --git a/dist/src-ts/olHelpers/mapMove.js b/dist/src-ts/olHelpers/mapMove.js new file mode 100644 index 0000000000000000000000000000000000000000..46d465051a98804dd3825fa6576303aa97412b1d --- /dev/null +++ b/dist/src-ts/olHelpers/mapMove.js @@ -0,0 +1,8 @@ +/** + * Created by gavorhes on 11/3/2015. + */ +"use strict"; +var mapMoveCls_1 = require('./mapMoveCls.d'); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = new mapMoveCls_1.default(); +//# sourceMappingURL=mapMove.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/olHelpers/mapMove.js.map b/dist/src-ts/olHelpers/mapMove.js.map similarity index 100% rename from lib-ts/src-ts/olHelpers/mapMove.js.map rename to dist/src-ts/olHelpers/mapMove.js.map diff --git a/lib-ts/src-ts/olHelpers/mapMoveCls.d.ts b/dist/src-ts/olHelpers/mapMoveCls.d.ts similarity index 100% rename from lib-ts/src-ts/olHelpers/mapMoveCls.d.ts rename to dist/src-ts/olHelpers/mapMoveCls.d.ts diff --git a/dist/src-ts/olHelpers/mapMoveCls.js b/dist/src-ts/olHelpers/mapMoveCls.js new file mode 100644 index 0000000000000000000000000000000000000000..47322421b906040aca1a4f1ae7150c0e27b3a224 --- /dev/null +++ b/dist/src-ts/olHelpers/mapMoveCls.js @@ -0,0 +1,236 @@ +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var mapInteractionBase_1 = require('./mapInteractionBase.d'); +var checkDefined = require('../util/checkDefined.d'); +var provide_1 = require('../util/provide.d'); +var makeGuid_1 = require('../util/makeGuid.d'); +var $ = require('jquery'); +var nm = provide_1.default('olHelpers'); +/** + * assists with map move interactions, trigger callback functions + * @augments MapInteractionBase + */ +var MapMoveCls = (function (_super) { + __extends(MapMoveCls, _super); + /** + * constructor called implicitly + */ + function MapMoveCls() { + _super.call(this, 'map move'); + this._arrLyrRequest = []; + this._arrLyrTimeout = []; + this._arrLayer = []; + this._lookupLayer = {}; + this._mapMoveCallbacks = []; + this._mapMoveCallbacksLookup = {}; + this._mapMoveCallbackDelays = []; + this._mapMoveCallbackContext = []; + this._mapMoveCallbackTimeout = []; + this._mapExtent = undefined; + this._zoomLevel = undefined; + } + /** + * initialize the map move object + * @param theMap - the ol map + */ + MapMoveCls.prototype.init = function (theMap) { + var _this = this; + var isInitialized = _super.prototype.init.call(this, theMap); + if (_super.prototype.init.call(this, theMap)) { + return isInitialized; + } + this.map.getView().on(['change:center', 'change:resolution'], function (e) { + _this._updateMapExtent(); + // trigger the layer updates + for (var i = 0; i < _this._arrLayer.length; i++) { + _this.triggerLyrLoad(_this._arrLayer[i], i, e.type); + } + // trigger the map callbacks + for (var i = 0; i < _this._mapMoveCallbacks.length; i++) { + _this.triggerMoveCallback(i, e.type); + } + }); + }; + MapMoveCls.prototype._updateMapExtent = function () { + var theView = this.map.getView(); + this._zoomLevel = theView.getZoom(); + var extentArray = theView.calculateExtent(this.map.getSize()); + this._mapExtent = { + minX: extentArray[0], + minY: extentArray[1], + maxX: extentArray[2], + maxY: extentArray[3] + }; + }; + Object.defineProperty(MapMoveCls.prototype, "mapExtent", { + /** + * return the map extent + */ + get: function () { + if (!this._mapExtent) { + this._updateMapExtent(); + } + return this._mapExtent; + }, + enumerable: true, + configurable: true + }); + /** + * Trigger the layer load + * @param lyr the layer being acted on + * @param index index of the layer + * @param eventType the event triggering the load, as 'change:center' or 'change:resolution' + */ + MapMoveCls.prototype.triggerLyrLoad = function (lyr, index, eventType) { + if (checkDefined.undefinedOrNull(lyr) && checkDefined.undefinedOrNull(index)) { + throw 'need to define lyr or index'; + } + else if (checkDefined.definedAndNotNull(lyr) && checkDefined.undefinedOrNull(index)) { + index = this._arrLayer.indexOf(lyr); + } + else if (checkDefined.undefinedOrNull(lyr) && checkDefined.definedAndNotNull(index)) { + lyr = this._arrLayer[index]; + } + // clear the timeout + if (this._arrLyrTimeout[index] != null) { + clearTimeout(this._arrLyrTimeout[index]); + this._arrLyrTimeout[index] = null; + } + // abort if necessary and clear the request + if (this._arrLyrRequest[index] != null && this._arrLyrRequest[index] != 4) { + this._arrLyrRequest[index].abort(); + this._arrLyrRequest[index] = null; + } + // dummy callback used if before load returns false + var callbackFunc = function () { }; + if (lyr.mapMoveBefore(this._zoomLevel, eventType)) { + lyr.mapMoveMakeGetParams(this._mapExtent, this._zoomLevel); + var _this_1 = this; + callbackFunc = function () { + function innerFunction(theLayer, theIndex) { + var _innerThis = this; + this._arrLyrRequest[theIndex] = $.get(theLayer.url, theLayer.mapMoveParams, function (d) { + /** + * @type {LayerBaseVector} + */ + theLayer.mapMoveCallback(d); + theLayer.loadCallback(); + }, 'json').fail(function (jqXHR) { + if (jqXHR.statusText != 'abort') { + console.log('failed'); + console.log(theLayer.url); + console.log(theLayer.mapMoveParams); + } + }).always(function () { + _innerThis._arrLyrTimeout[theIndex] = null; + _innerThis._arrLyrRequest[theIndex] = null; + }); + } + innerFunction.call(_this_1, lyr, index); + }; + } + else { + lyr.clear(); + } + this._arrLyrTimeout[index] = setTimeout(callbackFunc, lyr.onDemandDelay); + }; + /** + * trigger the map move call back at the given index + * @param ind - the index of the layer + * @param eventType=undefined the event triggering the load as 'change:center' or 'change:resolution' + * @param functionId=undefined the function id used to reference the added callback function + */ + MapMoveCls.prototype.triggerMoveCallback = function (ind, eventType, functionId) { + if (typeof ind == 'undefined' && typeof functionId == 'undefined') { + throw 'either the function index or the id must be defined'; + } + if (typeof ind !== 'number') { + ind = this._mapMoveCallbacks.indexOf(this._mapMoveCallbacksLookup[functionId]); + } + if (ind < 0) { + console.log('function not found'); + return; + } + // clear the timeout + if (this._mapMoveCallbackTimeout[ind] != null) { + clearTimeout(this._mapMoveCallbackTimeout[ind]); + this._mapMoveCallbackTimeout[ind] = null; + } + var ctx = this._mapMoveCallbackContext[ind]; + var theFunc = this._mapMoveCallbacks[ind]; + var _this = this; + var f = function () { + if (ctx !== null) { + theFunc.call(ctx, _this._mapExtent, _this._zoomLevel, eventType); + } + else { + theFunc(_this._mapExtent, _this._zoomLevel, eventType); + } + }; + this._mapMoveCallbackTimeout[ind] = setTimeout(f, this._mapMoveCallbackDelays[ind]); + }; + /** + * Add a layer to the interaction + * @param lyr - layer to add + * @param triggerOnAdd - if the layer should be loaded on add + */ + MapMoveCls.prototype.addVectorLayer = function (lyr, triggerOnAdd) { + if (triggerOnAdd === void 0) { triggerOnAdd = true; } + if (this._arrLayer.indexOf(lyr) > -1) { + console.log('already added ' + lyr.name + ' to map move'); + return; + } + this._checkInit(); + this._arrLyrRequest.push(null); + this._arrLyrTimeout.push(null); + this._arrLayer.push(lyr); + this._lookupLayer[lyr.id] = lyr; + triggerOnAdd = typeof triggerOnAdd == 'boolean' ? triggerOnAdd : true; + if (triggerOnAdd) { + if (this._mapExtent === undefined) { + this._updateMapExtent(); + } + this.triggerLyrLoad(lyr, this._arrLayer.length - 1); + } + }; + /** + * add a callback to the map move event + * @param func - callback function + * @param context - the context to use for this function + * @param delay=50 the delay before call load + * @param triggerOnAdd if the layer should be loaded on add to mapMove + * @param functionId optional id to reference the function later for outside triggering + */ + MapMoveCls.prototype.addCallback = function (func, context, delay, triggerOnAdd, functionId) { + if (this._mapMoveCallbacks.indexOf(func) > -1) { + console.log('this function already added to map move'); + return; + } + this._checkInit(); + if (!functionId) { + functionId = makeGuid_1.default(); + } + this._mapMoveCallbacks.push(func); + this._mapMoveCallbacksLookup[functionId] = functionId; + this._mapMoveCallbackDelays.push(typeof delay == 'number' ? delay : 50); + this._mapMoveCallbackContext.push(checkDefined.definedAndNotNull(context) ? context : null); + this._mapMoveCallbackTimeout.push(null); + triggerOnAdd = typeof triggerOnAdd == 'boolean' ? triggerOnAdd : true; + if (triggerOnAdd) { + if (this._mapExtent === undefined) { + this._updateMapExtent(); + } + this.triggerMoveCallback(this._mapMoveCallbacks.length - 1); + } + }; + return MapMoveCls; +}(mapInteractionBase_1.default)); +exports.MapMoveCls = MapMoveCls; +nm.MapMoveCls = MapMoveCls; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = MapMoveCls; +//# sourceMappingURL=mapMoveCls.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/olHelpers/mapMoveCls.js.map b/dist/src-ts/olHelpers/mapMoveCls.js.map similarity index 100% rename from lib-ts/src-ts/olHelpers/mapMoveCls.js.map rename to dist/src-ts/olHelpers/mapMoveCls.js.map diff --git a/dist/src-ts/olHelpers/mapPopup.d.ts b/dist/src-ts/olHelpers/mapPopup.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f404d23735a789a6dbdb6c2d1e15316c43538796 --- /dev/null +++ b/dist/src-ts/olHelpers/mapPopup.d.ts @@ -0,0 +1,6 @@ +/** + * Created by gavorhes on 11/3/2015. + */ +import MapPopupCls from './mapPopupCls'; +declare var _default: MapPopupCls; +export default _default; diff --git a/dist/src-ts/olHelpers/mapPopup.js b/dist/src-ts/olHelpers/mapPopup.js new file mode 100644 index 0000000000000000000000000000000000000000..9d0d7763d3755ee50ce3d6fd0b63d011cf56b551 --- /dev/null +++ b/dist/src-ts/olHelpers/mapPopup.js @@ -0,0 +1,8 @@ +/** + * Created by gavorhes on 11/3/2015. + */ +"use strict"; +var mapPopupCls_1 = require('./mapPopupCls.d'); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = new mapPopupCls_1.default(); +//# sourceMappingURL=mapPopup.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/olHelpers/mapPopup.js.map b/dist/src-ts/olHelpers/mapPopup.js.map similarity index 100% rename from lib-ts/src-ts/olHelpers/mapPopup.js.map rename to dist/src-ts/olHelpers/mapPopup.js.map diff --git a/lib-ts/src-ts/olHelpers/mapPopupCls.d.ts b/dist/src-ts/olHelpers/mapPopupCls.d.ts similarity index 100% rename from lib-ts/src-ts/olHelpers/mapPopupCls.d.ts rename to dist/src-ts/olHelpers/mapPopupCls.d.ts diff --git a/lib-ts/src-ts/olHelpers/mapPopupCls.js b/dist/src-ts/olHelpers/mapPopupCls.js similarity index 99% rename from lib-ts/src-ts/olHelpers/mapPopupCls.js rename to dist/src-ts/olHelpers/mapPopupCls.js index 17141eeea14019065537425ce345bd2c5165c8e1..828c4670f17df77492bdfc1d9c5d509da87e56ec 100644 --- a/lib-ts/src-ts/olHelpers/mapPopupCls.js +++ b/dist/src-ts/olHelpers/mapPopupCls.js @@ -8,8 +8,8 @@ var __extends = (this && this.__extends) || function (d, b) { /** * Created by gavorhes on 11/3/2015. */ -var mapInteractionBase_1 = require('./mapInteractionBase'); -var provide_1 = require('../util/provide'); +var mapInteractionBase_1 = require('./mapInteractionBase.d'); +var provide_1 = require('../util/provide.d'); var custom_ol_1 = require('custom-ol'); var $ = require('jquery'); var nm = provide_1.default('olHelpers'); diff --git a/lib-ts/src-ts/olHelpers/mapPopupCls.js.map b/dist/src-ts/olHelpers/mapPopupCls.js.map similarity index 100% rename from lib-ts/src-ts/olHelpers/mapPopupCls.js.map rename to dist/src-ts/olHelpers/mapPopupCls.js.map diff --git a/dist/src-ts/olHelpers/propertiesZoomStyle.d.ts b/dist/src-ts/olHelpers/propertiesZoomStyle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3fdc6943aa8edd62f7f7610403efd17efce20088 --- /dev/null +++ b/dist/src-ts/olHelpers/propertiesZoomStyle.d.ts @@ -0,0 +1,15 @@ +import { ol } from 'custom-ol'; +/** + * A style function based on properties and zoom level, wraps normal feature, resolution function + * @callback propertiesZoomStyle + * @param {object} properties the feature properties + * @param {number} zoom level + * + */ +/** + * wrapper to define a style function by properties and zoom level + * @param {propertiesZoomStyle|*} styleFunc - style function + * @returns {function|*} new function + */ +declare function propertiesZoomStyle(styleFunc: any): (feature: ol.Feature, resolution: any) => void; +export default propertiesZoomStyle; diff --git a/dist/src-ts/olHelpers/propertiesZoomStyle.js b/dist/src-ts/olHelpers/propertiesZoomStyle.js new file mode 100644 index 0000000000000000000000000000000000000000..9e9c2cfd59284923e9e78f31cbfc3986ed3fe88b --- /dev/null +++ b/dist/src-ts/olHelpers/propertiesZoomStyle.js @@ -0,0 +1,31 @@ +/** + * Created by gavorhes on 12/14/2015. + */ +"use strict"; +var provide_1 = require('../util/provide.d'); +var zoomResolutionConvert = require('./zoomResolutionConvert.d'); +var nm = provide_1.default('olHelpers'); +/** + * A style function based on properties and zoom level, wraps normal feature, resolution function + * @callback propertiesZoomStyle + * @param {object} properties the feature properties + * @param {number} zoom level + * + */ +/** + * wrapper to define a style function by properties and zoom level + * @param {propertiesZoomStyle|*} styleFunc - style function + * @returns {function|*} new function + */ +function propertiesZoomStyle(styleFunc) { + if (styleFunc == undefined) { + return undefined; + } + return function (feature, resolution) { + styleFunc(feature.getProperties(), zoomResolutionConvert.resolutionToZoom(resolution)); + }; +} +nm.propertiesZoomStyle = propertiesZoomStyle; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = propertiesZoomStyle; +//# sourceMappingURL=propertiesZoomStyle.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/olHelpers/propertiesZoomStyle.js.map b/dist/src-ts/olHelpers/propertiesZoomStyle.js.map similarity index 100% rename from lib-ts/src-ts/olHelpers/propertiesZoomStyle.js.map rename to dist/src-ts/olHelpers/propertiesZoomStyle.js.map diff --git a/dist/src-ts/olHelpers/quickMap.d.ts b/dist/src-ts/olHelpers/quickMap.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5268c2460fd91dcb37efc863913cfcaff3511c98 --- /dev/null +++ b/dist/src-ts/olHelpers/quickMap.d.ts @@ -0,0 +1,23 @@ +/** + * Created by gavorhes on 12/15/2015. + */ +import { quickMapOptions } from './quickMapBase'; +import { ol } from 'custom-ol'; +/** + * Sets up a map with some default parameters and initializes + * mapMove and mapPopup + * + * @param {object} [options={}] config options + * @param {string} [options.divId=map] map div id + * @param {object} [options.center={}] center config object + * @param {number} [options.center.x=-10018378] center x, web mercator x or lon + * @param {number} [options.center.y=5574910] center y, web mercator y or lat + * @param {number} [options.zoom=7] zoom level + * @param {number} [options.minZoom=undefined] min zoom + * @param {number} [options.maxZoom=undefined] max zoom + * @param {boolean} [options.baseSwitcher=true] if add base map switcher + * @param {boolean} [options.fullScreen=false] if add base map switcher + * @returns the ol map + */ +export declare function quickMap(options?: quickMapOptions): ol.Map; +export default quickMap; diff --git a/dist/src-ts/olHelpers/quickMap.js b/dist/src-ts/olHelpers/quickMap.js new file mode 100644 index 0000000000000000000000000000000000000000..3f707e48547163de83765ddff8b7db8451b6933b --- /dev/null +++ b/dist/src-ts/olHelpers/quickMap.js @@ -0,0 +1,36 @@ +/** + * Created by gavorhes on 12/15/2015. + */ +"use strict"; +var quickMapBase_1 = require('./quickMapBase.d'); +var provide_1 = require('../util/provide.d'); +var mapMove_1 = require('./mapMove.d'); +var mapPopup_1 = require('./mapPopup.d'); +var nm = provide_1.default('olHelpers'); +/** + * Sets up a map with some default parameters and initializes + * mapMove and mapPopup + * + * @param {object} [options={}] config options + * @param {string} [options.divId=map] map div id + * @param {object} [options.center={}] center config object + * @param {number} [options.center.x=-10018378] center x, web mercator x or lon + * @param {number} [options.center.y=5574910] center y, web mercator y or lat + * @param {number} [options.zoom=7] zoom level + * @param {number} [options.minZoom=undefined] min zoom + * @param {number} [options.maxZoom=undefined] max zoom + * @param {boolean} [options.baseSwitcher=true] if add base map switcher + * @param {boolean} [options.fullScreen=false] if add base map switcher + * @returns the ol map + */ +function quickMap(options) { + var m = quickMapBase_1.quickMapBase(options); + mapMove_1.default.init(m); + mapPopup_1.default.init(m); + return m; +} +exports.quickMap = quickMap; +nm.quickMap = quickMap; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = quickMap; +//# sourceMappingURL=quickMap.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/olHelpers/quickMap.js.map b/dist/src-ts/olHelpers/quickMap.js.map similarity index 100% rename from lib-ts/src-ts/olHelpers/quickMap.js.map rename to dist/src-ts/olHelpers/quickMap.js.map diff --git a/dist/src-ts/olHelpers/quickMapBase.d.ts b/dist/src-ts/olHelpers/quickMapBase.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e72054bc6791be5f8195635ece3d1297d998b888 --- /dev/null +++ b/dist/src-ts/olHelpers/quickMapBase.d.ts @@ -0,0 +1,31 @@ +import { ol } from 'custom-ol'; +export interface quickMapOptions { + divId?: string; + center?: { + x: number; + y: number; + }; + zoom?: number; + minZoom?: number; + maxZoom?: number; + baseSwitcher?: boolean; + fullScreen?: boolean; +} +/** + * Sets up a map with some default parameters and initializes + * mapMove and mapPopup + * + * @param [options={}] config options + * @param [options.divId=map] map div id + * @param [options.center={}] center config object + * @param [options.center.x=-10018378] center x, web mercator x or lon + * @param [options.center.y=5574910] center y, web mercator y or lat + * @param [options.zoom=7] zoom level + * @param [options.minZoom=undefined] min zoom + * @param [options.maxZoom=undefined] max zoom + * @param [options.baseSwitcher=true] if add base map switcher + * @param [options.fullScreen=false] if add base map switcher + * @returns the ol map + */ +export declare function quickMapBase(options?: quickMapOptions): ol.Map; +export default quickMapBase; diff --git a/dist/src-ts/olHelpers/quickMapBase.js b/dist/src-ts/olHelpers/quickMapBase.js new file mode 100644 index 0000000000000000000000000000000000000000..4e9687470ad71565d26a3d89bc2f75c2b9abd518 --- /dev/null +++ b/dist/src-ts/olHelpers/quickMapBase.js @@ -0,0 +1,74 @@ +/** + * Created by gavorhes on 12/15/2015. + */ +"use strict"; +var $ = require('jquery'); +var provide_1 = require('../util/provide.d'); +var custom_ol_1 = require('custom-ol'); +var nm = provide_1.default('olHelpers'); +/** + * Sets up a map with some default parameters and initializes + * mapMove and mapPopup + * + * @param [options={}] config options + * @param [options.divId=map] map div id + * @param [options.center={}] center config object + * @param [options.center.x=-10018378] center x, web mercator x or lon + * @param [options.center.y=5574910] center y, web mercator y or lat + * @param [options.zoom=7] zoom level + * @param [options.minZoom=undefined] min zoom + * @param [options.maxZoom=undefined] max zoom + * @param [options.baseSwitcher=true] if add base map switcher + * @param [options.fullScreen=false] if add base map switcher + * @returns the ol map + */ +function quickMapBase(options) { + options = options || {}; + options.divId = options.divId || 'map'; + options.center = options.center || { x: -10018378, y: 5574910 }; + options.zoom = typeof options.zoom == 'number' ? options.zoom : 7; + options.baseSwitcher = typeof options.baseSwitcher == 'boolean' ? options.baseSwitcher : true; + options.fullScreen = typeof options.fullScreen == 'boolean' ? options.fullScreen : false; + var $mapDiv = $('#' + options.divId); + $mapDiv.css('position', 'relative'); + var osmLayer = new custom_ol_1.ol.layer.Tile({ source: new custom_ol_1.ol.source.OSM() }); + // 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+lw6vCKBZehw01dEiyw4Q4aE0Z4ahDhKaFQsGnJ2BgqKoTBsNjFy0SlW6whRAZTdm8DBJmkBZhDi1j4xJQBk6ywrWUTymaCxac8lROcdauRGzQSNtA7EHUYhXyEwhhgjFUqRuO+rauhF1awFpzCsmwUbjIFBR0u1bKtyGpulW/H/cVVzkyGaIWTIR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mt0WW15VG15WXFuTHNtVnFxTXF4T3h0TnJzUnJ1XHJ4VXN6Wnp0VHx1W315VXp8XGR0YGx0YHVzZXJ0aHR9ZXV+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+2k6lIHjKTH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0BuX3bCfItl0PEwvYLqpwXG2MHlGsQ4S8pMJZv1JGmHiEoHQDdOjwmVlEP/nE9ADKjI8xLI0OOGITfy0SbeG/C2jKUDGSlDhM9I3IpK9iup6XnbRNC7yqueNsJCCIiXzdQhnaGN+46umnEdy5U5UbUJ48LFM9GkJo8BdDOiAZ7ZIQbKhYLMqvhU2wmNxjEAsS2AI7y4nWF64duePbk7YV3zvAVLEMD9AxJRNa3KDUibV7DjnkuprMEYjScFNcaR2ceP2u9R/5k1052Ryme5phAFRswlHjAudiP4dOy7CaxLgdJh9vUlU1702/+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==')"; + if (options.baseSwitcher) { + } + if (options.zoom < 0 || options.zoom > 28) { + 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 custom_ol_1.ol.geom.Point([options.center.x, options.center.y]); + new custom_ol_1.ol.proj.Projection({ code: "EPSG:4326" }); + p.transform(new custom_ol_1.ol.proj.Projection({ code: "EPSG:4326" }), new custom_ol_1.ol.proj.Projection({ code: "EPSG:3857" })); + var coordinates = p.getCoordinates(); + options.center.x = coordinates[0]; + options.center.y = coordinates[1]; + } + var map = new custom_ol_1.ol.Map({ + layers: [osmLayer], + target: options.divId, + controls: custom_ol_1.ol.control.defaults({ + attributionOptions: { collapsible: false } + }), + view: new custom_ol_1.ol.View({ + center: [options.center.x, options.center.y], + zoom: options.zoom, + minZoom: options.minZoom, + maxZoom: options.maxZoom + }) + }); + if (options.fullScreen) { + //TODO add full screen options to ts + map.addControl(new custom_ol_1.ol.control.FullScreen({})); + } + return map; +} +exports.quickMapBase = quickMapBase; +nm.quickMapBase = quickMapBase; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = quickMapBase; +//# sourceMappingURL=quickMapBase.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/olHelpers/quickMapBase.js.map b/dist/src-ts/olHelpers/quickMapBase.js.map similarity index 100% rename from lib-ts/src-ts/olHelpers/quickMapBase.js.map rename to dist/src-ts/olHelpers/quickMapBase.js.map diff --git a/dist/src-ts/olHelpers/zoomResolutionConvert.d.ts b/dist/src-ts/olHelpers/zoomResolutionConvert.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a0814c97e2d920a2710dae3ebd28936c305ddeec --- /dev/null +++ b/dist/src-ts/olHelpers/zoomResolutionConvert.d.ts @@ -0,0 +1,12 @@ +/** + * Get the resolution given the zoom level + * @param {number} zoomLevel - the zoom level + * @returns {number|*} the map resolution + */ +export declare function zoomToResolution(zoomLevel: any): number; +/** + * Get resolution from the zoom level + * @param {number} resolution - the resolution + * @returns {number|*} the zoom level + */ +export declare function resolutionToZoom(resolution: any): number; diff --git a/dist/src-ts/olHelpers/zoomResolutionConvert.js b/dist/src-ts/olHelpers/zoomResolutionConvert.js new file mode 100644 index 0000000000000000000000000000000000000000..64268b6e38f2059d2f4b42ed2bef442b9909c794 --- /dev/null +++ b/dist/src-ts/olHelpers/zoomResolutionConvert.js @@ -0,0 +1,75 @@ +/** + * Created by gavorhes on 12/14/2015. + */ +"use strict"; +var provide_1 = require('../util/provide.d'); +var nm = provide_1.default('olHelpers.zoomResolutionConvert'); +var _zoomResLookup = [ + 156543.03392804097, + 78271.51696402048, + 39135.75848201024, + 19567.87924100512, + 9783.93962050256, + 4891.96981025128, + 2445.98490512564, + 1222.99245256282, + 611.49622628141, + 305.748113140705, + 152.8740565703525, + 76.43702828517625, + 38.21851414258813, + 19.109257071294063, + 9.554628535647032, + 4.777314267823516, + 2.388657133911758, + 1.194328566955879, + 0.5971642834779395, + 0.29858214173896974, + 0.14929107086948487, + 0.07464553543474244, + 0.03732276771737122, + 0.01866138385868561, + 0.009330691929342804, + 0.004665345964671402, + 0.002332672982335701, + 0.0011663364911678506, + 0.0005831682455839253 //28 +]; +/** + * Get the resolution given the zoom level + * @param {number} zoomLevel - the zoom level + * @returns {number|*} the map resolution + */ +function zoomToResolution(zoomLevel) { + "use strict"; + if (typeof zoomLevel == 'number') { + if (zoomLevel % 1 === 0 && zoomLevel >= 0 && zoomLevel <= 28) { + return _zoomResLookup[zoomLevel]; + } + else { + console.log("invalid zoom level provided: " + zoomLevel); + return undefined; + } + } + else { + return undefined; + } +} +exports.zoomToResolution = zoomToResolution; +nm.zoomToResolution = zoomToResolution; +/** + * Get resolution from the zoom level + * @param {number} resolution - the resolution + * @returns {number|*} the zoom level + */ +function resolutionToZoom(resolution) { + for (var i = 0; i < _zoomResLookup.length; i++) { + if (resolution >= _zoomResLookup[i]) { + return i; + } + } + return 0; +} +exports.resolutionToZoom = resolutionToZoom; +nm.resolutionToZoom = resolutionToZoom; +//# sourceMappingURL=zoomResolutionConvert.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/olHelpers/zoomResolutionConvert.js.map b/dist/src-ts/olHelpers/zoomResolutionConvert.js.map similarity index 100% rename from lib-ts/src-ts/olHelpers/zoomResolutionConvert.js.map rename to dist/src-ts/olHelpers/zoomResolutionConvert.js.map diff --git a/lib-ts/src-ts/util/checkDefined.d.ts b/dist/src-ts/util/checkDefined.d.ts similarity index 100% rename from lib-ts/src-ts/util/checkDefined.d.ts rename to dist/src-ts/util/checkDefined.d.ts diff --git a/dist/src-ts/util/checkDefined.js b/dist/src-ts/util/checkDefined.js new file mode 100644 index 0000000000000000000000000000000000000000..bf074ba86477f82ac323683cc5edfaaf32e70309 --- /dev/null +++ b/dist/src-ts/util/checkDefined.js @@ -0,0 +1,26 @@ +"use strict"; +var provide_1 = require('./provide.d'); +var nm = provide_1.default('util.checkDefined'); +/** + * check if the input is undefined or null + * @param input - input pointer + * @returns true undefined or null + */ +function undefinedOrNull(input) { + "use strict"; + return (typeof input === 'undefined' || input === null); +} +exports.undefinedOrNull = undefinedOrNull; +nm.undefinedOrNull = undefinedOrNull; +/** + * check if the input is defined and not null + * @param input - input pointer + * @returns true defined and not null + */ +function definedAndNotNull(input) { + "use strict"; + return !(undefinedOrNull(input)); +} +exports.definedAndNotNull = definedAndNotNull; +nm.definedAndNotNull = definedAndNotNull; +//# sourceMappingURL=checkDefined.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/util/checkDefined.js.map b/dist/src-ts/util/checkDefined.js.map similarity index 100% rename from lib-ts/src-ts/util/checkDefined.js.map rename to dist/src-ts/util/checkDefined.js.map diff --git a/lib-ts/src-ts/util/colors.d.ts b/dist/src-ts/util/colors.d.ts similarity index 100% rename from lib-ts/src-ts/util/colors.d.ts rename to dist/src-ts/util/colors.d.ts diff --git a/dist/src-ts/util/colors.js b/dist/src-ts/util/colors.js new file mode 100644 index 0000000000000000000000000000000000000000..172b2b2320f7c1e5e14776917e627cb9bd7f0808 --- /dev/null +++ b/dist/src-ts/util/colors.js @@ -0,0 +1,157 @@ +"use strict"; +/** + * Created by gavorhes on 11/3/2015. + */ +var provide_1 = require('./provide.d'); +var chk = require('./checkDefined.d'); +var nm = provide_1.default('util.colors'); +/** + * helper function to convert to hex + * @param {number|string} x - the number to convert to hex + * @returns {string} number as hex + * @private + */ +function _hex(x) { + var hexDigits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]; + return isNaN(x) ? "00" : hexDigits[(x - x % 16) / 16] + hexDigits[x % 16]; +} +/** + * converts an RGB string to hex + * @param {string} rgb - rgb color + * @returns {string} rbg as hex + */ +function rgb2hex(rgb) { + var rgb1 = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); + return ("#" + _hex(rgb1[1]) + _hex(rgb1[2]) + _hex(rgb1[3])).toUpperCase(); +} +exports.rgb2hex = rgb2hex; +nm.rgb2hex = rgb2hex; +/** + * Convert hex string to RGB or RGBA string + * @param {string} hexString - hex color string + * @param {number} [alphaVal=undefined] Alpha value + * @returns {string} - rgb or rgba color + */ +function hexAlphaToRgbOrRgba(hexString, alphaVal) { + hexString = ((hexString.charAt(0) == "#") ? hexString.substring(1, 7) : hexString); + var r = parseInt(hexString.substring(0, 2), 16).toString() || '0'; + var g = parseInt(hexString.substring(2, 4), 16).toString() || '0'; + var b = parseInt(hexString.substring(4, 6), 16).toString() || '0'; + if (alphaVal) { + return "rgba(" + r + "," + g + "," + b + "," + alphaVal + ")"; + } + else { + return "rgba(" + r + "," + g + "," + b + ")"; + } +} +exports.hexAlphaToRgbOrRgba = hexAlphaToRgbOrRgba; +nm.hexAlphaToRgbOrRgba = hexAlphaToRgbOrRgba; +/** + * adds alpha value to rgb string 'rgb(r, b, g)', returns 'rgba(r, g, b, a)' + * @param {string} rgb - rgb color + * @param {number} alpha - alpha value 0 to 1 + * @returns {string} rgba color + */ +function rgbToRgba(rgb, alpha) { + var pieces = rgb.split(','); + pieces[0] = pieces[0].replace('rgb', 'rgba'); + pieces[2] = pieces[2].replace(')', ''); + pieces.push(' ' + alpha.toFixed(1) + ')'); + return pieces.join(','); +} +exports.rgbToRgba = rgbToRgba; +nm.rgbToRgba = rgbToRgba; +/** + * @typedef {function} colorLookupByNumber + * @param {number} num - the number to use to retrieve the color + * @returns {string} rgb color + */ +/** + * Make a blue green red gradient + * @param {number} minVal - minimum value + * @param {number} maxVal - maximum value + * @param {boolean} flipColors - if the colors should be flipped + * @returns {colorLookupByNumber} color lookup function + */ +function makeBlueGreenRedGradient(minVal, maxVal, flipColors) { + if (typeof flipColors != "boolean") { + flipColors = false; + } + return function (theVal) { + var r, g, b; + var ratio; + if (chk.undefinedOrNull(theVal)) { + return 'rgb(100,100,100)'; + } + var percent = (theVal - minVal) / (maxVal - minVal); + if (flipColors == true) { + percent = 1 - percent; + } + if (percent >= 1) { + r = 255; + g = 0; + b = 0; + } + else if (percent <= 0) { + r = 0; + g = 0; + b = 255; + } + else if (percent < .25) { + // green up, blue constant + r = 0; + g = Math.floor(255 * percent / 0.25); + b = 255; + } + else if (percent < 0.50) { + //blue down, green constant + ratio = (percent - 0.25) / 0.25; + r = 0; + g = 255; + b = 255 - Math.floor(255 * ratio); + } + else if (percent < 0.75) { + // red up, green constant + ratio = (percent - 0.5) / 0.25; + r = Math.floor(255 * ratio); + g = 255; + b = 0; + } + else { + // green down, red constant + ratio = (percent - 0.75) / 0.25; + r = 255; + g = 255 - Math.floor(255 * ratio); + b = 0; + } + r = r.toFixed(); + g = g.toFixed(); + b = b.toFixed(); + return 'rgb(' + r + ',' + g + ',' + b + ')'; + }; +} +exports.makeBlueGreenRedGradient = makeBlueGreenRedGradient; +nm.makeBlueGreenRedGradient = makeBlueGreenRedGradient; +/** + * Create a function that will return colors based on a gradient + * @param {number} median - median value + * @param {number} stdDev - standard deviation + * @param {boolean} flipColors - if the colors should be flipped + * @returns {colorLookupByNumber} color lookup function + */ +function makeBlueGreenRedGradientZScore(median, stdDev, flipColors) { + var grd = makeBlueGreenRedGradient(-2.5, 2.5, flipColors); + return function (theVal) { + var zScore; + if (theVal == null) { + zScore = null; + } + else { + zScore = (theVal - median) / stdDev; + } + return grd(zScore); + }; +} +exports.makeBlueGreenRedGradientZScore = makeBlueGreenRedGradientZScore; +nm.makeBlueGreenRedGradientZScore = makeBlueGreenRedGradientZScore; +//# sourceMappingURL=colors.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/util/colors.js.map b/dist/src-ts/util/colors.js.map similarity index 100% rename from lib-ts/src-ts/util/colors.js.map rename to dist/src-ts/util/colors.js.map diff --git a/lib-ts/src-ts/util/dateConvert.d.ts b/dist/src-ts/util/dateConvert.d.ts similarity index 100% rename from lib-ts/src-ts/util/dateConvert.d.ts rename to dist/src-ts/util/dateConvert.d.ts diff --git a/dist/src-ts/util/dateConvert.js b/dist/src-ts/util/dateConvert.js new file mode 100644 index 0000000000000000000000000000000000000000..833fbd311c4cb2e6f08cfd889f2a65a49aa36b7c --- /dev/null +++ b/dist/src-ts/util/dateConvert.js @@ -0,0 +1,45 @@ +/** + * Created by gavorhes on 11/4/2015. + */ +"use strict"; +var provide_1 = require('./provide.d'); +var nm = provide_1.default('util.dateConvert'); +function leadingPad(inNum) { + var strNum = inNum.toFixed(); + if (strNum.length < 2) { + strNum = '0' + strNum; + } + return strNum; +} +nm.leadingPad = leadingPad; +/** + * Given a date return a string in the format YYYY-mm-dd hh:MM:SS + * @param {Date} dte to convert + * @returns {string} the formatted date string + */ +function dateToYyyyMmDdHhMmSs(dte) { + var yr = dte.getYear() + 1900; + var month = leadingPad(dte.getMonth() + 1); + var day = leadingPad(dte.getDate()); + var hrs = leadingPad(dte.getHours()); + var mns = leadingPad(dte.getMinutes()); + var secs = leadingPad(dte.getSeconds()); + return yr + "-" + month + "-" + day + " " + hrs + ":" + mns + ":" + secs; +} +exports.dateToYyyyMmDdHhMmSs = dateToYyyyMmDdHhMmSs; +nm.dateToYyyyMmDdHhMmSs = dateToYyyyMmDdHhMmSs; +/** + * Given a date return a string in the format YYYYmmdd_hh0000 + * @param {Date} dte the input date + * @returns {string} the formatted date string + */ +function dateToYyyyMmDdHh000(dte) { + var yr = dte.getYear() + 1900; + var month = leadingPad(dte.getMonth() + 1); + var day = leadingPad(dte.getDate()); + var hrs = leadingPad(dte.getHours()); + return "" + yr + month + day + "_" + hrs + "0000"; +} +exports.dateToYyyyMmDdHh000 = dateToYyyyMmDdHh000; +nm.dateToYyyyMmDdHh000 = dateToYyyyMmDdHh000; +//# sourceMappingURL=dateConvert.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/util/dateConvert.js.map b/dist/src-ts/util/dateConvert.js.map similarity index 100% rename from lib-ts/src-ts/util/dateConvert.js.map rename to dist/src-ts/util/dateConvert.js.map diff --git a/lib-ts/src-ts/util/formatString.d.ts b/dist/src-ts/util/formatString.d.ts similarity index 100% rename from lib-ts/src-ts/util/formatString.d.ts rename to dist/src-ts/util/formatString.d.ts diff --git a/lib-ts/src-ts/util/formatString.js b/dist/src-ts/util/formatString.js similarity index 100% rename from lib-ts/src-ts/util/formatString.js rename to dist/src-ts/util/formatString.js diff --git a/lib-ts/src-ts/util/formatString.js.map b/dist/src-ts/util/formatString.js.map similarity index 100% rename from lib-ts/src-ts/util/formatString.js.map rename to dist/src-ts/util/formatString.js.map diff --git a/lib-ts/src-ts/util/getUrlParams.d.ts b/dist/src-ts/util/getUrlParams.d.ts similarity index 100% rename from lib-ts/src-ts/util/getUrlParams.d.ts rename to dist/src-ts/util/getUrlParams.d.ts diff --git a/dist/src-ts/util/getUrlParams.js b/dist/src-ts/util/getUrlParams.js new file mode 100644 index 0000000000000000000000000000000000000000..2f33b54c73eaf89c886a73e050220f8317ee7995 --- /dev/null +++ b/dist/src-ts/util/getUrlParams.js @@ -0,0 +1,54 @@ +"use strict"; +/** + * Created by gavorhes on 6/23/2016. + */ +var provide_1 = require('./provide.d'); +var nm = provide_1.default('util'); +function isNumber(checkVal) { + var returnVal = parseFloat(checkVal); + return !isNaN(returnVal); +} +/** + * + * @returns {object} object representation of url params + */ +function getUrlParams() { + "use strict"; + var match; + var pl = /\+/g; // Regex for replacing addition symbol with a space + var search = /([^&=]+)=?([^&]*)/g; + var decode = function (s) { + return decodeURIComponent(s.replace(pl, " ")); + }; + var query = window.location.search.substring(1); + var urlParams = {}; + while (match = search.exec(query)) { + /** + * @type {string} + */ + var val = decode(match[2]).trim(); + var typedVal = null; + if (val.length == 0) { + } + else if (isNumber(val)) { + if (val.indexOf('.') > -1) { + typedVal = parseFloat(val); + } + else { + typedVal = parseInt(val); + } + } + else if (val.toLowerCase() == 'false' || val.toLowerCase() == 'true') { + typedVal = val.toLowerCase() == 'true'; + } + else { + typedVal = val; + } + urlParams[decode(match[1])] = typedVal; + } + return urlParams; +} +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = getUrlParams; +nm.getUrlParams = getUrlParams; +//# sourceMappingURL=getUrlParams.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/util/getUrlParams.js.map b/dist/src-ts/util/getUrlParams.js.map similarity index 100% rename from lib-ts/src-ts/util/getUrlParams.js.map rename to dist/src-ts/util/getUrlParams.js.map diff --git a/lib-ts/src-ts/util/makeGuid.d.ts b/dist/src-ts/util/makeGuid.d.ts similarity index 100% rename from lib-ts/src-ts/util/makeGuid.d.ts rename to dist/src-ts/util/makeGuid.d.ts diff --git a/dist/src-ts/util/makeGuid.js b/dist/src-ts/util/makeGuid.js new file mode 100644 index 0000000000000000000000000000000000000000..275c890fb44e0cd4ae46f1b0adc80120b00827ff --- /dev/null +++ b/dist/src-ts/util/makeGuid.js @@ -0,0 +1,21 @@ +/** + * Created by gavorhes on 11/3/2015. + */ +"use strict"; +var provide_1 = require('./provide.d'); +var nm = provide_1.default('util'); +/** + * guids are used to uniquely identify groups and features + * @returns {string} a new guid + */ +function makeGuid() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' + .replace(/[xy]/g, function (c) { + var r = Math.random() * 16 | 0, v = c == 'x' ? r : r & 0x3 | 0x8; + return v.toString(16); + }); +} +nm.makeGuid = makeGuid; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = makeGuid; +//# sourceMappingURL=makeGuid.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/util/makeGuid.js.map b/dist/src-ts/util/makeGuid.js.map similarity index 100% rename from lib-ts/src-ts/util/makeGuid.js.map rename to dist/src-ts/util/makeGuid.js.map diff --git a/lib-ts/src-ts/util/objectHelpers.d.ts b/dist/src-ts/util/objectHelpers.d.ts similarity index 100% rename from lib-ts/src-ts/util/objectHelpers.d.ts rename to dist/src-ts/util/objectHelpers.d.ts diff --git a/dist/src-ts/util/objectHelpers.js b/dist/src-ts/util/objectHelpers.js new file mode 100644 index 0000000000000000000000000000000000000000..a174689aba9ae812c32e4be9df68dfc313228f75 --- /dev/null +++ b/dist/src-ts/util/objectHelpers.js @@ -0,0 +1,31 @@ +/** + * Created by gavorhes on 6/7/2016. + */ +"use strict"; +var provide_1 = require('./provide.d'); +var nm = provide_1.default('util'); +/** + * @typedef {object} keyValuePair + * @property {string} key + * @property {object} value + */ +/** + * iterate over the key value pairs of an object + * @param {object} obj - the input object + * @returns {Array<keyValuePair>} - array of key value pairs + */ +function keyValPairs(obj) { + var outArray = []; + for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) { + var key = _a[_i]; + outArray.push({ 'key': key, 'value': obj[key] }); + } + outArray.sort(function (a, b) { + "use strict"; + return a > b ? 1 : -1; + }); + return outArray; +} +exports.keyValPairs = keyValPairs; +nm.keyValPairs = keyValPairs; +//# sourceMappingURL=objectHelpers.js.map \ No newline at end of file diff --git a/lib-ts/src-ts/util/objectHelpers.js.map b/dist/src-ts/util/objectHelpers.js.map similarity index 100% rename from lib-ts/src-ts/util/objectHelpers.js.map rename to dist/src-ts/util/objectHelpers.js.map diff --git a/lib-ts/src-ts/util/provide.d.ts b/dist/src-ts/util/provide.d.ts similarity index 100% rename from lib-ts/src-ts/util/provide.d.ts rename to dist/src-ts/util/provide.d.ts diff --git a/lib-ts/src-ts/util/provide.js b/dist/src-ts/util/provide.js similarity index 100% rename from lib-ts/src-ts/util/provide.js rename to dist/src-ts/util/provide.js diff --git a/lib-ts/src-ts/util/provide.js.map b/dist/src-ts/util/provide.js.map similarity index 100% rename from lib-ts/src-ts/util/provide.js.map rename to dist/src-ts/util/provide.js.map diff --git a/dist/src/index.d.ts b/dist/src/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib-ts/src/index.js b/dist/src/index.js similarity index 100% rename from lib-ts/src/index.js rename to dist/src/index.js diff --git a/lib-ts/src/index.js.map b/dist/src/index.js.map similarity index 100% rename from lib-ts/src/index.js.map rename to dist/src/index.js.map diff --git a/dist/util/_index.d.ts b/dist/util/_index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3bf6130661c7defd310cdb28d6a5ec14b5a80e19 --- /dev/null +++ b/dist/util/_index.d.ts @@ -0,0 +1,8 @@ +/** + * Created by gavorhes on 9/22/2016. + */ +import * as checkDefinedf from './checkDefined'; +export declare namespace checkDefined { + const undefinedOrNull: typeof checkDefinedf.undefinedOrNull; + const definedAndNotNull: typeof checkDefinedf.definedAndNotNull; +} diff --git a/dist/util/_index.js b/dist/util/_index.js new file mode 100644 index 0000000000000000000000000000000000000000..893b790fb79ff3ea1cf0af84fc5ac77d739b0374 --- /dev/null +++ b/dist/util/_index.js @@ -0,0 +1,11 @@ +/** + * Created by gavorhes on 9/22/2016. + */ +"use strict"; +var checkDefinedf = require('./checkDefined'); +var checkDefined; +(function (checkDefined) { + checkDefined.undefinedOrNull = checkDefinedf.undefinedOrNull; + checkDefined.definedAndNotNull = checkDefinedf.definedAndNotNull; +})(checkDefined = exports.checkDefined || (exports.checkDefined = {})); +//# sourceMappingURL=_index.js.map \ No newline at end of file diff --git a/dist/util/_index.js.map b/dist/util/_index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..aeec6565ea72020fde00374a8c37d9b0d9cf285a --- /dev/null +++ b/dist/util/_index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_index.js","sourceRoot":"","sources":["../../src-ts/util/_index.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,IAAY,aAAa,WAAM,gBAAgB,CAAC,CAAA;AAGhD,IAAiB,YAAY,CAG5B;AAHD,WAAiB,YAAY,EAAC,CAAC;IACd,4BAAe,GAAG,aAAa,CAAC,eAAe,CAAC;IAChD,8BAAiB,GAAG,aAAa,CAAC,iBAAiB,CAAC;AACrE,CAAC,EAHgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAG5B"} \ No newline at end of file diff --git a/dist/util/checkDefined.d.ts b/dist/util/checkDefined.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c116a08d41d227ff03a6b8a7396548d785f95f21 --- /dev/null +++ b/dist/util/checkDefined.d.ts @@ -0,0 +1,12 @@ +/** + * check if the input is undefined or null + * @param input - input pointer + * @returns true undefined or null + */ +export declare function undefinedOrNull(input: any): boolean; +/** + * check if the input is defined and not null + * @param input - input pointer + * @returns true defined and not null + */ +export declare function definedAndNotNull(input: any): boolean; diff --git a/lib-ts/src-ts/util/checkDefined.js b/dist/util/checkDefined.js similarity index 100% rename from lib-ts/src-ts/util/checkDefined.js rename to dist/util/checkDefined.js diff --git a/dist/util/checkDefined.js.map b/dist/util/checkDefined.js.map new file mode 100644 index 0000000000000000000000000000000000000000..114ab5ecbe44301e2deacc85ecb1c0eb57036eee --- /dev/null +++ b/dist/util/checkDefined.js.map @@ -0,0 +1 @@ +{"version":3,"file":"checkDefined.js","sourceRoot":"","sources":["../../src-ts/util/checkDefined.ts"],"names":[],"mappings":";AAAA,wBAAoB,WAAW,CAAC,CAAA;AAChC,IAAI,EAAE,GAAG,iBAAO,CAAC,mBAAmB,CAAC,CAAC;AAEtC;;;;GAIG;AACH,yBAAiC,KAAK;IAClC,YAAY,CAAC;IAEb,MAAM,CAAC,CAAC,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC;AAC5D,CAAC;AAJe,uBAAe,kBAI9B,CAAA;AAED,EAAE,CAAC,eAAe,GAAG,eAAe,CAAC;AAGrC;;;;GAIG;AACH,2BAAmC,KAAU;IACzC,YAAY,CAAC;IAEb,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;AACrC,CAAC;AAJe,yBAAiB,oBAIhC,CAAA;AAED,EAAE,CAAC,iBAAiB,GAAG,iBAAiB,CAAC"} \ No newline at end of file diff --git a/dist/util/colors.d.ts b/dist/util/colors.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3de4c8d86dc7eb0b44ae12dad0485d4711eaaa93 --- /dev/null +++ b/dist/util/colors.d.ts @@ -0,0 +1,41 @@ +/** + * converts an RGB string to hex + * @param {string} rgb - rgb color + * @returns {string} rbg as hex + */ +export declare function rgb2hex(rgb: any): string; +/** + * Convert hex string to RGB or RGBA string + * @param {string} hexString - hex color string + * @param {number} [alphaVal=undefined] Alpha value + * @returns {string} - rgb or rgba color + */ +export declare function hexAlphaToRgbOrRgba(hexString: any, alphaVal: any): string; +/** + * adds alpha value to rgb string 'rgb(r, b, g)', returns 'rgba(r, g, b, a)' + * @param {string} rgb - rgb color + * @param {number} alpha - alpha value 0 to 1 + * @returns {string} rgba color + */ +export declare function rgbToRgba(rgb: any, alpha: any): any; +/** + * @typedef {function} colorLookupByNumber + * @param {number} num - the number to use to retrieve the color + * @returns {string} rgb color + */ +/** + * Make a blue green red gradient + * @param {number} minVal - minimum value + * @param {number} maxVal - maximum value + * @param {boolean} flipColors - if the colors should be flipped + * @returns {colorLookupByNumber} color lookup function + */ +export declare function makeBlueGreenRedGradient(minVal: any, maxVal: any, flipColors: any): (theVal: any) => string; +/** + * Create a function that will return colors based on a gradient + * @param {number} median - median value + * @param {number} stdDev - standard deviation + * @param {boolean} flipColors - if the colors should be flipped + * @returns {colorLookupByNumber} color lookup function + */ +export declare function makeBlueGreenRedGradientZScore(median: any, stdDev: any, flipColors: any): (theVal: any) => string; diff --git a/lib-ts/src-ts/util/colors.js b/dist/util/colors.js similarity index 100% rename from lib-ts/src-ts/util/colors.js rename to dist/util/colors.js diff --git a/dist/util/colors.js.map b/dist/util/colors.js.map new file mode 100644 index 0000000000000000000000000000000000000000..18626711373a78dfb753d3dadf2e583eb46bb9b9 --- /dev/null +++ b/dist/util/colors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src-ts/util/colors.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,wBAAoB,WAAW,CAAC,CAAA;AAChC,IAAY,GAAG,WAAM,gBAAgB,CAAC,CAAA;AACtC,IAAI,EAAE,GAAG,iBAAO,CAAC,aAAa,CAAC,CAAC;AAGhC;;;;;GAKG;AACH,cAAc,CAAC;IACX,IAAI,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAEjG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED;;;;GAIG;AACH,iBAAwB,GAAG;IACvB,IAAI,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAEzD,MAAM,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAC/E,CAAC;AAJe,eAAO,UAItB,CAAA;AAED,EAAE,CA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AG,CAAC,CAAC,OAAO,EAAE,CAAC;QAChB,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;QAEhB,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IAChD,CAAC,CAAC;AACN,CAAC;AA3De,gCAAwB,2BA2DvC,CAAA;AAED,EAAE,CAAC,wBAAwB,GAAG,wBAAwB,CAAC;AAGvD;;;;;;GAMG;AACH,wCAA+C,MAAM,EAAE,MAAM,EAAE,UAAU;IAErE,IAAI,GAAG,GAAG,wBAAwB,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;IAE1D,MAAM,CAAC,UAAU,MAAM;QAEnB,IAAI,MAAM,CAAC;QACX,EAAE,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC;YACjB,MAAM,GAAG,IAAI,CAAC;QAClB,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;QACxC,CAAC;QAED,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC;AACN,CAAC;AAfe,sCAA8B,iCAe7C,CAAA;AAED,EAAE,CAAC,8BAA8B,GAAG,8BAA8B,CAAC"} \ No newline at end of file diff --git a/dist/util/dateConvert.d.ts b/dist/util/dateConvert.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..db0945b62f1efe2e779b36be46b892db027aa31d --- /dev/null +++ b/dist/util/dateConvert.d.ts @@ -0,0 +1,12 @@ +/** + * Given a date return a string in the format YYYY-mm-dd hh:MM:SS + * @param {Date} dte to convert + * @returns {string} the formatted date string + */ +export declare function dateToYyyyMmDdHhMmSs(dte: any): string; +/** + * Given a date return a string in the format YYYYmmdd_hh0000 + * @param {Date} dte the input date + * @returns {string} the formatted date string + */ +export declare function dateToYyyyMmDdHh000(dte: any): string; diff --git a/lib-ts/src-ts/util/dateConvert.js b/dist/util/dateConvert.js similarity index 100% rename from lib-ts/src-ts/util/dateConvert.js rename to dist/util/dateConvert.js diff --git a/dist/util/dateConvert.js.map b/dist/util/dateConvert.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8c56fe69b8925d180b17bfb3b2d385d0715f3cdf --- /dev/null +++ b/dist/util/dateConvert.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dateConvert.js","sourceRoot":"","sources":["../../src-ts/util/dateConvert.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,wBAAoB,WAAW,CAAC,CAAA;AAChC,IAAI,EAAE,GAAG,iBAAO,CAAC,kBAAkB,CAAC,CAAC;AAErC,oBAAoB,KAAK;IACrB,IAAI,MAAM,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;IAC7B,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;QACpB,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,MAAM,CAAC;AAClB,CAAC;AAED,EAAE,CAAC,UAAU,GAAG,UAAU,CAAC;AAE3B;;;;GAIG;AACH,8BAAqC,GAAG;IACpC,IAAI,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IAC9B,IAAI,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IAC3C,IAAI,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IACpC,IAAI,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrC,IAAI,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;IACvC,IAAI,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;IAExC,MAAM,CAAI,EAAE,SAAI,KAAK,SAAI,GAAG,SAAI,GAAG,SAAI,GAAG,SAAI,IAAM,CAAC;AACzD,CAAC;AATe,4BAAoB,uBASnC,CAAA;AAED,EAAE,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;AAG/C;;;;GAIG;AACH,6BAAoC,GAAG;IACnC,IAAI,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IAC9B,IAAI,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IAC3C,IAAI,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IACpC,IAAI,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAErC,MAAM,CAAC,KAAG,EAAE,GAAG,KAAK,GAAG,GAAG,SAAI,GAAG,SAAM,CAAC;AAC5C,CAAC;AAPe,2BAAmB,sBAOlC,CAAA;AAED,EAAE,CAAC,mBAAmB,GAAG,mBAAmB,CAAC"} \ No newline at end of file diff --git a/dist/util/formatString.d.ts b/dist/util/formatString.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f237ddf58ed4ffa78778ce7f9339b647c177a932 --- /dev/null +++ b/dist/util/formatString.d.ts @@ -0,0 +1 @@ +export default undefined; diff --git a/dist/util/formatString.js b/dist/util/formatString.js new file mode 100644 index 0000000000000000000000000000000000000000..99348cd1ff24d51cf9999698492a5b0d9dd1edc3 --- /dev/null +++ b/dist/util/formatString.js @@ -0,0 +1,37 @@ +/** + * Created by gavorhes on 10/30/2015. + */ +"use strict"; +if (!String.prototype['format']) { + /** + * helper function for string replacement to keep code clean + * usage + * var aString = 'some{0}stuff{1}replaced'; + * var c = 'cat'; + * var b = 'bird'; + * aString.format(c, b) returns 'somecatstuffbirdreplaced' + * prettier than + * 'some' + c + 'stuff' + b + 'replaced' + * but same effect + * adapted to take a single array that is used for replacement by position ie + * var arrReplacements = [c, b]; + * aString.format(arrReplacements) + * @returns {string} converted string + */ + String.prototype['format'] = function () { + var args = arguments; + for (var i = 0; i < args.length; i++) { + args[i] = (args[i] !== null ? args[i] : ''); + } + //if the first argument is an array, use that + if (args[0].constructor == Array) { + args = args[0]; + } + return this.replace(/{(\d+)}/g, function (match, number) { + return typeof args[number] != 'undefined' ? args[number] : match; + }); + }; +} +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = undefined; +//# sourceMappingURL=formatString.js.map \ No newline at end of file diff --git a/dist/util/formatString.js.map b/dist/util/formatString.js.map new file mode 100644 index 0000000000000000000000000000000000000000..fc80f573d5f65c361e43082b4b789d8355ef8a2e --- /dev/null +++ b/dist/util/formatString.js.map @@ -0,0 +1 @@ +{"version":3,"file":"formatString.js","sourceRoot":"","sources":["../../src-ts/util/formatString.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC9B;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG;QACzB,IAAI,IAAI,GAAG,SAAS,CAAC;QACrB,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACnC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QAChD,CAAC;QAED,6CAA6C;QAC7C,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,KAAK,CAAC,CAAC,CAAC;YAC/B,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,UAAU,KAAK,EAAE,MAAM;YACnD,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;QACrE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;AACN,CAAC;AAED;kBAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/dist/util/getUrlParams.d.ts b/dist/util/getUrlParams.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a3e477e654e9c4723ba3c599e1b74c38a83c2919 --- /dev/null +++ b/dist/util/getUrlParams.d.ts @@ -0,0 +1,5 @@ +/** + * + * @returns {object} object representation of url params + */ +export default function getUrlParams(): {}; diff --git a/lib-ts/src-ts/util/getUrlParams.js b/dist/util/getUrlParams.js similarity index 100% rename from lib-ts/src-ts/util/getUrlParams.js rename to dist/util/getUrlParams.js diff --git a/dist/util/getUrlParams.js.map b/dist/util/getUrlParams.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3529a6095371ba17a0dd7ceafc7d73b192d35abe --- /dev/null +++ b/dist/util/getUrlParams.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getUrlParams.js","sourceRoot":"","sources":["../../src-ts/util/getUrlParams.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,wBAAoB,WAAW,CAAC,CAAA;AAChC,IAAI,EAAE,GAAG,iBAAO,CAAC,MAAM,CAAC,CAAC;AAGzB,kBAAkB,QAAa;IAC3B,IAAI,SAAS,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAErC,MAAM,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC7B,CAAC;AAED;;;GAGG;AACH;IACI,YAAY,CAAC;IAEb,IAAI,KAAK,CAAC;IACV,IAAI,EAAE,GAAG,KAAK,CAAC,CAAE,mDAAmD;IACpE,IAAI,MAAM,GAAG,oBAAoB,CAAC;IAClC,IAAI,MAAM,GAAG,UAAU,CAAC;QACpB,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,EAA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AuCC,CAAA;AAED,EAAE,CAAC,YAAY,GAAG,YAAY,CAAC"} \ No newline at end of file diff --git a/dist/util/makeGuid.d.ts b/dist/util/makeGuid.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2e1fc4f9a9e595e68224e3cdbac0a5c04ccb9246 --- /dev/null +++ b/dist/util/makeGuid.d.ts @@ -0,0 +1,6 @@ +/** + * guids are used to uniquely identify groups and features + * @returns {string} a new guid + */ +declare function makeGuid(): string; +export default makeGuid; diff --git a/lib-ts/src-ts/util/makeGuid.js b/dist/util/makeGuid.js similarity index 100% rename from lib-ts/src-ts/util/makeGuid.js rename to dist/util/makeGuid.js diff --git a/dist/util/makeGuid.js.map b/dist/util/makeGuid.js.map new file mode 100644 index 0000000000000000000000000000000000000000..bc6cedb2e66ca2ec532bb8266877769a62a766b2 --- /dev/null +++ b/dist/util/makeGuid.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeGuid.js","sourceRoot":"","sources":["../../src-ts/util/makeGuid.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,wBAAoB,WAAW,CAAC,CAAA;AAChC,IAAI,EAAE,GAAG,iBAAO,CAAC,MAAM,CAAC,CAAC;AAGzB;;;GAGG;AACH;IACQ,MAAM,CAAC,sCAAsC;SACxC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC;QACzB,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;QAEjE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AAEf,CAAC;AACD,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACvB;kBAAe,QAAQ,CAAC"} \ No newline at end of file diff --git a/dist/util/objectHelpers.d.ts b/dist/util/objectHelpers.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..105f0be6571492f60c1a28771cbc04984e40ebd9 --- /dev/null +++ b/dist/util/objectHelpers.d.ts @@ -0,0 +1,11 @@ +/** + * @typedef {object} keyValuePair + * @property {string} key + * @property {object} value + */ +/** + * iterate over the key value pairs of an object + * @param {object} obj - the input object + * @returns {Array<keyValuePair>} - array of key value pairs + */ +export declare function keyValPairs(obj: any): any[]; diff --git a/lib-ts/src-ts/util/objectHelpers.js b/dist/util/objectHelpers.js similarity index 100% rename from lib-ts/src-ts/util/objectHelpers.js rename to dist/util/objectHelpers.js diff --git a/dist/util/objectHelpers.js.map b/dist/util/objectHelpers.js.map new file mode 100644 index 0000000000000000000000000000000000000000..80d4e87a7e45ef838f11058f1b5eb1e293037ec7 --- /dev/null +++ b/dist/util/objectHelpers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"objectHelpers.js","sourceRoot":"","sources":["../../src-ts/util/objectHelpers.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,wBAAoB,WAAW,CAAC,CAAA;AAChC,IAAI,EAAE,GAAG,iBAAO,CAAC,MAAM,CAAC,CAAC;AAEzB;;;;GAIG;AAGH;;;;GAIG;AACH,qBAA4B,GAAG;IAC3B,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,GAAG,CAAC,CAAY,UAAgB,EAAhB,KAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAhB,cAAgB,EAAhB,IAAgB,CAAC;QAA5B,IAAI,GAAG,SAAA;QACR,QAAQ,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,EAAC,CAAC,CAAC;KAElD;IACD,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACxB,YAAY,CAAC;QAEb,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,QAAQ,CAAC;AACpB,CAAC;AAbe,mBAAW,cAa1B,CAAA;AAED,EAAE,CAAC,WAAW,GAAG,WAAW,CAAC"} \ No newline at end of file diff --git a/dist/util/provide.d.ts b/dist/util/provide.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d38ea8bd7e85a40c2e857d7eaaf665086bfaf5df --- /dev/null +++ b/dist/util/provide.d.ts @@ -0,0 +1,10 @@ +/** + * Created by gavorhes on 12/10/2015. + */ +/** + * create a namespace on the gv object + * @param {string} namespace to create + * @returns {object} object representing the namespace + */ +declare function provide(namespace: any): any; +export default provide; diff --git a/dist/util/provide.js b/dist/util/provide.js new file mode 100644 index 0000000000000000000000000000000000000000..165a6832be1ff71448e5c3cdb24add87a2791c9e --- /dev/null +++ b/dist/util/provide.js @@ -0,0 +1,30 @@ +/** + * Created by gavorhes on 12/10/2015. + */ +"use strict"; +/** + * create a namespace on the gv object + * @param {string} namespace to create + * @returns {object} object representing the namespace + */ +function provide(namespace) { + "use strict"; + if (typeof window['gv'] == 'undefined') { + window['gv'] = {}; + } + var parts = namespace.split('.'); + var nameSpace = window['gv']; + for (var i = 0; i < parts.length; i++) { + var newObject = nameSpace[parts[i]]; + if (typeof newObject == 'undefined') { + nameSpace[parts[i]] = {}; + } + nameSpace = nameSpace[parts[i]]; + } + return nameSpace; +} +provide('util'); +window['gv'].util.provide = provide; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = provide; +//# sourceMappingURL=provide.js.map \ No newline at end of file diff --git a/dist/util/provide.js.map b/dist/util/provide.js.map new file mode 100644 index 0000000000000000000000000000000000000000..578fe6bf34c9da087ca9fa56b8e60b8dd8b00a1e --- /dev/null +++ b/dist/util/provide.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provide.js","sourceRoot":"","sources":["../../src-ts/util/provide.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAGH;;;;GAIG;AACH,iBAAiB,SAAS;IACtB,YAAY,CAAC;IACb,EAAE,CAAC,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,CAAA,CAAC;QACpC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;IACtB,CAAC;IAED,IAAI,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAE7B,GAAG,CAAC,CAAC,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAE,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAC,CAAC;QAChC,IAAI,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAEpC,EAAE,CAAC,CAAC,OAAO,SAAS,IAAI,WAAW,CAAC,CAAA,CAAC;YACjC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;QAC7B,CAAC;QAED,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,SAAS,CAAC;AACrB,CAAC;AAED,OAAO,CAAC,MAAM,CAAC,CAAC;AAChB,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AAEpC;kBAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index e39cffc95e5a3f6f98553e12e19b3c8e0d3b4ad1..eec2d6d0a518d695f13cc6a15b3f06e6c882caa3 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Openlayers helpers", "main": "lib/index.js", "files": [ - "lib-ts", + "dist", "lib", "doc", "src", diff --git a/tsconfig.json b/tsconfig.json index 5b8e4877ba3325098278484235ff8ea34da8b370..9268520e5418ad27af96b6826920e9665efd13bd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,11 +4,11 @@ "compilerOptions": { "module": "commonjs", "declaration": true, - "outDir": "lib-ts", + "outDir": "dist", "target": "es5", "rootDir": "src-ts", "sourceMap": true, "jsx": "react" }, - "exclude": ["node_modules", "ts-lib", "lib-ts", "definitions"] + "exclude": ["node_modules", "ts-lib", "lib-ts", "definitions", "dist"] } \ No newline at end of file diff --git a/typings.json b/typings.json new file mode 100644 index 0000000000000000000000000000000000000000..6825e1e0b293c480f5d5be3830089a91ec1d2867 --- /dev/null +++ b/typings.json @@ -0,0 +1,10 @@ +{ + "name": "webmapsjs", + "dependencies": {}, + "globalDependencies": { + "react": "registry:dt/react#0.14.0+20160920055104" + }, + "globalDevDependencies": { + "react": "registry:dt/react#0.14.0+20160920055104" + } +} diff --git a/webpack.config.js b/webpack.config.js index d98358bfcd8f33bb858d165bc3360d0a82a6b9e6..f2359fa56f443556ea4555f7ac969a0a76d2854a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,30 +3,18 @@ const path = require('path'); const webpack = require('webpack'); const fs = require('fs'); -const testAppDir = path.join(__dirname, 'lib-ts/_test'); +const testAppDir = path.join(__dirname, 'dist/_test'); const files = fs.readdirSync(testAppDir); const entries = {}; -const exportItems = []; - for (let e of files) { if (e.match(/\.js$/) == null) { continue; } - entries[e.replace(/.js/, '')] = path.join(testAppDir, e); - - exportItems.push({ - entry: path.join(testAppDir, e), - devtool: 'source-map', - output: { - path: path.join(__dirname, 'test-html', 'test_build'), - filename: e - } - }); } -let otherConfig = { +module.exports = { entry: entries, devtool: 'source-map', output: { @@ -41,109 +29,5 @@ let otherConfig = { externals: { "react": "React", "react-dom": "ReactDOM" - }, + } }; - - -// module.exports = exportItems; -module.exports = otherConfig; - - -// -// var fileArray = [ -// 'api/new_file.js', -// 'api/npmrds-request.js' -// ]; -// -// for (var i = 0; i < fileArray.length; i++) { -// fileArray[i] = './' + jsRoot + '/' + fileArray[i]; -// } -// -// console.log(fileArray); -// -// /** -// * -// * @param {string} entry -// * @returns {{entry: string, devtool: string, output: {path: string, filename: string}, module: {loaders: *[]}}} -// */ -// function makeConfig(entry) { -// "use strict"; -// -// var fileName = path.basename(entry); -// var directoryParts = path.dirname(entry).split('/'); -// directoryParts = directoryParts.splice(directoryParts.indexOf(jsRoot) + 1); -// -// var directoryPath = './flaskApp/static/js/' + directoryParts.join('/'); -// -// return { -// entry: entry, -// devtool: 'source-map', -// // output: { path: __dirname, filename: 'bundle.js' }, -// output: {path: directoryPath, filename: fileName}, -// module: { -// loaders: [ -// { -// test: /.jsx?$/, -// loader: 'babel-loader', -// // include: /webmapsjs/ -// exclude: /dist/ -// // , -// // ignore: ['jquery.js'], -// // // exclude: /node_modules/, -// // query: { -// // // presets: ['es2015', 'react'] -// // presets: ['es2015'] -// // } -// } -// ] -// }, -// }; -// } -// -// var exportArray = []; -// -// for (i = 0; i < fileArray.length; i++){ -// exportArray.push(makeConfig(fileArray[i])) -// } -// -// module.exports = exportArray; -// console.log('here'); -// -// module.exports = [{ -// entry: './app_code_js/api/npmrds-request.js', -// devtool: 'source-map', -// // output: { path: __dirname, filename: 'bundle.js' }, -// output: {path: '.', filename: 'bundle.js'}, -// module: { -// loaders: [ -// { -// test: /.jsx?$/, -// loader: 'babel-loader', -// exclude: /node_modules/, -// query: { -// // presets: ['es2015', 'react'] -// presets: ['es2015'] -// } -// } -// ] -// }, -// }, -// { -// entry: './app_code_js/api/new_file.js', -// devtool: 'source-map', -// // output: { path: __dirname, filename: 'bundle.js' }, -// output: {path: '.', filename: 'bundle2.js'}, -// module: { -// loaders: [ -// { -// test: /.jsx?$/, -// loader: 'babel-loader', -// exclude: /node_modules/, -// query: { -// // presets: ['es2015', 'react'] -// presets: ['es2015'] -// } -// } -// ] -// }, -// }]; \ No newline at end of file