diff --git a/gulpfile.js b/gulpfile.js index 8ba80e870929c0a1c86423c4b8b95f2c0f6c185c..786a67cd5284f8b698c9a675c635ccea70f6f61f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,3 +1,4 @@ +"use strict"; const gulp = require('gulp'); const babel = require('gulp-babel'); const babelify = require('babelify'); @@ -9,78 +10,104 @@ const minify = require('gulp-minify'); const less = require('gulp-less'); const cssmin = require('gulp-cssmin'); const rename = require('gulp-rename'); +const glob = require('glob'); +const watchify = require('watchify'); +const gutil = require('gulp-util'); /** - * - * @param {string} inputFile - input file - * @param {string} outputFile - output file - * @param {boolean|*} runMinify - if should minify - * @returns {object} return stream + * @typedef {object} dirNameFilePath + * @property {string} dirName - directory name + * @property {string} fileName - file name */ -function processJsFile(inputFile, outputFile, runMinify) { - "use strict"; - runMinify = typeof runMinify == 'boolean' ? runMinify : false; + +/** + * get directory and file name from output path + * @param {string} outputFile - output file path + * @returns {dirNameFilePath} file directory and path + * @private + */ +function _processOutDir(outputFile) { let pathParts = outputFile.split('/'); let outFileName = pathParts[pathParts.length - 1]; pathParts.splice(pathParts.length - 1, 1); let outDir = pathParts.length === 0 ? '.' : pathParts.join('/'); - let bundler = browserify({entries: inputFile, "debug": true, "extensions": ["js"]}); + return {dirName: outDir, fileName: outFileName}; +} - bundler.transform(babelify.configure({ - presets: ["es2015"], - "ignore": /custom-ol-build|jquery.min/ - })); +/** + * + * @param {string|null} inputFile - input file set to null to bundle everything in 'test' directory + * @param {dirNameFilePath|string} outFile - output file as string or path object + * @param {boolean} [production=false] if production, minify and don't watch + * @returns {*} the stream + * @private + */ +function _bundleIt(inputFile, outFile, production) { + if (typeof outFile == 'string') { + outFile = _processOutDir(outFile); + } + production = typeof production == 'boolean' ? production : false; - //bundler.transform(babelify.configure({ - // ignore: /custom-ol-build|jquery.min/ - //})); - //let bundler = browserify({entries: inputFile, extensions: ['.js'], debug: true}) - // .transform(babelify.configure({ - // ignore: /custom-ol-build.js|jquery.min|/, - // presets: ["es2015"], - // extensions: [".ts", ".js"] - // })); + if (inputFile == null){ + inputFile = glob.sync('./spec/**/*.js'); + } + let bundler = browserify( + { + entries: [inputFile], + cache: {}, + packageCache: {}, + debug: true + } + ); - //bundler.transform("babelify", {presets: ["es2015"], ignore: /custom-ol-build.js|jquery.min|/}, extensions: ['.js', '.ts']); + bundler.transform(babelify.configure({ + presets: ["es2015"], + ignore: /ol.js|jquery.min/ + })); + if (!production) { + bundler = watchify(bundler); + } - if (runMinify) { - return bundler.bundle() + function runBundle() { + let stream = bundler.bundle() .on('error', function (err) { console.error(err); }) - .pipe(source(outFileName)) + .pipe(source(outFile.fileName)) .pipe(buffer()) - .pipe(sourcemaps.init({loadMaps: true})) - .pipe(minify({ + .pipe(sourcemaps.init({loadMaps: true})); + + if (production) { + stream = stream.pipe(minify({ ext: { src: '-debug.js', min: '.js' }, exclude: ['tasks'], ignoreFiles: ['.combo.js', '-min.js'] - })) - .pipe(sourcemaps.write('./')) - .pipe(gulp.dest(outDir)); - } else { - return bundler.bundle() - .on('error', function (err) { - console.error(err); - }) - .pipe(source(outFileName)) - .pipe(buffer()) - .pipe(sourcemaps.init({loadMaps: true})) - .pipe(sourcemaps.write('./')) - .pipe(gulp.dest(outDir)); + })); + } + + return stream.pipe(sourcemaps.write('./')).pipe(gulp.dest(outFile.dirName)); + } + + if (!production) { + bundler.on('update', runBundle); + bundler.on('log', gutil.log); } + + return runBundle(); } + function processLessFile(inputFile, outputFile) { "use strict"; + let pathParts = outputFile.split('/'); let outFileName = pathParts[pathParts.length - 1]; pathParts.splice(pathParts.length - 1, 1); @@ -103,115 +130,95 @@ function processLessFile(inputFile, outputFile) { .pipe(gulp.dest(outDir)); } -//gulp.task('default', function () { -// "use strict"; -// return gulp.src('src/app.js') -// .pipe(babel()) -// .pipe(gulp.dest('dist')) -//}); - -function _itsInventory(doMinify) { +function _itsInventory(production) { "use strict"; //processLessFile('./flaskApp/blueprints/its_inventory/static/css/itsMap.less', './flaskApp/blueprints/its_inventory/static/_build/itsMap.css'); - return processJsFile('./projects/itsMap.js', './build/itsMap.js', doMinify); + return _bundleIt('./projects/itsMap.js', './build/itsMap.js', production); } -gulp.task('itsInventory-dev', () => { - return _itsInventory(false); -}); - -gulp.task('itsInventory-prod', () => { - return _itsInventory(true); -}); - -function _glrtoc(doMinify) { +function _glrtoc(production) { "use strict"; - processJsFile('./projects/glrtoc/main.js', './build/glrtoc/main.js', doMinify); + _bundleIt('./projects/glrtoc/legendTest.js', './build/glrtoc/legendTest.js', production); + + return _bundleIt('./projects/glrtoc/main.js', './build/glrtoc/main.js', production); - return processJsFile('./projects/glrtoc/legendTest.js', './build/glrtoc/legendTest.js', doMinify); } -gulp.task('glrtoc-dev', () => { - "use strict"; - return _glrtoc(false); -}); - -gulp.task('glrtoc-prod', () => { +function _tsmo(production) { "use strict"; + _bundleIt('./projects/tsmo/legend-test.js', './build/tsmo/legend-test.js', production); + _bundleIt('./projects/tsmo/slider-test.js', './build/tsmo/slider-test.js', production); + _bundleIt('./projects/tsmo/main.js', './build/tsmo/main.js', production); - return _glrtoc(true); -}); - -function _tsmo(doMinify) { - "use strict"; - processJsFile('./projects/tsmo/legend-test.js', './build/legend-test.js', doMinify); - //processJsFile('./projects/tsmo/slider-test.js', './build/slider-test.js', doMinify); - //processJsFile('./projects/tsmo/main.js', './build/main.js', doMinify); - //return processJsFile('./projects/tsmo/main-report.js', './build/main-report.js', doMinify); + return _bundleIt('./projects/tsmo/main-report.js', './build/tsmo/main-report.js', production); } -gulp.task('tsmo-dev', () => { - "use strict"; - - return _tsmo(false); -}); -gulp.task('tsmo-prod', () => { +gulp.task('build-tests', function () { "use strict"; - return _tsmo(true); + return _bundleIt(null, './test/test-bundle.js'); }); -function _npmrds(doMinify) { - "use strict"; - - return processJsFile('./flaskApp/blueprints/npmrds/static/js/heatmap/main.js', './flaskApp/blueprints/npmrds/static/_build/heatmap-main.js', doMinify); -} +gulp.task('itsInventory', () => { + return _itsInventory(false); +}); -gulp.task('npmrds-dev', () => { +gulp.task('glrtoc', () => { "use strict"; - return _npmrds(false); + return _glrtoc(false); }); -gulp.task('npmrds-prod', () => { + +gulp.task('tsmo', () => { "use strict"; - return _npmrds(true); + return _tsmo(false); }); -function _ssa(doMinify) { +// +// function _npmrds(doMinify) { +// "use strict"; +// +// return processJsFile('./flaskApp/blueprints/npmrds/static/js/heatmap/main.js', './flaskApp/blueprints/npmrds/static/_build/heatmap-main.js', doMinify); +// } +// +// gulp.task('npmrds-dev', () => { +// "use strict"; +// +// return _npmrds(false); +// }); +// +// gulp.task('npmrds-prod', () => { +// "use strict"; +// +// return _npmrds(true); +// }); + + +function _ssa(production) { "use strict"; processLessFile('./flaskApp/blueprints/testing/static/css/ssa-corridor.less', './flaskApp/blueprints/testing/static/_build/ssa-corridor.css'); - return processJsFile('./flaskApp/blueprints/testing/static/js/ssa-main.js', './flaskApp/blueprints/testing/static/_build/ssa-main.js', doMinify); + return _bundleIt('./flaskApp/blueprints/testing/static/js/ssa-main.js', './flaskApp/blueprints/testing/static/_build/ssa-main.js', production); } -gulp.task('ssa-dev', () => { +gulp.task('ssa', () => { "use strict"; return _ssa(false); }); -gulp.task('ssa-prod', () => { - "use strict"; - - return _ssa(true); -}); -gulp.task('peerGroup-dev', () => { +gulp.task('peerGroup', () => { "use strict"; return processJsFile('./flaskApp/blueprints/peerGroup/static/js/main.js', './flaskApp/blueprints/peerGroup/static/_build/main.js', false); }); -gulp.task('peerGroup-prod', () => { - "use strict"; - - return processJsFile('./flaskApp/blueprints/peerGroup/static/js/main.js', './flaskApp/blueprints/peerGroup/static/_build/main.js', true); -}); function _buildTestApps() { "use strict"; @@ -227,4 +234,21 @@ gulp.task('buildTestApps', () => { return _buildTestApps(false); }); -gulp.task('build-prod', ['glrtoc-prod', 'tsmo-prod', 'npmrds-prod', 'ssa-prod', 'itsInventory-prod', 'peerGroup-prod']); + +gulp.task('test_test', () => { + "use strict"; + + return _buildTestApps(false); +}); + +gulp.task('test_build', () => { + "use strict"; + + return processJsFile('./src/test_import.js', './build/test_import.js', false); +}); + +gulp.task('build-prod', () => { + _glrtoc(true); + _tsmo(true); + _ssa(true); +}); diff --git a/package.json b/package.json index bef02ff148d8e986135115f659a812abf0e2f16e..e5f6f08b1838c4c9ec7ba3ac4eafd3e21ccc8e81 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "description": "Openlayers helpers", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\"", - "ol": "node node_modules/openlayers/tasks/build.js lib/custom-ol.json lib/custom-ol-build.js", + "test": "node node_modules\\karma\\bin\\karma start karma.conf.js", + "ol": "node node_modules/openlayers/tasks/build.js src/ol/ol-config.json src/ol/ol.js", "lint": "eslint src/**/*.js", "jsdoc": "jsdoc -r -d doc src" }, @@ -14,32 +14,61 @@ "devDependencies": { "angular2": "^2.0.0-beta.17", "babel-cli": "^6.8.0", + "babel-core": "^6.8.0", + "babel-polyfill": "^6.8.0", "babel-preset-es2015": "^6.6.0", "babelify": "^7.3.0", "browserify": "^13.0.0", + "browserify-istanbul": "^2.0.0", + "browserify-shim": "^3.8.12", + "chai": "^3.5.0", + "codecov.io": "^0.1.6", "es6-mixins": "^1.0.2", "es6-shim": "^0.35.0", + "glob": "^7.0.3", "gulp": "^3.9.1", "gulp-babel": "^6.1.2", "gulp-cssmin": "^0.1.7", + "gulp-jasmine": "^2.3.0", "gulp-less": "^3.0.5", "gulp-minify": "0.0.11", "gulp-rename": "^1.2.2", "gulp-sourcemaps": "^2.0.0-alpha", + "gulp-util": "^3.0.7", + "jasmine": "^2.4.1", + "jasmine-core": "^2.4.1", "jquery": "^2.2.3", "jquery-ui": "^1.10.5", + "karma": "^0.13.22", + "karma-babel-preprocessor": "^6.0.1", + "karma-browserify": "^5.0.5", + "karma-chai": "^0.1.0", + "karma-chrome-launcher": "^1.0.1", + "karma-coverage": "^1.0.0", + "karma-jasmine": "^1.0.2", + "karma-mocha": "^1.0.1", + "karma-mocha-reporter": "^2.0.3", + "karma-phantomjs-launcher": "^1.0.0", + "karma-sinon-chai": "^1.2.0", + "karma-webpack-with-fast-source-maps": "^1.9.2", + "lolex": "^1.4.0", + "mocha": "^2.4.5", "openlayers": "^3.15.1", + "phantomjs": "^2.1.7", + "phantomjs-prebuilt": "^2.1.7", "reflect-metadata": "^0.1.2", "rxjs": "^5.0.0-beta.6", + "sinon": "^1.17.4", + "sinon-chai": "^2.8.0", "vinyl-buffer": "^1.0.0", "vinyl-source-stream": "^1.1.0", + "watchify": "^3.7.0", + "webpack": "^1.13.0", "zone.js": "^0.6.12" }, "repository": { "type": "git", "url": "https://github.com/glennvorhes/webmapsjs.git" }, - "dependencies": { - "angular2": "^2.0.0-beta.17" - } + "dependencies": {} } diff --git a/projects/glrtoc/main.js b/projects/glrtoc/main.js index 2613e08113cbadf982ee28c1ffad45dc0e544c62..67924eb34f100fb862b3169eba13cf51acc8ad3f 100644 --- a/projects/glrtoc/main.js +++ b/projects/glrtoc/main.js @@ -3,7 +3,7 @@ */ // <editor-fold desc="imports"> - +require('babel-polyfill'); import quickMap from '../../src/olHelpers/quickMap'; import LayerBase from '../../src/layers/LayerBase'; import LayerBaseVectorGeoJson from '../../src/layers/LayerBaseVectorGeoJson'; diff --git a/projects/itsMap.js b/projects/itsMap.js index d31b6c55c261faf2095522c102093dd723fd5355..bab4a7c3f1adda96ec4b8d9c4f352000dc65e015 100644 --- a/projects/itsMap.js +++ b/projects/itsMap.js @@ -1,7 +1,7 @@ /** * Created by gavorhes on 12/18/2015. */ - +require('babel-polyfill'); import quickMap from '../src/olHelpers/quickMap'; import mapMove from '../src/olHelpers/mapMove'; import mapPopup from '../src/olHelpers/mapPopup'; @@ -23,5 +23,4 @@ let layerArray = [ } ]; - let legend = new LayerLegend(layerArray, 'legend-container', {}); diff --git a/projects/npmrds/delay/delay-main.js b/projects/npmrds/delay/delay-main.js index b0783f402689ece7127771e36855c344f53ee45b..a38ceedce492664fbd0b17826cc46ccf83f09cfe 100644 --- a/projects/npmrds/delay/delay-main.js +++ b/projects/npmrds/delay/delay-main.js @@ -3,30 +3,30 @@ */ import quickMap from '../../../src/olHelpers/quickMap'; -const angular = require('angular2'); - -let map = quickMap(); - -let app = angular.module('myApp', []); - - -app.controller('myCtrl', function($scope) { - $scope.firstName = "John"; - $scope.lastName = "Doe"; - - $scope.myFunction = function(){ - "use strict"; - console.log((new Date()).getTime()); - }; -}); - - -app.controller('myCtrl2', function($scope) { - //$scope.firstName = "John"; - //$scope.lastName = "Doe"; - // - //$scope.myFunction = function(){ - // "use strict"; - // console.log((new Date()).getTime()); - //} -}); +// const angular = require('angular2'); +// +// let map = quickMap(); +// +// let app = angular.module('myApp', []); +// +// +// app.controller('myCtrl', function($scope) { +// $scope.firstName = "John"; +// $scope.lastName = "Doe"; +// +// $scope.myFunction = function(){ +// "use strict"; +// console.log((new Date()).getTime()); +// }; +// }); +// +// +// app.controller('myCtrl2', function($scope) { +// //$scope.firstName = "John"; +// //$scope.lastName = "Doe"; +// // +// //$scope.myFunction = function(){ +// // "use strict"; +// // console.log((new Date()).getTime()); +// //} +// }); diff --git a/projects/npmrds/heatmap/main.js b/projects/npmrds/heatmap/main.js index 23973777d705e6d5e2d8600450ae3aeb257d490e..26d95cacca57b92216ec5a4aa036b10f9a4aabc3 100644 --- a/projects/npmrds/heatmap/main.js +++ b/projects/npmrds/heatmap/main.js @@ -1,7 +1,7 @@ /** * Created by gavorhes on 12/22/2015. */ - +require('babel-polyfill'); import npmrdsHeatmapConfig from './appConfig'; import quickMap from '../../../src/olHelpers/quickMap'; import LayerBaseXyzTile from '../../../src/layers/LayerBaseXyzTile'; diff --git a/projects/ssa/Corridor.js b/projects/ssa/Corridor.js new file mode 100644 index 0000000000000000000000000000000000000000..84b082b05d2d46080806158772b0a01fc6ca98b4 --- /dev/null +++ b/projects/ssa/Corridor.js @@ -0,0 +1,179 @@ +/** + * Created by gavorhes on 5/5/2016. + */ + +import LayerBaseVectorGeoJson from '../../src/layers/LayerBaseVectorGeoJson'; +import ol from '../../src/custom-ol'; +import $ from '../../src/jquery'; + +function escapeHtml(string) { + return String(string).replace(/[&<>"'\/]/g, function (s) { + return { + "&": "&", + "<": "<", + ">": ">", + '"': '"', + "'": ''', + "/": '/' + }[s]; + }); +} + + +function layerConfigHelper(name, color, visible) { + "use strict"; + + return { + minZoom: 4, + name: name, + transform: {dataProjection: 'EPSG:3857', featureProjection: 'EPSG:3857'}, + style: new ol.style.Style({ + stroke: new ol.style.Stroke({ + color: color, + width: 5 + }) + }), + visible: visible + }; +} + +/** + * + * @type {Array} + */ +let returnedColors = []; +let colorOptions = ['Aquamarine', 'Chartreuse', 'CornflowerBlue', 'Cyan', 'DarkOrange', 'DeepSkyBlue', 'GreenYellow', + 'Salmon', 'Magenta', 'Orchid', 'Turquoise ', 'Tomato']; + + +function randomColor() { + "use strict"; + if (returnedColors.length == colorOptions.length) { + returnedColors = []; + } + while (true) { + let c = colorOptions[Math.floor(parseInt(Math.random() * colorOptions.length))]; + if (returnedColors.indexOf(c) < 0) { + returnedColors.push(c); + + return c; + } + } +} + + +class Corridor { + + /** + * + * @param {string} fromRp from reference point + * @param {string} toRp to reference point + * @param {string} startCounty start county + * @param {string} endCounty end county + * @param {string} highway route + * @param {Array<object>|*} [features=[]] feature array + * @param {number|string|*} databaseId in the db + */ + constructor(fromRp, toRp, startCounty, endCounty, highway, features, databaseId) { + features = features && features.constructor.name == 'Array' ? features : []; + + this.databaseId = databaseId; + this.startCounty = startCounty; + this.endCounty = endCounty; + this.highway = highway; + this.fromRp = fromRp; + this.toRp = toRp; + this.clientId = (fromRp + '-' + toRp).replace(/ /g, '_'); + this._color = randomColor(); + this._corridorLayer = new LayerBaseVectorGeoJson('', + layerConfigHelper(this.fromRp + ' - ' + this.toRp, this._color, true) + ); + + if (features.length > 0) { + this._corridorLayer.source.addFeatures(features); + } else { + $.get(getCorridorUrl, {rp1: fromRp, rp2: toRp}, (d) => { + this._corridorLayer.addFeatures(d); + }, 'json'); + } + } + + getTableHtml() { + let outString = `<tr id="${this.clientId}" class="corridor-tr" style="background-color: ${this._color}">`; + outString += `<td>${this.startCounty}</td>`; + outString += `<td>${this.endCounty}</td>`; + outString += `<td>${this.highway}</td>`; + outString += `<td>${this.fromRp}</td>`; + outString += `<td>${this.toRp}</td>`; + outString += '</tr>'; + + return outString; + } + + getDataHtml(i) { + let outString = '<div class="corridor-data">'; + outString += `<input type="hidden" class="corridor-data-database-id" name="corridors[${i}].corridorId" value="${this.databaseId}"/>`; + outString += `<input type="hidden" class="corridor-data-start-county" name="corridors[${i}].startCounty" value="${this.startCounty}"/>`; + outString += `<input type="hidden" class="corridor-data-end-county" name="corridors[${i}].endCounty" value="${this.endCounty}"/>`; + outString += `<input type="hidden" class="corridor-data-highway" name="corridors[${i}].highway" value="${this.highway}"/>`; + outString += `<input type="hidden" class="corridor-data-from-rp" name="corridors[${i}].fromRp" value="${this.fromRp}"/>`; + outString += `<input type="hidden" class="corridor-data-to-rp" name="corridors[${i}].toRp" value="${this.toRp}"/>`; + outString += `</div>`; + + return outString; + } + + getDataHtmlDisp(i) { + let returnString = this.getDataHtml(i); + returnString = escapeHtml(returnString); + returnString = returnString.replace(/"/>/g, '"/><br>'); + returnString = returnString.replace(/corridor-data">/g, 'corridor-data"><br>'); + + return returnString + '<br>'; + } + + get olLayer() { + return this._corridorLayer.olLayer; + + } + + get layer() { + return this._corridorLayer; + } + + + /** + * + * @returns {boolean} if corridor layer is visible + */ + get visible() { + return this._corridorLayer.visible; + } + + /** + * + * @param {boolean} vis if corridor layer is visible + */ + set visible(vis) { + this._corridorLayer.visible = vis; + } + + /** + * + * @returns {Array.<ol.Feature>} an array of ol features + */ + get features() { + return this._corridorLayer.features; + } + + /** + * + * @param {Array.<ol.Feature>} feats array of ol features + */ + set features(feats) { + this._corridorLayer.clear(); + this._corridorLayer.source.addFeatures(feats); + } +} + +nm.Corridor = Corridor; diff --git a/projects/ssa/urlConfig.js b/projects/ssa/urlConfig.js new file mode 100644 index 0000000000000000000000000000000000000000..cb1b9976041eb97449efe8307ce1dcade6e16506 --- /dev/null +++ b/projects/ssa/urlConfig.js @@ -0,0 +1,19 @@ +/** + * Created by gavorhes on 5/5/2016. + */ +import provide from '../../src/util/provide'; +let nm = provide('ssa'); + +let prefix = '/SSA/'; + +const urlConfig = { + startCounty: prefix + 'getStartCounties', + highways: prefix + 'getHighways', + endCounty: prefix + 'getEndCounties', + fromRp: prefix + 'getFromRps', + toRp: prefix + 'getFromRps', + corridorUrl: prefix + 'getCorridor' +}; + +nm.urlConfig = urlConfig; +export default urlConfig; diff --git a/projects/tsmo/TipConfig.js b/projects/tsmo/TipConfig.js index 705a404b87a43624e54becc69c7311d596699029..ccb30549a6bd27c55fe017e39fb73f7e480aaeb8 100644 --- a/projects/tsmo/TipConfig.js +++ b/projects/tsmo/TipConfig.js @@ -16,9 +16,9 @@ class TipConfig { /** * - * @type {Map} + * @type {ol.Map|undefined} */ - this.map = null; + this.map = undefined; this.$loadingGif = null; this.$regionSelector = undefined; diff --git a/projects/tsmo/legend-test.js b/projects/tsmo/legend-test.js index 361da6767f3f3946e51754dfb6f7b3ee68672b55..bb338e341bdcb78ce3cd544b5b2e9bd62aa78050 100644 --- a/projects/tsmo/legend-test.js +++ b/projects/tsmo/legend-test.js @@ -1,6 +1,7 @@ /** * Created by gavorhes on 12/18/2015. */ +require('babel-polyfill'); import quickMap from '../../src/olHelpers/quickMap'; import mapMove from '../../src/olHelpers/mapMove'; import mapPopup from '../../src/olHelpers/mapPopup'; diff --git a/projects/tsmo/main-report.js b/projects/tsmo/main-report.js index 6b8d9489a6d0f66010cca739f8aa83cf6c6924c9..fdd9aaee90869b4ce17c01cd6b0c72cb2da1c84a 100644 --- a/projects/tsmo/main-report.js +++ b/projects/tsmo/main-report.js @@ -1,7 +1,7 @@ /** * Created by gavorhes on 12/22/2015. */ - +import '../../node_modules/babel-polyfill/dist/polyfill.min'; import quickMap from '../../src/olHelpers/quickMap'; import LayerBaseVectorGeoJson from '../../src/layers/LayerBaseVectorGeoJson'; import mapPopup from '../../src/olHelpers/mapPopup'; @@ -17,9 +17,9 @@ let suppressLowScores = true; function tipStyleReport(feature, resolution) { "use strict"; - let seg_score = feature.getProperties()['z']; + let segScore= feature.getProperties()['z']; - if (seg_score < 1 && suppressLowScores) { + if (segScore < 1 && suppressLowScores) { return null; } else { return tipLayerStyles.tipStyle(feature, resolution); @@ -37,7 +37,7 @@ function tipStyleReport(feature, resolution) { $.get('getcrash', {pdpId: pdpId}, function (d) { $crashData.html(d); - }, 'text') + }, 'text'); } // add the cell classes @@ -127,6 +127,7 @@ function tipStyleReport(feature, resolution) { $selectedRow.addClass('selected-row'); $resultsContainer.find('table tbody').scrollTop(0); $resultsContainer.find('table tbody').scrollTop($selectedRow.offset().top - 60); + return undefined; }, {olStyle: tipLayerStyles.tipStyleSelection} @@ -149,6 +150,7 @@ function tipStyleReport(feature, resolution) { selectionLayer.getSource().addFeature(feature); mapView.fit(feature.getGeometry().getExtent(), map.getSize()); mapView.setZoom(mapView.getZoom() - 2); + return; } } @@ -193,6 +195,4 @@ function tipStyleReport(feature, resolution) { setTimeout(updateTableColumnWidth, 50); }); - - })(); diff --git a/projects/tsmo/main.js b/projects/tsmo/main.js index 3a73607be42fef3053324fbb9fc39728e370899d..a07a62a68d1e9521b25a8f526f26501a9d70a61c 100644 --- a/projects/tsmo/main.js +++ b/projects/tsmo/main.js @@ -1,6 +1,7 @@ /** * Created by gavorhes on 12/14/2015. */ +import '../../node_modules/babel-polyfill/dist/polyfill.min'; import Sliders from '../../src/collections/Sliders'; import tipConfig from './TipConfig'; import mapPopup from '../../src/olHelpers/mapPopup'; @@ -65,7 +66,6 @@ import TipSegmentLayer from './TipSegmentLayer'; uiSetup.endUi(); uiSetup.endUiMap(); - })(); diff --git a/projects/tsmo/slider-test.js b/projects/tsmo/slider-test.js index 6bf939d2b395e422fde1a898ff5ce6b7dfdc7523..456f40d6b4f79c010ca3addefd359159be97b15d 100644 --- a/projects/tsmo/slider-test.js +++ b/projects/tsmo/slider-test.js @@ -1,19 +1,18 @@ /** * Created by gavorhes on 12/14/2015. */ - +require('babel-polyfill'); import Sliders from '../../src/collections/Sliders'; import {} from '../../src/jquery-plugin/dayRange'; import tipConfig from './TipConfig'; const $ = require('jquery'); (function(){ - //alert('here'); let dayRange = $('#dates').dayRange(10); - //let sliders = new Sliders(tipConfig._sliderParamArray, 'slider-container'); + // let sliders = new Sliders(tipConfig._sliderParamArray, 'slider-container'); //glob.sliders = sliders; // // diff --git a/projects/tsmo/tipStyleFunction.js b/projects/tsmo/tipStyleFunction.js index 33d6c2f262ed33015c29c3a06307a397af0790c9..1c943da0fe07f34143e42287786b870f6d36de27 100644 --- a/projects/tsmo/tipStyleFunction.js +++ b/projects/tsmo/tipStyleFunction.js @@ -2,13 +2,13 @@ * Created by gavorhes on 12/22/2015. */ import * as zoomResolutionConvert from '../../src/olHelpers/zoomResolutionConvert'; -import ol from '../../src/custom-ol'; +const ol = require('../../src/ol/ol'); /** * tip style function - * @param feature - * @param resolution + * @param {ol.Feature} feature - the feature + * @param {number} resolution - resolution level * @returns {*[]} */ export function tipStyle(feature, resolution) { diff --git a/spec/urlConfig2.spec.js b/spec/urlConfig2.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..d156913f1fa50cd2f3c5b9afa418964f293aa3c7 --- /dev/null +++ b/spec/urlConfig2.spec.js @@ -0,0 +1,67 @@ +/** + * Created by gavorhes on 5/5/2016. + */ + +import quickMap from '../src/olHelpers/quickMap'; +import cat from '../src/layers/LayerBaseVectorEsri'; + +let chai = require('chai'); + +describe('karma test with Chai', function() { + it('should expose the Chai assert method', function() { + let map = quickMap(); + // console.log(map); + assert.ok('everything', 'everything is ok'); + }); + + it('should expose the Chai expect method', function() { + expect('foo').to.not.equal('bar'); + }); + + it('should expose the Chai should property', function() { + should.exist(123); + (1).should.not.equal(2); + }); + + it('should work with ES6 fat arrow function', () => { + (1).should.not.equal(2); + (1).should.not.equal(2); + (2).should.not.equal(3); + (11).should.not.equal(12); + (11).should.not.equal(15); + (11).should.not.equal(12); + (11).should.not.equal(15); + // (11).should.not.equal(11); + // (11).should.not.equal(11); + // (2).should.not.equal(2); + // (2).should.not.equal(2); + }); +}); + + + +describe('karma test with 2', function() { + it('should expose the Chai assert method', function() { + assert.ok('everything', 'everything is ok'); + }); + + it('should expose the Chai expect method', function() { + expect('foo').to.not.equal('bar'); + }); + + it('should expose the Chai should property', function() { + should.exist(123); + (1).should.not.equal(2); + }); + + it('should work with ES6 fat arrow function', () => { + (1).should.not.equal(2); + (1).should.not.equal(2); + // (2).should.not.equal(2); + // (2).should.not.equal(2); + // (2).should.not.equal(2); + }); +}); + + + diff --git a/spec/urlConfig3.spec.js b/spec/urlConfig3.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..5df5dcd4fb014718c4b629b2c38d5b256592cf12 --- /dev/null +++ b/spec/urlConfig3.spec.js @@ -0,0 +1,63 @@ +/** + * Created by gavorhes on 5/5/2016. + */ + +import quickMap from '../src/olHelpers/quickMap'; + +// import quickMap from '../src/olHelpers/quickMap'; +let chai = require('chai'); + +describe('karma test with Chaiadfadf', function() { + it('should expose the Chai assert method', function() { + let map = quickMap(); + // console.log(map); + assert.ok('everything', 'everything is ok'); + }); + + it('should expose the Chai expect method', function() { + expect('foo').to.not.equal('bar'); + }); + + it('should expose the Chai should property', function() { + should.exist(123); + (1).should.not.equal(2); + }); + + it('should work with ES6 fat arrow function', () => { + (1).should.not.equal(2); + (1).should.not.equal(2); + (2).should.not.equal(3); + (2).should.not.equal(3); + (2).should.not.equal(10); + (2).should.not.equal(10); + (2).should.not.equal(2); + }); +}); + + + +describe('karma test with 2adfaasdf', function() { + it('should expose the Chai assert method', function() { + assert.ok('everything', 'everything is ok'); + }); + + it('should expose the Chai expect method', function() { + expect('foo').to.not.equal('bar'); + }); + + it('should expose the Chai should property', function() { + should.exist(123); + (1).should.not.equal(2); + }); + + it('should work with ES6 fat arrow function', () => { + (1).should.not.equal(2); + (1).should.not.equal(2); + // (2).should.not.equal(2); + // (2).should.not.equal(2); + // (2).should.not.equal(2); + }); +}); + + + diff --git a/src/collections/ItsLayerCollection.js b/src/collections/ItsLayerCollection.js index d446ae3978ac1fd69e130175d74cda76ca84ddb2..84fbb9cbe86c762931a6889f368cbbdf57a0d70c 100644 --- a/src/collections/ItsLayerCollection.js +++ b/src/collections/ItsLayerCollection.js @@ -3,7 +3,6 @@ */ import LayerItsInventory from '../layers/LayerItsInventory'; -import mapMove from '../olHelpers/mapMove'; import * as colors from '../util/colors'; import provide from '../util/provide'; let nm = provide('collections'); diff --git a/src/custom-ol.js b/src/custom-ol.js deleted file mode 100644 index 6b5fc52522ccb114bc7eb9f2c46a637c0b30ea38..0000000000000000000000000000000000000000 --- a/src/custom-ol.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Created by gavorhes on 4/26/2016. - */ - -/* -rebuild with npm run ol from project root directory - */ -const ol = require('../lib/custom-ol-build'); -export default ol; diff --git a/src/jquery-plugin/rpPicker.js b/src/jquery-plugin/rpPicker.js index 05ffd495216cec300b2e9277fe5031d8113db9e5..a4aa182abd945d7611e1fc96b79a541a9b2def12 100644 --- a/src/jquery-plugin/rpPicker.js +++ b/src/jquery-plugin/rpPicker.js @@ -1,13 +1,12 @@ import $ from '../jquery'; -import ol from '../custom-ol'; - import quickMap from '../olHelpers/quickMap'; import quickMapMulti from '../olHelpers/quickMapMulti'; import SortedFeatures from '../olHelpers/SortedFeatures'; import LayerBaseVectorGeoJson from '../layers/LayerBaseVectorGeoJson'; import LayerEsriMapServer from '../layers/LayerEsriMapServer'; import provide from '../util/provide'; -let nm = provide('ssa'); +const ol = require('../ol/ol'); +const nm = provide('ssa'); /** * @callback rpSetCallback diff --git a/src/jquery-plugin/ssaCorridorPicker.js b/src/jquery-plugin/ssaCorridorPicker.js index 67855fb46976609139b2ed524c309de59a9ba49c..f8a2df90427d5a5ba0814fab20e278a574396529 100644 --- a/src/jquery-plugin/ssaCorridorPicker.js +++ b/src/jquery-plugin/ssaCorridorPicker.js @@ -1,5 +1,4 @@ import $ from '../jquery'; -import ol from '../custom-ol'; import quickMap from '../olHelpers/quickMap'; import quickMapMulti from '../olHelpers/quickMapMulti'; @@ -7,7 +6,10 @@ import LayerBaseVectorEsri from '../layers/LayerBaseVectorEsri'; import LayerBaseVectorGeoJson from '../layers/LayerBaseVectorGeoJson'; import LayerEsriMapServer from '../layers/LayerEsriMapServer'; import provide from '../util/provide'; -let nm = provide('ssa'); +const ol = require('../ol/ol'); + + +const nm = provide('ssa'); import {} from './rpPicker.js'; diff --git a/src/layers/LayerBase.js b/src/layers/LayerBase.js index 699e4a96f13667a9c28b76f05fc6f5e6cf3a73b5..48f250ce349e8656cd0be3208f57825a2031160a 100644 --- a/src/layers/LayerBase.js +++ b/src/layers/LayerBase.js @@ -2,7 +2,7 @@ import $ from '../jquery'; import makeGuid from '../util/makeGuid'; import * as zoomResolutionConvert from '../olHelpers/zoomResolutionConvert'; import provide from '../util/provide'; -let nm = provide('layers'); +const nm = provide('layers'); /** * The base layer class diff --git a/src/layers/LayerBaseVector.js b/src/layers/LayerBaseVector.js index 8dc214ae8f3ad7b4180892971876e16dddd85361..820c4848034966bc7ede6cfe7ead91e9baeb29d0 100644 --- a/src/layers/LayerBaseVector.js +++ b/src/layers/LayerBaseVector.js @@ -1,9 +1,9 @@ import $ from '../jquery'; -import ol from '../custom-ol'; import LayerBase from './LayerBase'; import mapMove from '../olHelpers/mapMove'; import provide from '../util/provide'; -let nm = provide('layers'); +const ol = require('../ol/ol'); +const nm = provide('layers'); /** * The make mapMoveGetParams function takes the extent and the zoom level diff --git a/src/layers/LayerBaseVectorEsri.js b/src/layers/LayerBaseVectorEsri.js index 70862a35bc3ca20244b9b284d1b1f13c1df86f02..786b4f7f3aca16b9272b56230543209d1fe54b33 100644 --- a/src/layers/LayerBaseVectorEsri.js +++ b/src/layers/LayerBaseVectorEsri.js @@ -1,12 +1,14 @@ /** * Created by gavorhes on 11/2/2015. */ + import $ from '../jquery'; -import ol from '../custom-ol'; import LayerBaseVector from './LayerBaseVector'; import * as esriToOl from '../olHelpers/esriToOlStyle'; import mapMove from '../olHelpers/mapMove'; import provide from '../util/provide'; +const ol = require('../ol/ol'); + let nm = provide('layers'); /** diff --git a/src/layers/LayerBaseVectorGeoJson.js b/src/layers/LayerBaseVectorGeoJson.js index 884a280b8d73dee149904398de5a42c93c17bf69..f975d7bd395befcdcf5e08a44e976ce7c44c7b7e 100644 --- a/src/layers/LayerBaseVectorGeoJson.js +++ b/src/layers/LayerBaseVectorGeoJson.js @@ -1,10 +1,11 @@ /** * Created by gavorhes on 11/2/2015. */ + import $ from '../jquery'; -import ol from '../custom-ol'; import LayerBaseVector from './LayerBaseVector'; import provide from '../util/provide'; +const ol = require('../ol/ol'); let nm = provide('layers'); /** diff --git a/src/layers/LayerBaseXyzTile.js b/src/layers/LayerBaseXyzTile.js index 5b6ec6ebf37bd8105ccec6d15f87e31723b878e9..823a0a4538fb0363bf048bc22b173615a58ffc25 100644 --- a/src/layers/LayerBaseXyzTile.js +++ b/src/layers/LayerBaseXyzTile.js @@ -2,11 +2,11 @@ * Created by gavorhes on 12/4/2015. */ import $ from '../jquery'; -import ol from '../custom-ol'; import LayerBase from './LayerBase'; import * as esriToOl from '../olHelpers/esriToOlStyle'; import provide from '../util/provide'; -let nm = provide('layers'); +const ol = require('../ol/ol'); +const nm = provide('layers'); /** * XYZ tile diff --git a/src/layers/LayerEsriMapServer.js b/src/layers/LayerEsriMapServer.js index 759775abdde1237b9a1acbe30066ae5de4e812b0..8aabdeecef79441216ca73a11ba4edd197e34cf1 100644 --- a/src/layers/LayerEsriMapServer.js +++ b/src/layers/LayerEsriMapServer.js @@ -2,12 +2,12 @@ * Created by gavorhes on 12/7/2015. */ import $ from '../jquery'; -import ol from '../custom-ol'; import LayerBase from './LayerBase'; import * as esriToOl from '../olHelpers/esriToOlStyle'; import mapPopup from '../olHelpers/mapPopup'; import provide from '../util/provide'; -let nm = provide('layers'); +const ol = require('../ol/ol'); +const nm = provide('layers'); /** * esri mapserver layer diff --git a/src/layers/LayerItsInventory.js b/src/layers/LayerItsInventory.js index e4405436e30a8fa1842918f47669c3730f06fda1..fbf27c9a6c8867e8b4bec64bb84e77a8bf4bce22 100644 --- a/src/layers/LayerItsInventory.js +++ b/src/layers/LayerItsInventory.js @@ -3,11 +3,11 @@ */ import $ from '../jquery'; -import ol from '../custom-ol'; import LayerBaseVectorGeoJson from './LayerBaseVectorGeoJson'; import mapMove from '../olHelpers/mapMove'; import mapPopup from '../olHelpers/mapPopup'; import provide from '../util/provide'; +const ol = require('../ol/ol'); let nm = provide('layers'); diff --git a/src/layers/LayerRealEarthTile.js b/src/layers/LayerRealEarthTile.js index de867095bb3feb82c85250bf1e121f566ab5e80d..4d74ba38278d82eb066771093967cd1629946aed 100644 --- a/src/layers/LayerRealEarthTile.js +++ b/src/layers/LayerRealEarthTile.js @@ -5,9 +5,9 @@ import $ from '../jquery'; import LayerBaseXyzTile from './LayerBaseXyzTile'; import RealEarthAnimateTile from '../mixin/RealEarthAnimateTile'; -let mixIns = require('es6-mixins'); import provide from '../util/provide'; -let nm = provide('layers'); +const mixIns = require('es6-mixins'); +const nm = provide('layers'); /** * Real earth tile diff --git a/src/layers/LayerRealEarthVector.js b/src/layers/LayerRealEarthVector.js index 36940658d261210345527c794b1f3677fe11b363..65ebab4a8bbcc248ed45fa15ff6d9704c5fd3904 100644 --- a/src/layers/LayerRealEarthVector.js +++ b/src/layers/LayerRealEarthVector.js @@ -4,9 +4,9 @@ import LayerBaseVectorGeoJson from './LayerBaseVectorGeoJson'; import RealEarthAnimateVector from '../mixin/RealEarthAnimateVector'; -let mixIns = require('es6-mixins'); import provide from '../util/provide'; -let nm = provide('layers'); +const mixIns = require('es6-mixins'); +const nm = provide('layers'); /** * Vector real earth vector diff --git a/src/mixin/RealEarthAnimate.js b/src/mixin/RealEarthAnimate.js index d2f38fc576a04fcd4f962490b1bf59fe9ef2b9c1..b5fc001b847a21108ac55917ea230b18f0efe992 100644 --- a/src/mixin/RealEarthAnimate.js +++ b/src/mixin/RealEarthAnimate.js @@ -4,7 +4,7 @@ import provide from '../util/provide'; import mapPopup from '../olHelpers/mapPopup'; import $ from '../jquery'; -let nm = provide('mixin'); +const nm = provide('mixin'); /** diff --git a/src/mixin/RealEarthAnimateTile.js b/src/mixin/RealEarthAnimateTile.js index ae55e8d661053fb04cdcc8a7bfa9c8fc826cc7ec..f793f47dedda3c9d8de84cc9fb94c6ed69cf858d 100644 --- a/src/mixin/RealEarthAnimateTile.js +++ b/src/mixin/RealEarthAnimateTile.js @@ -3,7 +3,7 @@ */ import RealEarthAnimate from './RealEarthAnimate'; import provide from '../util/provide'; -let nm = provide('mixin'); +const nm = provide('mixin'); /** * Animate real earth tile diff --git a/src/mixin/RealEarthAnimateVector.js b/src/mixin/RealEarthAnimateVector.js index afbd9423c79d142a3ee9a309675ff9fab91e4f5d..944223884ae7e5af602fa2c34ceb6c5c8ee4d587 100644 --- a/src/mixin/RealEarthAnimateVector.js +++ b/src/mixin/RealEarthAnimateVector.js @@ -3,7 +3,7 @@ */ import RealEarthAnimate from './RealEarthAnimate'; import provide from '../util/provide'; -let nm = provide('mixin'); +const nm = provide('mixin'); const $ = require('jquery'); diff --git a/lib/custom-ol.json b/src/ol/ol-config.json similarity index 100% rename from lib/custom-ol.json rename to src/ol/ol-config.json diff --git a/lib/custom-ol-build.js b/src/ol/ol.js similarity index 100% rename from lib/custom-ol-build.js rename to src/ol/ol.js diff --git a/src/olHelpers/SortedFeatures.js b/src/olHelpers/SortedFeatures.js index 0bdc98d7eae70923e7d510073595ac0b31c602f2..bba3f45a8a08b38a6b3c5f5df1febdde14e7dfcb 100644 --- a/src/olHelpers/SortedFeatures.js +++ b/src/olHelpers/SortedFeatures.js @@ -11,7 +11,7 @@ class SortedFeatures { /** * - * @param {Array} features array of ol features + * @param {Array<ol.Feature>} features array of ol features * @param {string} propertyName - the property name to use for lookup */ constructor(features, propertyName) { diff --git a/src/olHelpers/esriToOlStyle.js b/src/olHelpers/esriToOlStyle.js index aeecfd6511c1c34a9e819ec4dea77243aac0f9ec..0b3cfa799bce72d0870eee95bceeeb554ab04413 100644 --- a/src/olHelpers/esriToOlStyle.js +++ b/src/olHelpers/esriToOlStyle.js @@ -1,9 +1,9 @@ /** * Created by gavorhes on 1/4/2016. */ -import ol from '../custom-ol'; import provide from '../util/provide'; -let nm = provide('olHelpers.esriToOlStyle'); +const ol = require('../ol/ol'); +const nm = provide('olHelpers.esriToOlStyle'); /** * This callback is displayed as part of the Requester class. @@ -12,7 +12,13 @@ let nm = provide('olHelpers.esriToOlStyle'); * @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"; @@ -37,6 +43,12 @@ nm.htmlEscape = htmlEscape; class CommonSymbol { + + /** + * + * @param symbolObj + * @param {number} opacity + */ constructor(symbolObj, opacity) { this.symbolObj = symbolObj; this.opacity = opacity; @@ -55,6 +67,7 @@ class PointSymbol extends CommonSymbol { let outlineWidth = this.symbolObj.outline.width; let radius = this.symbolObj.size; + this.olStyle = new ol.style.Style({ image: new ol.style.Circle({ radius: radius, @@ -244,7 +257,7 @@ class UniqueValueSymbol extends SymbolGenerator { /** * style and legend object - * @typedef {oject} styleAndLegend + * @typedef {object} styleAndLegend * @property {styleFunc} style - style function * @property {string} legend - legend content */ @@ -301,7 +314,7 @@ export function makeFeatureServiceLegendAndSymbol(esriResponse) { } else { return {style: symbolLegendOut.olStyle, legend: symbolLegendOut.legendHtml}; } -}; +} nm.makeFeatureServiceLegendAndSymbol = makeFeatureServiceLegendAndSymbol; diff --git a/src/olHelpers/mapInteractionBase.js b/src/olHelpers/mapInteractionBase.js index e964c78146e0d82d8686fa5636386629613cfb3d..b7bf4cbc86b20c52fddc74705a91cec8fd30188c 100644 --- a/src/olHelpers/mapInteractionBase.js +++ b/src/olHelpers/mapInteractionBase.js @@ -2,7 +2,7 @@ * Created by gavorhes on 12/8/2015. */ import provide from '../util/provide'; -let nm = provide('olHelpers'); +const nm = provide('olHelpers'); /** diff --git a/src/olHelpers/mapMoveCls.js b/src/olHelpers/mapMoveCls.js index 127ac8b64f8d5525341d010331ad9901d37e9e0e..f33f1af315e8148e9df937bfc0e4c554dd4cc0d8 100644 --- a/src/olHelpers/mapMoveCls.js +++ b/src/olHelpers/mapMoveCls.js @@ -8,7 +8,7 @@ import MapInteractionBase from './mapInteractionBase'; import * as checkDefined from '../util/checkDefined'; import provide from '../util/provide'; import makeGuid from '../util/makeGuid'; -let nm = provide('olHelpers'); +const nm = provide('olHelpers'); /** * assists with map move interactions, trigger callback functions diff --git a/src/olHelpers/mapPopupCls.js b/src/olHelpers/mapPopupCls.js index 8519140d138de1b8f4d443f9fc9c312e139ff411..e8891a183013fd5f9079ff85fc9dc6385e734ba6 100644 --- a/src/olHelpers/mapPopupCls.js +++ b/src/olHelpers/mapPopupCls.js @@ -3,11 +3,11 @@ */ import $ from '../jquery'; -import ol from '../custom-ol'; import MapInteractionBase from './mapInteractionBase'; import propertiesZoomStyle from '../olHelpers/propertiesZoomStyle'; import provide from '../util/provide'; -let nm = provide('olHelpers'); +const ol = require('../ol/ol'); +const nm = provide('olHelpers'); class _FeatureLayerProperties { diff --git a/src/olHelpers/propertiesZoomStyle.js b/src/olHelpers/propertiesZoomStyle.js index 4175f4dc7e0fd66b4eea17dd2079c2fabde1bc21..2baab2485453f0a76210abd78b5c13ce5979ef7f 100644 --- a/src/olHelpers/propertiesZoomStyle.js +++ b/src/olHelpers/propertiesZoomStyle.js @@ -4,7 +4,7 @@ import provide from '../util/provide'; import * as zoomResolutionConvert from './zoomResolutionConvert'; -let nm = provide('olHelpers'); +const nm = provide('olHelpers'); /** * A style function based on properties and zoom level, wraps normal feature, resolution function diff --git a/src/olHelpers/quickMap.js b/src/olHelpers/quickMap.js index d94377a15944d2fc3a39b659f8c696452d720d41..6fae1dc8407c0f2e102b802947eab1cc27ac128e 100644 --- a/src/olHelpers/quickMap.js +++ b/src/olHelpers/quickMap.js @@ -31,5 +31,6 @@ function quickMap(options) { return m; } + nm.quickMap = quickMap; export default quickMap; diff --git a/src/olHelpers/quickMapBase.js b/src/olHelpers/quickMapBase.js index 338af5717ce9b93ad5a84d4e0b73cec307e050e3..890eb6ce56582d4a8bed652f283431cf4f678163 100644 --- a/src/olHelpers/quickMapBase.js +++ b/src/olHelpers/quickMapBase.js @@ -7,11 +7,11 @@ */ import $ from '../jquery'; -import ol from '../custom-ol'; import provide from '../util/provide'; import mapMove from './mapMove'; import mapPopup from './mapPopup'; -let nm = provide('olHelpers'); +const ol = require('../ol/ol'); +const nm = provide('olHelpers'); /** diff --git a/src/olHelpers/zoomResolutionConvert.js b/src/olHelpers/zoomResolutionConvert.js index 9103b6f414e9a101239249553e43197869804f44..68211e299dd00d32c41132b56ae135b5b390455e 100644 --- a/src/olHelpers/zoomResolutionConvert.js +++ b/src/olHelpers/zoomResolutionConvert.js @@ -3,7 +3,7 @@ */ import provide from '../util/provide'; -let nm = provide('olHelpers.zoomResolutionConvert'); +const nm = provide('olHelpers.zoomResolutionConvert'); let _zoomResLookup = [ 156543.03392804097, //0 diff --git a/src/rectangle.js b/src/rectangle.js index 5c09079d4fddeb30fb22fb9021f825a579d582ad..efa743542fd244a3a91d1f991892b78d1ebfae7d 100644 --- a/src/rectangle.js +++ b/src/rectangle.js @@ -15,6 +15,12 @@ class Rectangle { constructor(width, height) { this.width = width; this.height = height; + this.bird = 10; + this.cat= 10; + this.cat= 10; + this.cat= 10; + this.cat= 11; + console.log('bird'); } // This is also a new feature of ES6. The "get" keyword diff --git a/src/test-import.js b/src/test-import.js new file mode 100644 index 0000000000000000000000000000000000000000..e4dfa1a2b27e62f018cdba7af46b465f32dbc44c --- /dev/null +++ b/src/test-import.js @@ -0,0 +1,61 @@ +/** + * Created by gavorhes on 5/9/2016. + */ +import Rectangle from './rectangle'; +import makeGuid from './util/makeGuid'; +import quickMap from './olHelpers/quickMap'; +import mylayer from './layers/LayerBaseVectorEsri'; +import asdaf from './layers/LayerBaseVectorGeoJson'; +import adf from './olHelpers/esriToOlStyle'; +import aa from './olHelpers/mapMoveCls'; +import bb from './olHelpers/mapPopupCls'; +import adfadf from './olHelpers/SortedFeatures'; + + +console.log(makeGuid); +let g = 10; +console.log('here'); +console.log('here'); +console.log('here'); +let m = 8; + +console.log('here'); +console.log('here'); +console.log('here'); +console.log('here'); +console.log('here'); + + +console.log('here'); +console.log('here'); +console.log('here'); +console.log('here'); +console.log('here'); +console.log('here'); +console.log('here'); +g = 10; +let myNew = 14; + +console.log(makeGuid); +g = 10; +console.log('here'); +console.log('here'); +console.log('here'); +m = 8; + +console.log('here'); +console.log('here'); +console.log('here'); +console.log('here'); +console.log('here'); + + +console.log('here'); +console.log('here'); +console.log('here'); +console.log('here'); +console.log('here'); +console.log('here'); +console.log('here'); +g = 10; +myNew = 26;