From c49fce90f80b26878af24be0df3e791ba048ebea Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Mon, 13 Feb 2017 15:15:13 -0600 Subject: [PATCH 001/520] initial geo config --- designsafe/apps/geo/__init__.py | 0 designsafe/apps/geo/apps.py | 6 + .../apps/search/html/cmsListing.html | 5 + .../apps/search/html/experimentListing.html | 9 ++ .../apps/search/html/fileListing.html | 8 ++ .../apps/search/html/projectListing.html | 7 ++ .../designsafe/apps/search/html/search.html | 103 ++++++++++++++++ .../apps/search/html/searchListing.html | 48 ++++++++ .../designsafe/apps/search/scripts/app.js | 111 ++++++++++++++++++ .../apps/search/scripts/directive.js | 11 ++ .../designsafe/apps/search/scripts/service.js | 17 +++ .../templates/designsafe/apps/geo/index.html | 26 ++++ designsafe/apps/geo/tests.py | 3 + designsafe/apps/geo/urls.py | 7 ++ designsafe/apps/geo/views.py | 21 ++++ webpack.config.js | 50 ++++++++ 16 files changed, 432 insertions(+) create mode 100644 designsafe/apps/geo/__init__.py create mode 100644 designsafe/apps/geo/apps.py create mode 100644 designsafe/apps/geo/static/designsafe/apps/search/html/cmsListing.html create mode 100644 designsafe/apps/geo/static/designsafe/apps/search/html/experimentListing.html create mode 100644 designsafe/apps/geo/static/designsafe/apps/search/html/fileListing.html create mode 100644 designsafe/apps/geo/static/designsafe/apps/search/html/projectListing.html create mode 100644 designsafe/apps/geo/static/designsafe/apps/search/html/search.html create mode 100644 designsafe/apps/geo/static/designsafe/apps/search/html/searchListing.html create mode 100644 designsafe/apps/geo/static/designsafe/apps/search/scripts/app.js create mode 100644 designsafe/apps/geo/static/designsafe/apps/search/scripts/directive.js create mode 100644 designsafe/apps/geo/static/designsafe/apps/search/scripts/service.js create mode 100644 designsafe/apps/geo/templates/designsafe/apps/geo/index.html create mode 100644 designsafe/apps/geo/tests.py create mode 100644 designsafe/apps/geo/urls.py create mode 100644 designsafe/apps/geo/views.py create mode 100644 webpack.config.js diff --git a/designsafe/apps/geo/__init__.py b/designsafe/apps/geo/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/designsafe/apps/geo/apps.py b/designsafe/apps/geo/apps.py new file mode 100644 index 0000000000..fe01eaf711 --- /dev/null +++ b/designsafe/apps/geo/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + +class DesignSafeSearchConfig(AppConfig): + name = 'designsafe.apps.geo' + label = 'designsafe_ge' + verbose_name = 'DesignSafe Geo' diff --git a/designsafe/apps/geo/static/designsafe/apps/search/html/cmsListing.html b/designsafe/apps/geo/static/designsafe/apps/search/html/cmsListing.html new file mode 100644 index 0000000000..90e527d5d6 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/search/html/cmsListing.html @@ -0,0 +1,5 @@ +
+ Web Conent +
+
+
diff --git a/designsafe/apps/geo/static/designsafe/apps/search/html/experimentListing.html b/designsafe/apps/geo/static/designsafe/apps/search/html/experimentListing.html new file mode 100644 index 0000000000..faf7ae2375 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/search/html/experimentListing.html @@ -0,0 +1,9 @@ +
+ Experiment + +

{{data.title}}

+

{{data.description}}

+ {{data.startDate | date : 'mediumDate'}} - {{data.endDate | date:'mediumDate'}} + DOI: {{ data.doi}} +
+
diff --git a/designsafe/apps/geo/static/designsafe/apps/search/html/fileListing.html b/designsafe/apps/geo/static/designsafe/apps/search/html/fileListing.html new file mode 100644 index 0000000000..ccbea6731e --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/search/html/fileListing.html @@ -0,0 +1,8 @@ +
+ File + {{data.length | bytes }} +

{{data.name}}

+

{{data.path}}

+ {{ data.lastModified | date:'short'}} +
+
diff --git a/designsafe/apps/geo/static/designsafe/apps/search/html/projectListing.html b/designsafe/apps/geo/static/designsafe/apps/search/html/projectListing.html new file mode 100644 index 0000000000..206fc7b808 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/search/html/projectListing.html @@ -0,0 +1,7 @@ +
+ Project +

{{data.title}}

+

{{data.description}}

+ {{data.startDate | date:'short'}} +
+
diff --git a/designsafe/apps/geo/static/designsafe/apps/search/html/search.html b/designsafe/apps/geo/static/designsafe/apps/search/html/search.html new file mode 100644 index 0000000000..56e402a7a4 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/search/html/search.html @@ -0,0 +1,103 @@ +
+ +
+
+
+ + + + + + +
+
+
+ +
+ +
+
+
+

Sorry, nothing found!

+
+
+
+
+ +
+
+
+ +
+ +
+
+
+ {{page_num + 1}} / {{ Math.ceil(data.search_results.total_hits / results_per_page) }} +
+
+
+ +
+
+
+
diff --git a/designsafe/apps/geo/static/designsafe/apps/search/html/searchListing.html b/designsafe/apps/geo/static/designsafe/apps/search/html/searchListing.html new file mode 100644 index 0000000000..839f08f09d --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/search/html/searchListing.html @@ -0,0 +1,48 @@ +
+ +
+ Project +

{{data.title}}

+

{{data.description}}

+ {{data.startDate | date:'short'}} +
+
+ +
+ File + {{data.length | bytes }} +

{{data.name}}

+

{{data.path}}

+ {{ data.lastModified | date:'short'}} +
+
+ +
+ Experiment +

{{data.title}}

+

{{data.description}}

+ {{data.startDate | date : 'mediumDate'}} - {{data.endDate | date:'mediumDate'}} + DOI: {{ data.doi}} +
+
+ +
+ Web Content +

+

{{data.slug}}

+

+
+

+
+
+
+ +
+ Publication +

{{data.title}}

+ Authors: + {{author}}{{$last ? '' : ','}} +
+
+ +
diff --git a/designsafe/apps/geo/static/designsafe/apps/search/scripts/app.js b/designsafe/apps/geo/static/designsafe/apps/search/scripts/app.js new file mode 100644 index 0000000000..b75a31e408 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/search/scripts/app.js @@ -0,0 +1,111 @@ +(function(window, angular, $, _) { + "use strict"; + + angular.module('designsafe') + .config(["$httpProvider", "$locationProvider", function ($httpProvider, $locationProvider) { + $httpProvider.defaults.transformResponse.push(function(responseData){ + convertDateStringsToDates(responseData); + return responseData; + }); + $locationProvider.html5Mode({ + enabled: true, + rewriteLinks: false + }); + }]); + + angular.module('designsafe').controller('SearchCtrl', + ['$scope','$rootScope', '$location', '$window', 'searchService', 'Logging', 'djangoUrl', + function($scope, $rootScope, $location, $window, searchService, Logging, djangoUrl) { + $scope.data = {}; + $scope.Math = window.Math; + $scope.counter = Array; + $scope.page_num = 0; + $scope.results_per_page = 10; + $scope.offset = 0; + $scope.data.search_text = null; + $scope.data.type_filter = null; + $scope.filetype_filter = 'all'; + $scope.searching = false; + $scope.inital_q = $location.search().q + + $scope.search = function(reset){ + arguments.length ? reset = true : reset= false; + if (reset) { + $scope.page_num = 0; + } + if ($scope.data.search_text) { + $scope.searching = true; + $scope.offset = $scope.page_num * $scope.results_per_page; + + searchService.search($scope.data.search_text, $scope.limit, $scope.offset, $scope.data.type_filter).then(function(resp) { + $scope.data.search_results = resp.data; + $scope.max_pages = $scope.Math.ceil($scope.data.search_results.total_hits / $scope.results_per_page); + // logger.debug($scope.data.search_results) + $scope.searching = false; + $window.scrollTo(0, 0); + }, function (err) { + $scope.searching = false; + }); + } + }; + + $scope.filter = function (ftype) { + // toggle the + if ($scope.data.type_filter === ftype) { + $scope.data.type_filter = null; + } else { + $scope.data.type_filter = ftype; + } + $scope.page_num = 0; + $scope.search(); + }; + + $scope.next = function () { + $scope.page_num = $scope.page_num + 1; + $scope.search(); + } + + $scope.prev = function () { + $scope.page_num--; + if ($scope.page_num < 0) $scope.page_num = 0; + $scope.search(); + } + + $scope.select_page = function (page_num) { + $scope.page_num = page_num; + $scope.offset = page_num * $scope.results_per_page; + $scope.search(); + } + + if ($scope.inital_q) { + $scope.data.search_text = $scope.inital_q; + $scope.search(); + } + + }]); + + var regexIso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; + + function convertDateStringsToDates(input) { + // Ignore things that aren't objects. + if (typeof input !== "object") return input; + + for (var key in input) { + if (!input.hasOwnProperty(key)) continue; + + var value = input[key]; + var match; + // Check for string properties which look like dates. + if (typeof value === "string" && (match = value.match(regexIso8601))) { + var milliseconds = Date.parse(match[0]) + if (!isNaN(milliseconds)) { + input[key] = new Date(milliseconds); + } + } else if (typeof value === "object") { + // Recurse into object + convertDateStringsToDates(value); + } + } +} + +})(window, angular, jQuery, _); diff --git a/designsafe/apps/geo/static/designsafe/apps/search/scripts/directive.js b/designsafe/apps/geo/static/designsafe/apps/search/scripts/directive.js new file mode 100644 index 0000000000..11d541caa1 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/search/scripts/directive.js @@ -0,0 +1,11 @@ +(function(window, angular, $, _) { + "use strict"; + + angular.module('designsafe').directive('searchListing', function () { + return { + restrict: 'E', + templateUrl: '/static/designsafe/apps/search/html/searchListing.html', + scope: {'data' : '=data'}, + } + }); +})(window, angular, jQuery, _); diff --git a/designsafe/apps/geo/static/designsafe/apps/search/scripts/service.js b/designsafe/apps/geo/static/designsafe/apps/search/scripts/service.js new file mode 100644 index 0000000000..8c608dcec6 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/search/scripts/service.js @@ -0,0 +1,17 @@ +(function(window, angular, $, _) { + "use strict"; + + angular.module('designsafe').service('searchService', ['$http', 'djangoUrl', function($http, djangoUrl) { + + this.search = function(text, limit, offset, type_filter) { + limit = limit || 10; + offset = offset || 0; + // return $http.get(djangoUrl.reverse('ds_search_api.search', []), {params: {'q': text}}); + return $http.get('/api/search', + {params: {'q': text, 'limit': limit, 'offset': offset, 'type_filter': type_filter}} + ); + }; + + }]); + +})(window, angular, jQuery, _); diff --git a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html new file mode 100644 index 0000000000..26f02d7a0b --- /dev/null +++ b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html @@ -0,0 +1,26 @@ +{% extends "base_angular.html" %} +{% load sekizai_tags %} +{% load static %} + +{% block content %} +
+
+ {{message}} +
+
+{% addtoblock "js" %} + + + + + + +{% endaddtoblock %} + +{% addtoblock 'js' %} + + + +{% endaddtoblock %} + +{% endblock %} diff --git a/designsafe/apps/geo/tests.py b/designsafe/apps/geo/tests.py new file mode 100644 index 0000000000..7ce503c2dd --- /dev/null +++ b/designsafe/apps/geo/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/designsafe/apps/geo/urls.py b/designsafe/apps/geo/urls.py new file mode 100644 index 0000000000..c317eb4374 --- /dev/null +++ b/designsafe/apps/geo/urls.py @@ -0,0 +1,7 @@ +from django.conf.urls import patterns, include, url +from django.core.urlresolvers import reverse + +urlpatterns = patterns( + 'designsafe.apps.geo.views', + url(r'^$', 'index', name='index'), +) diff --git a/designsafe/apps/geo/views.py b/designsafe/apps/geo/views.py new file mode 100644 index 0000000000..e75bd44d90 --- /dev/null +++ b/designsafe/apps/geo/views.py @@ -0,0 +1,21 @@ +from django.core import serializers +from django.http import HttpResponse +from django.shortcuts import render +from django.views.decorators.csrf import csrf_exempt +from django.views.decorators.http import require_POST +from agavepy.agave import AgaveException +from requests import HTTPError +from django.contrib.auth import get_user_model + +from itertools import chain + +import json +import logging + + +logger = logging.getLogger(__name__) + + +def index(request): + logger.debug('search index') + return render(request, 'designsafe/apps/geo/index.html') diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000000..cf65b7494a --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,50 @@ +// webpack plugins +const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin'); +const webpack = require('webpack'); +const path = require('path'); +const ngAnnotatePlugin = require('ng-annotate-webpack-plugin'); +const LiveReloadPlugin = require('webpack-livereload-plugin'); + +module.exports = { + devtool: 'source-map', + entry: './designsafe/static/scripts/ng-designsafe/ng-designsafe.js', + output: { + path: __dirname, + filename: "./designsafe/static/build/bundle.js" + }, + resolve: { + extensions: ['.js'], + modules: ['node_modules'] + }, + + module: { + rules: [ + { + test: /\.js$/, + exclude: /node_modules/, + loader: 'babel-loader', + options: { + presets: ['es2015'] + } + }, + ] + }, + plugins: [ + new ngAnnotatePlugin({add:true}), + + new LiveReloadPlugin() + + ], + + externals: { + jQuery: 'jQuery', + $: 'jQuery', + jquery: 'jQuery', + Modernizr: 'Modernizr', + angular: 'angular', + d3: 'd3', + moment: 'moment', + _: '_', + window: 'window', + } +}; From 69911435af5d7a6727dd70d87750b1e08dd758c1 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Mon, 13 Feb 2017 17:15:26 -0600 Subject: [PATCH 002/520] geo application --- designsafe/apps/geo/apps.py | 2 +- .../static/designsafe/apps/geo/html/map.html | 7 + .../apps/geo/scripts/build/bundle.js | 136 ++++++++++++++++++ .../apps/geo/scripts/build/bundle.js.map | 1 + .../geo/scripts/controllers/map-sidebar.js | 9 ++ .../designsafe/apps/geo/scripts/index.js | 28 ++++ .../static/designsafe/apps/geo/styles/geo.css | 7 + .../apps/search/html/cmsListing.html | 5 - .../apps/search/html/experimentListing.html | 9 -- .../apps/search/html/fileListing.html | 8 -- .../apps/search/html/projectListing.html | 7 - .../designsafe/apps/search/html/search.html | 103 ------------- .../apps/search/html/searchListing.html | 48 ------- .../designsafe/apps/search/scripts/app.js | 111 -------------- .../apps/search/scripts/directive.js | 11 -- .../designsafe/apps/search/scripts/service.js | 17 --- .../templates/designsafe/apps/geo/index.html | 25 +++- designsafe/common_settings.py | 1 + designsafe/templates/base.html | 2 +- designsafe/urls.py | 2 + package.json | 11 +- webpack.config.js | 4 +- 22 files changed, 222 insertions(+), 332 deletions(-) create mode 100644 designsafe/apps/geo/static/designsafe/apps/geo/html/map.html create mode 100644 designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js create mode 100644 designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map create mode 100644 designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js create mode 100644 designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js create mode 100644 designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css delete mode 100644 designsafe/apps/geo/static/designsafe/apps/search/html/cmsListing.html delete mode 100644 designsafe/apps/geo/static/designsafe/apps/search/html/experimentListing.html delete mode 100644 designsafe/apps/geo/static/designsafe/apps/search/html/fileListing.html delete mode 100644 designsafe/apps/geo/static/designsafe/apps/search/html/projectListing.html delete mode 100644 designsafe/apps/geo/static/designsafe/apps/search/html/search.html delete mode 100644 designsafe/apps/geo/static/designsafe/apps/search/html/searchListing.html delete mode 100644 designsafe/apps/geo/static/designsafe/apps/search/scripts/app.js delete mode 100644 designsafe/apps/geo/static/designsafe/apps/search/scripts/directive.js delete mode 100644 designsafe/apps/geo/static/designsafe/apps/search/scripts/service.js diff --git a/designsafe/apps/geo/apps.py b/designsafe/apps/geo/apps.py index fe01eaf711..5463a9e99f 100644 --- a/designsafe/apps/geo/apps.py +++ b/designsafe/apps/geo/apps.py @@ -2,5 +2,5 @@ class DesignSafeSearchConfig(AppConfig): name = 'designsafe.apps.geo' - label = 'designsafe_ge' + label = 'designsafe_geo' verbose_name = 'DesignSafe Geo' diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html new file mode 100644 index 0000000000..1cf7d6ca1c --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -0,0 +1,7 @@ +
+

sidebar

+
+ +
+

map

+
diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js new file mode 100644 index 0000000000..f45f921460 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -0,0 +1,136 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.l = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // identity function for calling harmony imports with the correct context +/******/ __webpack_require__.i = function(value) { return value; }; + +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; + +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; + +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 2); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var MapSidebarCtrl = function MapSidebarCtrl() { + 'ngInject'; + + _classCallCheck(this, MapSidebarCtrl); +}; + +exports.default = MapSidebarCtrl; + +/***/ }), +/* 1 */, +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +config.$inject = ["$stateProvider"]; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _mapSidebar = __webpack_require__(0); + +var _mapSidebar2 = _interopRequireDefault(_mapSidebar); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mod = angular.module('designsafe'); +mod.requires.push('ui.router'); + +function config($stateProvider) { + 'ngInject'; + + console.log('config'); + $stateProvider.state('geo', { + url: '', + templateUrl: '/static/designsafe/apps/geo/html/map.html', + contoller: 'MapSidebarCtrl', + resolve: { + auth: function auth() { + console.log('asdasdasd'); + return true; + } + } + }); +} + +mod.config(config); +mod.controller('MapSidebarCtrl', _mapSidebar2.default); + +exports.default = mod; + +/***/ }) +/******/ ]); +//# sourceMappingURL=bundle.js.map \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map new file mode 100644 index 0000000000..1d9dbd9b73 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/bootstrap 9048585438820fdbf2b6","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["MapSidebarCtrl","mod","requires","push","$stateProvider","state","url","templateUrl","contoller","resolve","auth","console","log","controller"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;IChEqBA,c,GAEnB,0BAAe;AACb;;AADa;AAId,C;;kBANkBA,c;;;;;;;;;;;;;;ACArB;;;;;;AAEA;AACAC,IAAIC,QAAJ,CAAaC,IAAb,CAAkB,WAAlB;;AAEgC;AAC9B;;AACA;AACAC,iBAAeC,KAAf,CAAqB,CAAO;AAC1BC,SAAK,EADqB;AAE1BC,YAF0B;AAG1BC,eAAW,gBAHe;AAI1BC,aAAS;AACPC,YAAM,EAAY;AAChBC,gBAAQC,GAAR,CAAY,SAAZ;AACA,eAAO,IAAP;AACD;AAJM;AAJiB,GAA5B;AAYD;;AAED;AACAX,IAAIY,UAAJ,CAAe,IAAf","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 9048585438820fdbf2b6","export default class MapSidebarCtrl {\n\n constructor () {\n 'ngInject';\n\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import MapSidebarCtrl from './controllers/map-sidebar';\n\nlet mod = angular.module('designsafe')\nmod.requires.push('ui.router')\n\nfunction config($stateProvider) {\n 'ngInject';\n console.log('config')\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n contoller: 'MapSidebarCtrl',\n resolve: {\n auth: function () {\n console.log('asdasdasd')\n return true;\n }\n }\n })\n\n}\n\nmod.config(config);\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js new file mode 100644 index 0000000000..0bbb9e021d --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -0,0 +1,9 @@ +export default class MapSidebarCtrl { + + constructor () { + 'ngInject'; + + + } + +} diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js new file mode 100644 index 0000000000..3ffd27e453 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js @@ -0,0 +1,28 @@ +import MapSidebarCtrl from './controllers/map-sidebar'; + +let mod = angular.module('designsafe') +mod.requires.push('ui.router') + +function config($stateProvider) { + 'ngInject'; + console.log('config') + $stateProvider.state('geo', { + url: '', + templateUrl: '/static/designsafe/apps/geo/html/map.html', + contoller: 'MapSidebarCtrl', + resolve: { + auth: function () { + console.log('asdasdasd') + return true; + } + } + }) + +} + +mod.config(config); +mod.controller('MapSidebarCtrl', MapSidebarCtrl); + + + +export default mod; diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css new file mode 100644 index 0000000000..edfa0d51ff --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -0,0 +1,7 @@ +#geo_sidebar { + width: 20%; +} + +#geo_map { + width: 80%; +} diff --git a/designsafe/apps/geo/static/designsafe/apps/search/html/cmsListing.html b/designsafe/apps/geo/static/designsafe/apps/search/html/cmsListing.html deleted file mode 100644 index 90e527d5d6..0000000000 --- a/designsafe/apps/geo/static/designsafe/apps/search/html/cmsListing.html +++ /dev/null @@ -1,5 +0,0 @@ -
- Web Conent -
-
-
diff --git a/designsafe/apps/geo/static/designsafe/apps/search/html/experimentListing.html b/designsafe/apps/geo/static/designsafe/apps/search/html/experimentListing.html deleted file mode 100644 index faf7ae2375..0000000000 --- a/designsafe/apps/geo/static/designsafe/apps/search/html/experimentListing.html +++ /dev/null @@ -1,9 +0,0 @@ -
- Experiment - -

{{data.title}}

-

{{data.description}}

- {{data.startDate | date : 'mediumDate'}} - {{data.endDate | date:'mediumDate'}} - DOI: {{ data.doi}} -
-
diff --git a/designsafe/apps/geo/static/designsafe/apps/search/html/fileListing.html b/designsafe/apps/geo/static/designsafe/apps/search/html/fileListing.html deleted file mode 100644 index ccbea6731e..0000000000 --- a/designsafe/apps/geo/static/designsafe/apps/search/html/fileListing.html +++ /dev/null @@ -1,8 +0,0 @@ -
- File - {{data.length | bytes }} -

{{data.name}}

-

{{data.path}}

- {{ data.lastModified | date:'short'}} -
-
diff --git a/designsafe/apps/geo/static/designsafe/apps/search/html/projectListing.html b/designsafe/apps/geo/static/designsafe/apps/search/html/projectListing.html deleted file mode 100644 index 206fc7b808..0000000000 --- a/designsafe/apps/geo/static/designsafe/apps/search/html/projectListing.html +++ /dev/null @@ -1,7 +0,0 @@ -
- Project -

{{data.title}}

-

{{data.description}}

- {{data.startDate | date:'short'}} -
-
diff --git a/designsafe/apps/geo/static/designsafe/apps/search/html/search.html b/designsafe/apps/geo/static/designsafe/apps/search/html/search.html deleted file mode 100644 index 56e402a7a4..0000000000 --- a/designsafe/apps/geo/static/designsafe/apps/search/html/search.html +++ /dev/null @@ -1,103 +0,0 @@ -
- -
-
-
- - - - - - -
-
-
- -
- -
-
-
-

Sorry, nothing found!

-
-
-
-
- -
-
-
- -
- -
-
-
- {{page_num + 1}} / {{ Math.ceil(data.search_results.total_hits / results_per_page) }} -
-
-
- -
-
-
-
diff --git a/designsafe/apps/geo/static/designsafe/apps/search/html/searchListing.html b/designsafe/apps/geo/static/designsafe/apps/search/html/searchListing.html deleted file mode 100644 index 839f08f09d..0000000000 --- a/designsafe/apps/geo/static/designsafe/apps/search/html/searchListing.html +++ /dev/null @@ -1,48 +0,0 @@ -
- -
- Project -

{{data.title}}

-

{{data.description}}

- {{data.startDate | date:'short'}} -
-
- -
- File - {{data.length | bytes }} -

{{data.name}}

-

{{data.path}}

- {{ data.lastModified | date:'short'}} -
-
- -
- Experiment -

{{data.title}}

-

{{data.description}}

- {{data.startDate | date : 'mediumDate'}} - {{data.endDate | date:'mediumDate'}} - DOI: {{ data.doi}} -
-
- -
- Web Content -

-

{{data.slug}}

-

-
-

-
-
-
- -
- Publication -

{{data.title}}

- Authors: - {{author}}{{$last ? '' : ','}} -
-
- -
diff --git a/designsafe/apps/geo/static/designsafe/apps/search/scripts/app.js b/designsafe/apps/geo/static/designsafe/apps/search/scripts/app.js deleted file mode 100644 index b75a31e408..0000000000 --- a/designsafe/apps/geo/static/designsafe/apps/search/scripts/app.js +++ /dev/null @@ -1,111 +0,0 @@ -(function(window, angular, $, _) { - "use strict"; - - angular.module('designsafe') - .config(["$httpProvider", "$locationProvider", function ($httpProvider, $locationProvider) { - $httpProvider.defaults.transformResponse.push(function(responseData){ - convertDateStringsToDates(responseData); - return responseData; - }); - $locationProvider.html5Mode({ - enabled: true, - rewriteLinks: false - }); - }]); - - angular.module('designsafe').controller('SearchCtrl', - ['$scope','$rootScope', '$location', '$window', 'searchService', 'Logging', 'djangoUrl', - function($scope, $rootScope, $location, $window, searchService, Logging, djangoUrl) { - $scope.data = {}; - $scope.Math = window.Math; - $scope.counter = Array; - $scope.page_num = 0; - $scope.results_per_page = 10; - $scope.offset = 0; - $scope.data.search_text = null; - $scope.data.type_filter = null; - $scope.filetype_filter = 'all'; - $scope.searching = false; - $scope.inital_q = $location.search().q - - $scope.search = function(reset){ - arguments.length ? reset = true : reset= false; - if (reset) { - $scope.page_num = 0; - } - if ($scope.data.search_text) { - $scope.searching = true; - $scope.offset = $scope.page_num * $scope.results_per_page; - - searchService.search($scope.data.search_text, $scope.limit, $scope.offset, $scope.data.type_filter).then(function(resp) { - $scope.data.search_results = resp.data; - $scope.max_pages = $scope.Math.ceil($scope.data.search_results.total_hits / $scope.results_per_page); - // logger.debug($scope.data.search_results) - $scope.searching = false; - $window.scrollTo(0, 0); - }, function (err) { - $scope.searching = false; - }); - } - }; - - $scope.filter = function (ftype) { - // toggle the - if ($scope.data.type_filter === ftype) { - $scope.data.type_filter = null; - } else { - $scope.data.type_filter = ftype; - } - $scope.page_num = 0; - $scope.search(); - }; - - $scope.next = function () { - $scope.page_num = $scope.page_num + 1; - $scope.search(); - } - - $scope.prev = function () { - $scope.page_num--; - if ($scope.page_num < 0) $scope.page_num = 0; - $scope.search(); - } - - $scope.select_page = function (page_num) { - $scope.page_num = page_num; - $scope.offset = page_num * $scope.results_per_page; - $scope.search(); - } - - if ($scope.inital_q) { - $scope.data.search_text = $scope.inital_q; - $scope.search(); - } - - }]); - - var regexIso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; - - function convertDateStringsToDates(input) { - // Ignore things that aren't objects. - if (typeof input !== "object") return input; - - for (var key in input) { - if (!input.hasOwnProperty(key)) continue; - - var value = input[key]; - var match; - // Check for string properties which look like dates. - if (typeof value === "string" && (match = value.match(regexIso8601))) { - var milliseconds = Date.parse(match[0]) - if (!isNaN(milliseconds)) { - input[key] = new Date(milliseconds); - } - } else if (typeof value === "object") { - // Recurse into object - convertDateStringsToDates(value); - } - } -} - -})(window, angular, jQuery, _); diff --git a/designsafe/apps/geo/static/designsafe/apps/search/scripts/directive.js b/designsafe/apps/geo/static/designsafe/apps/search/scripts/directive.js deleted file mode 100644 index 11d541caa1..0000000000 --- a/designsafe/apps/geo/static/designsafe/apps/search/scripts/directive.js +++ /dev/null @@ -1,11 +0,0 @@ -(function(window, angular, $, _) { - "use strict"; - - angular.module('designsafe').directive('searchListing', function () { - return { - restrict: 'E', - templateUrl: '/static/designsafe/apps/search/html/searchListing.html', - scope: {'data' : '=data'}, - } - }); -})(window, angular, jQuery, _); diff --git a/designsafe/apps/geo/static/designsafe/apps/search/scripts/service.js b/designsafe/apps/geo/static/designsafe/apps/search/scripts/service.js deleted file mode 100644 index 8c608dcec6..0000000000 --- a/designsafe/apps/geo/static/designsafe/apps/search/scripts/service.js +++ /dev/null @@ -1,17 +0,0 @@ -(function(window, angular, $, _) { - "use strict"; - - angular.module('designsafe').service('searchService', ['$http', 'djangoUrl', function($http, djangoUrl) { - - this.search = function(text, limit, offset, type_filter) { - limit = limit || 10; - offset = offset || 0; - // return $http.get(djangoUrl.reverse('ds_search_api.search', []), {params: {'q': text}}); - return $http.get('/api/search', - {params: {'q': text, 'limit': limit, 'offset': offset, 'type_filter': type_filter}} - ); - }; - - }]); - -})(window, angular, jQuery, _); diff --git a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html index 26f02d7a0b..f77d8cf317 100644 --- a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html +++ b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html @@ -2,25 +2,36 @@ {% load sekizai_tags %} {% load static %} +{% block head_extra %} + +{% endblock %} + + + + {% block content %} -
-
- {{message}} -
+
+
{% addtoblock "js" %} + + {% endaddtoblock %} {% addtoblock 'js' %} - - - + +{% endaddtoblock %} + +{% addtoblock "css" %} + + + {% endaddtoblock %} {% endblock %} diff --git a/designsafe/common_settings.py b/designsafe/common_settings.py index 681bd98402..8c8ec55811 100644 --- a/designsafe/common_settings.py +++ b/designsafe/common_settings.py @@ -96,6 +96,7 @@ 'designsafe.apps.user_activity', 'designsafe.apps.token_access', 'designsafe.apps.search', + 'designsafe.apps.geo' ) AUTHENTICATION_BACKENDS = ( diff --git a/designsafe/templates/base.html b/designsafe/templates/base.html index 9b99fa7e9a..5135133dad 100644 --- a/designsafe/templates/base.html +++ b/designsafe/templates/base.html @@ -36,7 +36,7 @@ {% javascript 'vendor' %} {% javascript 'main' %} - + diff --git a/designsafe/urls.py b/designsafe/urls.py index 8650cea661..7acd10372c 100644 --- a/designsafe/urls.py +++ b/designsafe/urls.py @@ -45,6 +45,8 @@ namespace='designsafe_notifications')), url(r'^search/', include('designsafe.apps.search.urls', namespace='designsafe_search')), + url(r'^geo/', include('designsafe.apps.geo.urls', + namespace='designsafe_geo')), # auth diff --git a/package.json b/package.json index ec8394e04a..8b249755b7 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,9 @@ "private": true, "main": "manage.py", "scripts": { - "test": "./node_modules/.bin/karma start karma.conf.js --single-run" + "test": "./node_modules/.bin/karma start karma.conf.js --single-run", + "build": "webpack --config webpack.config.js", + "dev": "webpack --progress --colors --watch --config webpack.config.js" }, "author": "Matthew R Hanlon ", "contributors": [ @@ -19,12 +21,17 @@ ], "license": "MIT", "devDependencies": { + "babel-core": "^6.21.0", + "babel-loader": "^6.2.10", "jasmine-core": "^2.4.1", "karma": "^0.13.19", "karma-chrome-launcher": "^0.2.2", "karma-firefox-launcher": "^0.1.7", "karma-jasmine": "^0.3.6", - "karma-jasmine-html-reporter": "^0.1.8" + "karma-jasmine-html-reporter": "^0.1.8", + "ng-annotate-webpack-plugin": "^0.2.1-pre", + "webpack": "^2.2.0", + "webpack-livereload-plugin": "^0.10.0" }, "dependencies": { "marked": "^0.3.6", diff --git a/webpack.config.js b/webpack.config.js index cf65b7494a..b9210225e0 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -7,10 +7,10 @@ const LiveReloadPlugin = require('webpack-livereload-plugin'); module.exports = { devtool: 'source-map', - entry: './designsafe/static/scripts/ng-designsafe/ng-designsafe.js', + entry: './designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js', output: { path: __dirname, - filename: "./designsafe/static/build/bundle.js" + filename: "./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js" }, resolve: { extensions: ['.js'], From 0c82a33260d143f0366497e7381241514d4f0aef Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Tue, 14 Feb 2017 12:44:09 -0600 Subject: [PATCH 003/520] some buttons, etc --- .../static/designsafe/apps/geo/html/map.html | 41 ++++++++++++-- .../apps/geo/scripts/build/bundle.js | 54 +++++++++++++++---- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 24 ++++++++- .../designsafe/apps/geo/scripts/index.js | 4 +- .../static/designsafe/apps/geo/styles/geo.css | 26 +++++++++ .../templates/designsafe/apps/geo/index.html | 5 +- .../ng-designsafe/providers/ws-provider.js | 4 +- 8 files changed, 135 insertions(+), 25 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 1cf7d6ca1c..d1cc1a142a 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -1,7 +1,38 @@ -
-

sidebar

-
+
+
+
    +
  • + +
  • +
  • + Open a project +
  • +
  • + Draw shapes +
  • +
  • + Import from Designsafe +
  • +
  • + Import locally +
  • +
  • + Add an image +
  • +
  • + +   +
  • + +
  • + + Save +
  • +
    +
+
-
-

map

+
+

map

+
diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index f45f921460..1b2cf9f957 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -63,7 +63,7 @@ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 2); +/******/ return __webpack_require__(__webpack_require__.s = 1); /******/ }) /************************************************************************/ /******/ ([ @@ -77,19 +77,55 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var MapSidebarCtrl = function MapSidebarCtrl() { - 'ngInject'; +var MapSidebarCtrl = function () { + MapSidebarCtrl.$inject = ["$scope"]; + function MapSidebarCtrl($scope) { + 'ngInject'; + + var _this = this; + + _classCallCheck(this, MapSidebarCtrl); + + angular.element('header').hide(); + angular.element('nav').hide(); + angular.element('footer').hide(); + this.map = L.map('geo_map').setView([51.505, -0.09], 13); + + L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap contributors' + }).addTo(this.map); + this.drawnItems = new L.FeatureGroup(); + this.map.addLayer(this.drawnItems); + var drawControl = new L.Control.Draw({ + edit: { + featureGroup: this.drawnItems, + remove: true + } + }); + this.map.addControl(drawControl); + this.map.on('draw:created', function (e) { + _this.drawnItems.addLayer(e.layer); + }); + } + + _createClass(MapSidebarCtrl, [{ + key: 'save_project', + value: function save_project() { + console.log(this.drawnItems.toGeoJSON()); + } + }]); - _classCallCheck(this, MapSidebarCtrl); -}; + return MapSidebarCtrl; +}(); exports.default = MapSidebarCtrl; /***/ }), -/* 1 */, -/* 2 */ +/* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -112,14 +148,12 @@ mod.requires.push('ui.router'); function config($stateProvider) { 'ngInject'; - console.log('config'); $stateProvider.state('geo', { url: '', templateUrl: '/static/designsafe/apps/geo/html/map.html', - contoller: 'MapSidebarCtrl', + controller: 'MapSidebarCtrl as vm', resolve: { auth: function auth() { - console.log('asdasdasd'); return true; } } diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 1d9dbd9b73..ca359f190f 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 9048585438820fdbf2b6","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["MapSidebarCtrl","mod","requires","push","$stateProvider","state","url","templateUrl","contoller","resolve","auth","console","log","controller"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;IChEqBA,c,GAEnB,0BAAe;AACb;;AADa;AAId,C;;kBANkBA,c;;;;;;;;;;;;;;ACArB;;;;;;AAEA;AACAC,IAAIC,QAAJ,CAAaC,IAAb,CAAkB,WAAlB;;AAEgC;AAC9B;;AACA;AACAC,iBAAeC,KAAf,CAAqB,CAAO;AAC1BC,SAAK,EADqB;AAE1BC,YAF0B;AAG1BC,eAAW,gBAHe;AAI1BC,aAAS;AACPC,YAAM,EAAY;AAChBC,gBAAQC,GAAR,CAAY,SAAZ;AACA,eAAO,IAAP;AACD;AAJM;AAJiB,GAA5B;AAYD;;AAED;AACAX,IAAIY,UAAJ,CAAe,IAAf","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 9048585438820fdbf2b6","export default class MapSidebarCtrl {\n\n constructor () {\n 'ngInject';\n\n\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import MapSidebarCtrl from './controllers/map-sidebar';\n\nlet mod = angular.module('designsafe')\nmod.requires.push('ui.router')\n\nfunction config($stateProvider) {\n 'ngInject';\n console.log('config')\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n contoller: 'MapSidebarCtrl',\n resolve: {\n auth: function () {\n console.log('asdasdasd')\n return true;\n }\n }\n })\n\n}\n\nmod.config(config);\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap e4bcb18183d1b30dcd1c","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["MapSidebarCtrl","$scope","angular","element","hide","map","L","setView","attribution","addTo","drawnItems","addLayer","drawControl","Control","Draw","edit","featureGroup","remove","on","e","layer","console","log","toGeoJSON","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;IChEqBA,c;AAEnB,0BAAaC,MAAb,EAAqB;AACnB;;AADmB;;AAAA;;AAEnB;AACAC,YAAQC,OAAR,CAAgB,KAAhB,EAAuBC,IAAvB;AACAF,YAAQC,OAAR,CAAgB,QAAhB,EAA0BC,IAA1B;AACA,SAAKC,GAAL,GAAWC,EAAED,GAAF,CAAM,SAAN,EAAiBE,KAA5B;;AAEkE;AAC9DC,mBAAa;AADiD,KAAlE,EAEGC,KAFH,CAES,KAAKJ,GAFd;AAGA,SAAKK,UAAL,GAAkB,CAAlB;AACA,SAAKL,GAAL,CAASM,QAAT,CAAkB,KAAKD,UAAvB;AACA,QAAIE,cAAc,IAAIN,EAAEO,OAAF,CAAUC,GAAK;AACpCC,YAAM;AACJC,aADI;AAEJC,gBAAQ;AAFJ;AAD8B,KAAnB,CAAlB;AAMA;AACA,SAAKZ,GAAL,CAASa,EAAT,CAAY,cAAZ,EAA6B,KAAO;AAClC,YAAKR,UAAL,CAAgBC,QAAhB,CAAyBQ,EAAEC,KAA3B;AACD,KAFD;AAGD;;;;wBAEe;AACdC,cAAQC,GAAR,CAAY,KAAKZ,UAAL,CAAgBa,EAA5B;AACD;;;;;;;;;;;;;;;;;;;AC5BH;;;;;;AAEA,IAAIC,MAAMtB,QAAQuB,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASC,MAAT,CAAgBC,cAAhB,CAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BC,YAH0B;AAI1BC,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAEDP,CAAA;AACA;;kBAIeA,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e4bcb18183d1b30dcd1c","export default class MapSidebarCtrl {\n\n constructor ($scope) {\n 'ngInject';\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.map = L.map('geo_map').setView([51.505, -0.09], 13);\n\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n }).addTo(this.map);\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n let drawControl = new L.Control.Draw({\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n this.map.addControl(drawControl);\n this.map.on('draw:created', (e) => {\n this.drawnItems.addLayer(e.layer);\n });\n }\n\n save_project () {\n console.log(this.drawnItems.toGeoJSON())\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import MapSidebarCtrl from './controllers/map-sidebar';\n\nlet mod = angular.module('designsafe')\nmod.requires.push('ui.router')\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n })\n\n}\n\nmod.config(config);\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index 0bbb9e021d..422344ca5e 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -1,9 +1,31 @@ export default class MapSidebarCtrl { - constructor () { + constructor ($scope) { 'ngInject'; + angular.element('header').hide(); + angular.element('nav').hide(); + angular.element('footer').hide(); + this.map = L.map('geo_map').setView([51.505, -0.09], 13); + L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap contributors' + }).addTo(this.map); + this.drawnItems = new L.FeatureGroup(); + this.map.addLayer(this.drawnItems); + let drawControl = new L.Control.Draw({ + edit: { + featureGroup: this.drawnItems, + remove: true + } + }); + this.map.addControl(drawControl); + this.map.on('draw:created', (e) => { + this.drawnItems.addLayer(e.layer); + }); + } + save_project () { + console.log(this.drawnItems.toGeoJSON()) } } diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js index 3ffd27e453..49d861d6bf 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js @@ -5,14 +5,12 @@ mod.requires.push('ui.router') function config($stateProvider) { 'ngInject'; - console.log('config') $stateProvider.state('geo', { url: '', templateUrl: '/static/designsafe/apps/geo/html/map.html', - contoller: 'MapSidebarCtrl', + controller: 'MapSidebarCtrl as vm', resolve: { auth: function () { - console.log('asdasdasd') return true; } } diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css index edfa0d51ff..2ae456b052 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -1,7 +1,33 @@ + +#map_container { + display: flex; + min-height: 100vh; +} + #geo_sidebar { width: 20%; + float: left; + flex: 0 0 230px; + background: #364251; + color: #d0d0d0; + border-right: 1px solid #d3d3d3; } #geo_map { width: 80%; + flex: 1; + background: grey; +} + +#geo_sidebar .list-group-item { + background-color: #364251; + border-bottom: 1px solid #707070; + border-left: 0px; + border-right: 0px; + border-top: 0px; + margin-top: 1px; +} + +#geo_sidebar .list-group-item.save { + background-color: #379ba0; } diff --git a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html index f77d8cf317..9402d9eade 100644 --- a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html +++ b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html @@ -10,7 +10,7 @@ {% block content %} -
+
{% addtoblock "js" %} @@ -26,12 +26,13 @@ {% addtoblock 'js' %} + {% endaddtoblock %} {% addtoblock "css" %} - + {% endaddtoblock %} {% endblock %} diff --git a/designsafe/static/scripts/ng-designsafe/providers/ws-provider.js b/designsafe/static/scripts/ng-designsafe/providers/ws-provider.js index 05a81de321..cb3036717e 100644 --- a/designsafe/static/scripts/ng-designsafe/providers/ws-provider.js +++ b/designsafe/static/scripts/ng-designsafe/providers/ws-provider.js @@ -5,9 +5,8 @@ function init(url){ ws = new WebSocket(url); - logger.log('wss : ', ws); ws.onopen = function(){ - logger.log('websocket to data, connected'); + }; ws.onmessage = function(e){ var res = JSON.parse(e.data); @@ -18,7 +17,6 @@ logger.log('WS error: ', e); }; ws.onclose = function(e){ - logger.log('connection closed; reopening'); init(url); }; service.ws = ws; From dfd9bf00393db69fcdabbec720ca72a811c6f8ae Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Tue, 14 Feb 2017 17:05:25 -0600 Subject: [PATCH 004/520] sidebar for map viewer --- .eslintrc | 12 ++++++ .../static/designsafe/apps/geo/html/map.html | 12 ++++-- .../apps/geo/scripts/build/bundle.js | 39 +++++++++++++++++-- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 36 +++++++++++++++-- .../static/designsafe/apps/geo/styles/geo.css | 12 ++++++ .../templates/designsafe/apps/geo/index.html | 3 ++ 7 files changed, 104 insertions(+), 12 deletions(-) create mode 100644 .eslintrc diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000000..ddd5496a5f --- /dev/null +++ b/.eslintrc @@ -0,0 +1,12 @@ +{ + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module", + }, + "env": { + "browser": true, + }, + "rules": { + "semi": 2 + } +} diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index d1cc1a142a..05206ea599 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -23,13 +23,19 @@   - -
  • +
  • Save
  • -
    + +
    + {{ vm.current_layer.options }} + + +
    diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index 1b2cf9f957..f3f272fa7d 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -82,14 +82,16 @@ var _createClass = function () { function defineProperties(target, props) { for function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var MapSidebarCtrl = function () { - MapSidebarCtrl.$inject = ["$scope"]; - function MapSidebarCtrl($scope) { + MapSidebarCtrl.$inject = ["$scope", "$window"]; + function MapSidebarCtrl($scope, $window) { 'ngInject'; var _this = this; _classCallCheck(this, MapSidebarCtrl); + this.$scope = $scope; + this.LGeo = $window.LGeo; angular.element('header').hide(); angular.element('nav').hide(); angular.element('footer').hide(); @@ -100,22 +102,51 @@ var MapSidebarCtrl = function () { }).addTo(this.map); this.drawnItems = new L.FeatureGroup(); this.map.addLayer(this.drawnItems); + var drawControl = new L.Control.Draw({ + position: 'topright', + draw: { + circle: false + }, edit: { featureGroup: this.drawnItems, remove: true } }); + + this.drawnItems.on('click', function (e) { + _this.current_layer = e.layer; + _this.$scope.$apply(); + }); + this.map.addControl(drawControl); this.map.on('draw:created', function (e) { - _this.drawnItems.addLayer(e.layer); + var object = e.layer; + object.options.color = '#ff0000'; + object.options.fillOpacity = 0.8; + _this.drawnItems.addLayer(object); + _this.current_layer = object; + _this.$scope.$apply(); }); } _createClass(MapSidebarCtrl, [{ + key: 'update_color', + value: function update_color() { + this.current_layer.setStyle({ fillColor: this.current_layer.options.color }); + } + }, { key: 'save_project', value: function save_project() { - console.log(this.drawnItems.toGeoJSON()); + console.log(this.drawnItems); + var blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], { type: "application/json" }); + var url = URL.createObjectURL(blob); + + var a = document.createElement('a'); + a.download = "backup.json"; + a.href = url; + a.textContent = "Download backup.json"; + a.click(); } }]); diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index ca359f190f..2b966c123f 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap e4bcb18183d1b30dcd1c","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["MapSidebarCtrl","$scope","angular","element","hide","map","L","setView","attribution","addTo","drawnItems","addLayer","drawControl","Control","Draw","edit","featureGroup","remove","on","e","layer","console","log","toGeoJSON","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;IChEqBA,c;AAEnB,0BAAaC,MAAb,EAAqB;AACnB;;AADmB;;AAAA;;AAEnB;AACAC,YAAQC,OAAR,CAAgB,KAAhB,EAAuBC,IAAvB;AACAF,YAAQC,OAAR,CAAgB,QAAhB,EAA0BC,IAA1B;AACA,SAAKC,GAAL,GAAWC,EAAED,GAAF,CAAM,SAAN,EAAiBE,KAA5B;;AAEkE;AAC9DC,mBAAa;AADiD,KAAlE,EAEGC,KAFH,CAES,KAAKJ,GAFd;AAGA,SAAKK,UAAL,GAAkB,CAAlB;AACA,SAAKL,GAAL,CAASM,QAAT,CAAkB,KAAKD,UAAvB;AACA,QAAIE,cAAc,IAAIN,EAAEO,OAAF,CAAUC,GAAK;AACpCC,YAAM;AACJC,aADI;AAEJC,gBAAQ;AAFJ;AAD8B,KAAnB,CAAlB;AAMA;AACA,SAAKZ,GAAL,CAASa,EAAT,CAAY,cAAZ,EAA6B,KAAO;AAClC,YAAKR,UAAL,CAAgBC,QAAhB,CAAyBQ,EAAEC,KAA3B;AACD,KAFD;AAGD;;;;wBAEe;AACdC,cAAQC,GAAR,CAAY,KAAKZ,UAAL,CAAgBa,EAA5B;AACD;;;;;;;;;;;;;;;;;;;AC5BH;;;;;;AAEA,IAAIC,MAAMtB,QAAQuB,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASC,MAAT,CAAgBC,cAAhB,CAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BC,YAH0B;AAI1BC,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAEDP,CAAA;AACA;;kBAIeA,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e4bcb18183d1b30dcd1c","export default class MapSidebarCtrl {\n\n constructor ($scope) {\n 'ngInject';\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.map = L.map('geo_map').setView([51.505, -0.09], 13);\n\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n }).addTo(this.map);\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n let drawControl = new L.Control.Draw({\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n this.map.addControl(drawControl);\n this.map.on('draw:created', (e) => {\n this.drawnItems.addLayer(e.layer);\n });\n }\n\n save_project () {\n console.log(this.drawnItems.toGeoJSON())\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import MapSidebarCtrl from './controllers/map-sidebar';\n\nlet mod = angular.module('designsafe')\nmod.requires.push('ui.router')\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n })\n\n}\n\nmod.config(config);\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap bf53dd203191a79f3575","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["MapSidebarCtrl","$scope","$window","LGeo","angular","element","hide","map","L","setView","attribution","addTo","drawnItems","addLayer","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","$apply","on","object","options","color","fillOpacity","setStyle","console","log","blob","Blob","JSON","stringify","url","URL","createObjectURL","a","download","href","textContent","click","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;IChE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oBN,IAApB,CAAX;;AAEA;AACAO,QAAEC,QAAF,GAAgB,aAAhB;AACAD,QAAEE,IAAF,GAAgBL,GAAhB;AACAG,QAAEG,WAAF;AACAH,QAAEI,KAAF;AACD;;;;;;;;;;;;;;;;;;;ACxDH;;;;;;AAEA,IAAIC,MAAMxC,QAAQyC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASC,MAAT,CAAgBC,cAAhB,CAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BC,YAH0B;AAI1BC,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAEDP,CAAA;AACA;;kBAIeA,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap bf53dd203191a79f3575","export default class MapSidebarCtrl {\n\n constructor ($scope, $window) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.map = L.map('geo_map').setView([51.505, -0.09], 13);\n\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n }).addTo(this.map);\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n }\n update_color () {\n this.current_layer.setStyle({fillColor: this.current_layer.options.color});\n }\n save_project () {\n console.log(this.drawnItems);\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import MapSidebarCtrl from './controllers/map-sidebar';\n\nlet mod = angular.module('designsafe')\nmod.requires.push('ui.router')\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n })\n\n}\n\nmod.config(config);\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index 422344ca5e..7eadfa25fb 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -1,7 +1,9 @@ export default class MapSidebarCtrl { - constructor ($scope) { + constructor ($scope, $window) { 'ngInject'; + this.$scope = $scope; + this.LGeo = $window.LGeo; angular.element('header').hide(); angular.element('nav').hide(); angular.element('footer').hide(); @@ -12,20 +14,46 @@ export default class MapSidebarCtrl { }).addTo(this.map); this.drawnItems = new L.FeatureGroup(); this.map.addLayer(this.drawnItems); + let drawControl = new L.Control.Draw({ + position: 'topright', + draw: { + circle: false, + }, edit: { featureGroup: this.drawnItems, remove: true } }); + + this.drawnItems.on('click', (e) => { + this.current_layer = e.layer; + this.$scope.$apply(); + }); + this.map.addControl(drawControl); this.map.on('draw:created', (e) => { - this.drawnItems.addLayer(e.layer); + let object = e.layer; + object.options.color = '#ff0000'; + object.options.fillOpacity = 0.8; + this.drawnItems.addLayer(object); + this.current_layer = object; + this.$scope.$apply(); }); } - + update_color () { + this.current_layer.setStyle({fillColor: this.current_layer.options.color}); + } save_project () { - console.log(this.drawnItems.toGeoJSON()) + console.log(this.drawnItems); + let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: "application/json"}); + let url = URL.createObjectURL(blob); + + let a = document.createElement('a'); + a.download = "backup.json"; + a.href = url; + a.textContent = "Download backup.json"; + a.click(); } } diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css index 2ae456b052..65151a7731 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -11,6 +11,8 @@ background: #364251; color: #d0d0d0; border-right: 1px solid #d3d3d3; + flex-direction: column; + display: flex; } #geo_map { @@ -26,8 +28,18 @@ border-right: 0px; border-top: 0px; margin-top: 1px; + cursor: pointer; } #geo_sidebar .list-group-item.save { background-color: #379ba0; } + +#geo_sidebar .current-layer-details { + bottom: 0; + flex-grow: 1; + vertical-align: bottom; + display: flex; + flex-direction: column-reverse; + +} diff --git a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html index 9402d9eade..84805c4d1f 100644 --- a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html +++ b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html @@ -22,11 +22,14 @@ + + {% endaddtoblock %} {% addtoblock 'js' %} + {% endaddtoblock %} {% addtoblock "css" %} From d50eeaa9f2ba365ab435b787ed0413962d381bea Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Tue, 14 Feb 2017 17:12:58 -0600 Subject: [PATCH 005/520] sidebar for map viewer --- designsafe/apps/geo/static/designsafe/apps/geo/html/map.html | 4 +--- .../geo/static/designsafe/apps/geo/scripts/build/bundle.js | 3 +++ .../static/designsafe/apps/geo/scripts/build/bundle.js.map | 2 +- .../designsafe/apps/geo/scripts/controllers/map-sidebar.js | 3 +++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 05206ea599..2d0a98b7b7 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -38,7 +38,5 @@
    -
    -

    map

    -
    +
    diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index f3f272fa7d..059e35afc1 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -139,6 +139,9 @@ var MapSidebarCtrl = function () { key: 'save_project', value: function save_project() { console.log(this.drawnItems); + this.drawnItems.eachLayer(function (l) { + console.log(l.options); + }); var blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], { type: "application/json" }); var url = URL.createObjectURL(blob); diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 2b966c123f..c022205d24 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap bf53dd203191a79f3575","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["MapSidebarCtrl","$scope","$window","LGeo","angular","element","hide","map","L","setView","attribution","addTo","drawnItems","addLayer","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","$apply","on","object","options","color","fillOpacity","setStyle","console","log","blob","Blob","JSON","stringify","url","URL","createObjectURL","a","download","href","textContent","click","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;IChEqBA,c;AAEnB,0BAAaC,MAAb,EAAqBC,OAArB,EAA8B;AAC5B;;AAD4B;;AAAA;;AAE5B;AACA,SAAKC,IAAL,GAAYD,QAAQC,CAApB;AACAC,YAAQC,OAAR,CAAgB,QAAhB;AACAD,YAAQC,OAAR,CAAgB,KAAhB,EAAuBC,IAAvB;AACAF,YAAQC,OAAR,CAAgB,QAAhB,EAA0BC,IAA1B;AACA,SAAKC,GAAL,GAAWC,EAAED,GAAF,CAAM,SAAN,EAAiBE,KAA5B;;AAEkE;AAC9DC,mBAAa;AADiD,KAAlE,EAEGC,KAFH,CAES,KAAKJ,GAFd;AAGA,SAAKK,UAAL,GAAkB,CAAlB;AACA,SAAKL,GAAL,CAASM,QAAT,CAAkB,KAAKD,UAAvB;;AAEqC;AACpCE,gBAAU,UAD0B;AAEpCC,YAAM;AACLC,aAAQ;AADH,OAF8B;AAKpCC,QAAM;AACJC,aADI;AAEJC,gBAAQ;AAFJ;AAL8B,KAAnB,CAAlB;;AAWmC;AACjC,YAAKC,aAAL,GAAqBC,EAAEC,KAAvB;AACA,YAAKrB,MAAL,CAAYsB,MAAZ;AACD,KAHD;;AAKA;AACA,SAAKhB,GAAL,CAASiB,EAAT,CAAY,cAAZ,EAA6B,KAAO;AAClC,UAAIC,SAASJ,EAAEC,KAAf;AACAG,aAAOC,OAAP,CAAeC,KAAf;AACAF,aAAOC,OAAP,CAAeE,WAAf,GAA6B,GAA7B;AACA,YAAKhB,UAAL,CAAgBC,QAAhB,CAAyBY,MAAzB;AACA,YAAKL,aAAL,GAAqBK,MAArB;AACA,YAAKxB,MAAL,CAAYsB,MAAZ;AACD,KAPD;AAQD;;;;wBACe;AACd,WAAKH,aAAL,CAAmBS,QAAnB,CAA4B,EAA5B;AACD;;;wBACe;AACdC,cAAQC,GAAR,CAAY,KAAKnB,UAAjB;AACA,UAAIoB,OAAO,IAAIC,IAAJ,CAAS,CAACC,KAAKC,GAA1B;AACA,UAAIC,MAAOC,IAAIC,eAAJ,CAAoBN,IAApB,CAAX;;AAEA;AACAO,QAAEC,QAAF,GAAgB,aAAhB;AACAD,QAAEE,IAAF,GAAgBL,GAAhB;AACAG,QAAEG,WAAF;AACAH,QAAEI,KAAF;AACD;;;;;;;;;;;;;;;;;;;ACxDH;;;;;;AAEA,IAAIC,MAAMxC,QAAQyC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASC,MAAT,CAAgBC,cAAhB,CAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BC,YAH0B;AAI1BC,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAEDP,CAAA;AACA;;kBAIeA,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap bf53dd203191a79f3575","export default class MapSidebarCtrl {\n\n constructor ($scope, $window) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.map = L.map('geo_map').setView([51.505, -0.09], 13);\n\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n }).addTo(this.map);\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n }\n update_color () {\n this.current_layer.setStyle({fillColor: this.current_layer.options.color});\n }\n save_project () {\n console.log(this.drawnItems);\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import MapSidebarCtrl from './controllers/map-sidebar';\n\nlet mod = angular.module('designsafe')\nmod.requires.push('ui.router')\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n })\n\n}\n\nmod.config(config);\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap a4d827ca85f178799016","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["MapSidebarCtrl","$scope","$window","LGeo","angular","element","hide","map","L","setView","attribution","addTo","drawnItems","addLayer","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","$apply","on","object","options","color","fillOpacity","setStyle","console","log","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;IChEqBA,c;AAEnB,0BAAaC,MAAb,EAAqBC,OAArB,EAA8B;AAC5B;;AAD4B;;AAAA;;AAE5B;AACA,SAAKC,IAAL,GAAYD,QAAQC,CAApB;AACAC,YAAQC,OAAR,CAAgB,QAAhB;AACAD,YAAQC,OAAR,CAAgB,KAAhB,EAAuBC,IAAvB;AACAF,YAAQC,OAAR,CAAgB,QAAhB,EAA0BC,IAA1B;AACA,SAAKC,GAAL,GAAWC,EAAED,GAAF,CAAM,SAAN,EAAiBE,KAA5B;;AAEkE;AAC9DC,mBAAa;AADiD,KAAlE,EAEGC,KAFH,CAES,KAAKJ,GAFd;AAGA,SAAKK,UAAL,GAAkB,CAAlB;AACA,SAAKL,GAAL,CAASM,QAAT,CAAkB,KAAKD,UAAvB;;AAEqC;AACpCE,gBAAU,UAD0B;AAEpCC,YAAM;AACLC,aAAQ;AADH,OAF8B;AAKpCC,QAAM;AACJC,aADI;AAEJC,gBAAQ;AAFJ;AAL8B,KAAnB,CAAlB;;AAWmC;AACjC,YAAKC,aAAL,GAAqBC,EAAEC,KAAvB;AACA,YAAKrB,MAAL,CAAYsB,MAAZ;AACD,KAHD;;AAKA;AACA,SAAKhB,GAAL,CAASiB,EAAT,CAAY,cAAZ,EAA6B,KAAO;AAClC,UAAIC,SAASJ,EAAEC,KAAf;AACAG,aAAOC,OAAP,CAAeC,KAAf;AACAF,aAAOC,OAAP,CAAeE,WAAf,GAA6B,GAA7B;AACA,YAAKhB,UAAL,CAAgBC,QAAhB,CAAyBY,MAAzB;AACA,YAAKL,aAAL,GAAqBK,MAArB;AACA,YAAKxB,MAAL,CAAYsB,MAAZ;AACD,KAPD;AAQD;;;;wBACe;AACd,WAAKH,aAAL,CAAmBS,QAAnB,CAA4B,EAA5B;AACD;;;wBACe;AACdC,cAAQC,GAAR,CAAY,KAAKnB,UAAjB;AACA,WAAKA,UAAL,CAAgBoB,SAAhB,CAA0B,GAAa;AACrCF,gBAAQC,GAAR,CAAYE,EAAEP,OAAd;AACD,OAFD;AAGA;AACA,UAAIQ,MAAOC,IAAIC,eAAJ,CAAoBC,IAApB,CAAX;;AAEA;AACAC,QAAEC,QAAF,GAAgB,aAAhB;AACAD,QAAEE,IAAF,GAAgBN,GAAhB;AACAI,QAAEG,WAAF;AACAH,QAAEI,KAAF;AACD;;;;;;;;;;;;;;;;;;;AC3DH;;;;;;AAEA,IAAIC,MAAMvC,QAAQwC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASC,MAAT,CAAgBC,cAAhB,CAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BC,YAH0B;AAI1BC,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAEDP,CAAA;AACA;;kBAIeA,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap a4d827ca85f178799016","export default class MapSidebarCtrl {\n\n constructor ($scope, $window) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.map = L.map('geo_map').setView([51.505, -0.09], 13);\n\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n }).addTo(this.map);\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n }\n update_color () {\n this.current_layer.setStyle({fillColor: this.current_layer.options.color});\n }\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n })\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import MapSidebarCtrl from './controllers/map-sidebar';\n\nlet mod = angular.module('designsafe')\nmod.requires.push('ui.router')\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n })\n\n}\n\nmod.config(config);\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index 7eadfa25fb..f62a6a896f 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -46,6 +46,9 @@ export default class MapSidebarCtrl { } save_project () { console.log(this.drawnItems); + this.drawnItems.eachLayer(function (l) { + console.log(l.options); + }) let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: "application/json"}); let url = URL.createObjectURL(blob); From e363f6d97d5d8fa97ee6780c118f936f56c73b2b Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Wed, 15 Feb 2017 16:26:11 -0600 Subject: [PATCH 006/520] designsafe/static/vendor/exif-js/ --- bower.json | 3 +- .../static/designsafe/apps/geo/html/map.html | 56 +++++-- .../apps/geo/scripts/build/bundle.js | 145 +++++++++++++++++- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 50 +++++- .../designsafe/apps/geo/scripts/index.js | 11 +- .../static/designsafe/apps/geo/styles/geo.css | 5 + 7 files changed, 244 insertions(+), 28 deletions(-) diff --git a/bower.json b/bower.json index 210dc31dcd..de9a9eb591 100644 --- a/bower.json +++ b/bower.json @@ -35,7 +35,8 @@ "angular-drag-and-drop-lists": "1.4.0", "angular-xeditable": "0.1.12", "angular-httpi": "*", - "angular-slick-carousel": "^3.1.7" + "angular-slick-carousel": "^3.1.7", + "exif-js": "^2.1.1" }, "resolutions": { "angular": "~1.4.8", diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 2d0a98b7b7..0f40dd8bea 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -5,15 +5,19 @@
  • - Open a project + Create a new project
  • - Draw shapes + Open a project
  • +
  • Import from Designsafe
  • -
  • +
  • + Import locally
  • @@ -30,13 +34,47 @@
    - {{ vm.current_layer.options }} - - + + + + + + + + + + + + + + + + + +
    Fill + + +
    Stroke + + +
    Opacity + + +
    Description + +
    - + +
    diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index 059e35afc1..27b1af88ef 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -82,8 +82,8 @@ var _createClass = function () { function defineProperties(target, props) { for function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var MapSidebarCtrl = function () { - MapSidebarCtrl.$inject = ["$scope", "$window"]; - function MapSidebarCtrl($scope, $window) { + MapSidebarCtrl.$inject = ["$scope", "$window", "$timeout"]; + function MapSidebarCtrl($scope, $window, $timeout) { 'ngInject'; var _this = this; @@ -92,11 +92,15 @@ var MapSidebarCtrl = function () { this.$scope = $scope; this.LGeo = $window.LGeo; + this.$timeout = $timeout; angular.element('header').hide(); angular.element('nav').hide(); angular.element('footer').hide(); this.map = L.map('geo_map').setView([51.505, -0.09], 13); + //method binding for callback, sigh... + this.local_file_selected = this.local_file_selected.bind(this); + L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' }).addTo(this.map); @@ -115,14 +119,20 @@ var MapSidebarCtrl = function () { }); this.drawnItems.on('click', function (e) { - _this.current_layer = e.layer; + if (_this.current_layer == e.layer) { + _this.current_layer = null; + } else { + _this.current_layer = e.layer; + }; _this.$scope.$apply(); }); this.map.addControl(drawControl); + this.map.on('draw:created', function (e) { var object = e.layer; object.options.color = '#ff0000'; + object.options.fillColor = '#ff0000'; object.options.fillOpacity = 0.8; _this.drawnItems.addLayer(object); _this.current_layer = object; @@ -131,9 +141,44 @@ var MapSidebarCtrl = function () { } _createClass(MapSidebarCtrl, [{ + key: 'open_file_dialog', + value: function open_file_dialog() { + this.$timeout(function () { + angular.element('#local_file').trigger('click'); + }); + } + }, { + key: 'local_file_selected', + value: function local_file_selected(ev) { + var _this2 = this; + + var file = ev.target.files[0]; + var reader = new FileReader(); + reader.readAsText(file); + reader.onload = function (e) { + var json = JSON.parse(e.target.result); + L.geoJSON(json).getLayers().forEach(function (l) { + ; + _this2.drawnItems.addLayer(l); + }); + _this2.map.fitBounds(_this2.drawnItems.getBounds()); + }; + } + }, { key: 'update_color', value: function update_color() { - this.current_layer.setStyle({ fillColor: this.current_layer.options.color }); + this.current_layer.setStyle({ color: this.current_layer.options.color }); + } + }, { + key: 'update_fill', + value: function update_fill() { + this.current_layer.setStyle({ fillColor: this.current_layer.options.fillColor }); + this.current_layer.setStyle({ color: this.current_layer.options.fillColor }); + } + }, { + key: 'update_opacity', + value: function update_opacity() { + this.current_layer.setStyle({ fillOpacity: this.current_layer.options.fillOpacity }); } }, { key: 'save_project', @@ -170,14 +215,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _mapSidebar = __webpack_require__(0); +var _directives = __webpack_require__(2); -var _mapSidebar2 = _interopRequireDefault(_mapSidebar); +var _controllers = __webpack_require__(4); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _services = __webpack_require__(5); var mod = angular.module('designsafe'); -mod.requires.push('ui.router'); +mod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services'); function config($stateProvider) { 'ngInject'; @@ -195,10 +240,94 @@ function config($stateProvider) { } mod.config(config); + +exports.default = mod; + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _customOnChange = __webpack_require__(3); + +var _customOnChange2 = _interopRequireDefault(_customOnChange); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mod = angular.module('ds.geo.directives', []); + +mod.directive('customOnChange', _customOnChange2.default); + +exports.default = mod; + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = customOnChange; +function customOnChange() { + return { + restrict: 'A', + link: function link(scope, element, attrs) { + var onChangeHandler = scope.$eval(attrs.customOnChange); + element.bind('change', onChangeHandler); + } + }; +} + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _mapSidebar = __webpack_require__(0); + +var _mapSidebar2 = _interopRequireDefault(_mapSidebar); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mod = angular.module('ds.geo.controllers', []); + mod.controller('MapSidebarCtrl', _mapSidebar2.default); exports.default = mod; +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +// import customOnChange from './custom-on-change'; + +var mod = angular.module('ds.geo.services', []); + +// mod.directive('customOnChange', customOnChange); + +exports.default = mod; + /***/ }) /******/ ]); //# sourceMappingURL=bundle.js.map \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index c022205d24..a88ec9beaf 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap a4d827ca85f178799016","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["MapSidebarCtrl","$scope","$window","LGeo","angular","element","hide","map","L","setView","attribution","addTo","drawnItems","addLayer","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","$apply","on","object","options","color","fillOpacity","setStyle","console","log","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth"],"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aAAOC,OAAP,CAAeE,WAAf,GAA6B,GAA7B;AACA,YAAKhB,UAAL,CAAgBC,QAAhB,CAAyBY,MAAzB;AACA,YAAKL,aAAL,GAAqBK,MAArB;AACA,YAAKxB,MAAL,CAAYsB,MAAZ;AACD,KAPD;AAQD;;;;wBACe;AACd,WAAKH,aAAL,CAAmBS,QAAnB,CAA4B,EAA5B;AACD;;;wBACe;AACdC,cAAQC,GAAR,CAAY,KAAKnB,UAAjB;AACA,WAAKA,UAAL,CAAgBoB,SAAhB,CAA0B,GAAa;AACrCF,gBAAQC,GAAR,CAAYE,EAAEP,OAAd;AACD,OAFD;AAGA;AACA,UAAIQ,MAAOC,IAAIC,eAAJ,CAAoBC,IAApB,CAAX;;AAEA;AACAC,QAAEC,QAAF,GAAgB,aAAhB;AACAD,QAAEE,IAAF,GAAgBN,GAAhB;AACAI,QAAEG,WAAF;AACAH,QAAEI,KAAF;AACD;;;;;;;;;;;;;;;;;;;AC3DH;;;;;;AAEA,IAAIC,MAAMvC,QAAQwC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASC,MAAT,CAAgBC,cAAhB,CAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BC,YAH0B;AAI1BC,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAEDP,CAAA;AACA;;kBAIeA,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap a4d827ca85f178799016","export default class MapSidebarCtrl {\n\n constructor ($scope, $window) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.map = L.map('geo_map').setView([51.505, -0.09], 13);\n\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n }).addTo(this.map);\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n }\n update_color () {\n this.current_layer.setStyle({fillColor: this.current_layer.options.color});\n }\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n })\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import MapSidebarCtrl from './controllers/map-sidebar';\n\nlet mod = angular.module('designsafe')\nmod.requires.push('ui.router')\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n })\n\n}\n\nmod.config(config);\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap f7342c032e993657eddb","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"names":["MapSidebarCtrl","$scope","$window","$timeout","LGeo","angular","element","hide","map","L","setView","local_file_selected","attribution","addTo","drawnItems","addLayer","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","object","options","color","fillColor","fillOpacity","$apply","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","setStyle","console","log","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth","directive","restrict","link","onChangeHandler","bind"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;IChEqBA,c;AAEnB,0BAAaC,MAAb,EAAqBC,OAArB,EAA8BC,QAA9B,EAAwC;AACtC;;AADsC;;AAAA;;AAEtC;AACA,SAAKC,IAAL,GAAYF,QAAQE,CAApB;AACA,SAAKD,QAAL,GAAgBA,QAAhB;AACAE,YAAQC,OAAR,CAAgB,QAAhB;AACAD,YAAQC,OAAR,CAAgB,KAAhB,EAAuBC,IAAvB;AACAF,YAAQC,OAAR,CAAgB,QAAhB,EAA0BC,IAA1B;AACA,SAAKC,GAAL,GAAWC,EAAED,GAAF,CAAM,SAAN,EAAiBE,KAA5B;;AAEA;AACA,SAAKC,mBAAL,GAA2B,KAAKA,MAAhC;;AAEkE;AAC9DC,mBAAa;AADiD,KAAl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AV;;AAEAD,IAAIK,UAAJ,CAAe,gBAAf;;kBAEeL,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMpD,QAAQqD,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeD,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f7342c032e993657eddb","export default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.map = L.map('geo_map').setView([51.505, -0.09], 13);\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n }).addTo(this.map);\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n if (this.current_layer == e.layer) {\n this.current_layer = null;\n } else {\n this.current_layer = e.layer;\n };\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillColor = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n }\n\n open_file_dialog () {\n this.$timeout(()=> {\n angular.element('#local_file').trigger('click');\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n update_color () {\n this.current_layer.setStyle({color: this.current_layer.options.color});\n }\n\n update_fill () {\n this.current_layer.setStyle({fillColor: this.current_layer.options.fillColor});\n this.current_layer.setStyle({color: this.current_layer.options.fillColor});\n }\n\n update_opacity () {\n this.current_layer.setStyle({fillOpacity: this.current_layer.options.fillOpacity});\n }\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index f62a6a896f..4b276784f6 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -1,14 +1,18 @@ export default class MapSidebarCtrl { - constructor ($scope, $window) { + constructor ($scope, $window, $timeout) { 'ngInject'; this.$scope = $scope; this.LGeo = $window.LGeo; + this.$timeout = $timeout; angular.element('header').hide(); angular.element('nav').hide(); angular.element('footer').hide(); this.map = L.map('geo_map').setView([51.505, -0.09], 13); + //method binding for callback, sigh... + this.local_file_selected = this.local_file_selected.bind(this); + L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' }).addTo(this.map); @@ -27,28 +31,66 @@ export default class MapSidebarCtrl { }); this.drawnItems.on('click', (e) => { - this.current_layer = e.layer; + if (this.current_layer == e.layer) { + this.current_layer = null; + } else { + this.current_layer = e.layer; + }; this.$scope.$apply(); }); this.map.addControl(drawControl); + this.map.on('draw:created', (e) => { let object = e.layer; object.options.color = '#ff0000'; + object.options.fillColor = '#ff0000'; object.options.fillOpacity = 0.8; this.drawnItems.addLayer(object); this.current_layer = object; this.$scope.$apply(); }); + + + } + + open_file_dialog () { + this.$timeout(()=> { + angular.element('#local_file').trigger('click'); + }); + } + + local_file_selected (ev) { + let file = ev.target.files[0]; + let reader = new FileReader(); + reader.readAsText(file); + reader.onload = (e) => { + let json = JSON.parse(e.target.result); + L.geoJSON(json).getLayers().forEach( (l) => {; + this.drawnItems.addLayer(l); + }); + this.map.fitBounds(this.drawnItems.getBounds()); + }; } + update_color () { - this.current_layer.setStyle({fillColor: this.current_layer.options.color}); + this.current_layer.setStyle({color: this.current_layer.options.color}); + } + + update_fill () { + this.current_layer.setStyle({fillColor: this.current_layer.options.fillColor}); + this.current_layer.setStyle({color: this.current_layer.options.fillColor}); } + + update_opacity () { + this.current_layer.setStyle({fillOpacity: this.current_layer.options.fillOpacity}); + } + save_project () { console.log(this.drawnItems); this.drawnItems.eachLayer(function (l) { console.log(l.options); - }) + }); let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: "application/json"}); let url = URL.createObjectURL(blob); diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js index 49d861d6bf..e782678831 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js @@ -1,7 +1,9 @@ -import MapSidebarCtrl from './controllers/map-sidebar'; +import {mod as geo_directives} from './directives'; +import {mod as geo_controllers} from './controllers'; +import {mod as geo_services} from './services'; -let mod = angular.module('designsafe') -mod.requires.push('ui.router') +let mod = angular.module('designsafe'); +mod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services'); function config($stateProvider) { 'ngInject'; @@ -14,12 +16,11 @@ function config($stateProvider) { return true; } } - }) + }); } mod.config(config); -mod.controller('MapSidebarCtrl', MapSidebarCtrl); diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css index 65151a7731..e761518ccb 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -41,5 +41,10 @@ vertical-align: bottom; display: flex; flex-direction: column-reverse; +} +.current-layer-details table { + background: #f0f0f0; + color: #6b6a6a; + margin-bottom: 0px; } From 9a1deef02f3ed3276a1165a88c500dd75fa71a76 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Wed, 15 Feb 2017 16:27:07 -0600 Subject: [PATCH 007/520] exif reader and saving --- .../apps/geo/scripts/controllers/index.js | 7 + .../scripts/directives/custom-on-change.js | 9 + .../apps/geo/scripts/directives/index.js | 7 + .../apps/geo/scripts/services/index.js | 7 + designsafe/static/vendor/exif-js/.bower.json | 33 + designsafe/static/vendor/exif-js/LICENSE.md | 21 + designsafe/static/vendor/exif-js/README.md | 3 + designsafe/static/vendor/exif-js/bower.json | 23 + designsafe/static/vendor/exif-js/exif.js | 805 ++++++++++++++++++ designsafe/static/vendor/exif-js/package.json | 38 + 10 files changed, 953 insertions(+) create mode 100644 designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js create mode 100644 designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js create mode 100644 designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js create mode 100644 designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js create mode 100644 designsafe/static/vendor/exif-js/.bower.json create mode 100644 designsafe/static/vendor/exif-js/LICENSE.md create mode 100644 designsafe/static/vendor/exif-js/README.md create mode 100644 designsafe/static/vendor/exif-js/bower.json create mode 100644 designsafe/static/vendor/exif-js/exif.js create mode 100644 designsafe/static/vendor/exif-js/package.json diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js new file mode 100644 index 0000000000..3c556e0b85 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js @@ -0,0 +1,7 @@ +import MapSidebarCtrl from './map-sidebar'; + +let mod = angular.module('ds.geo.controllers', []); + +mod.controller('MapSidebarCtrl', MapSidebarCtrl); + +export default mod; diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js new file mode 100644 index 0000000000..2360d6f53f --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js @@ -0,0 +1,9 @@ +export default function customOnChange() { + return { + restrict: 'A', + link: function (scope, element, attrs) { + var onChangeHandler = scope.$eval(attrs.customOnChange); + element.bind('change', onChangeHandler); + } + }; +} diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js new file mode 100644 index 0000000000..111a4e0b55 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js @@ -0,0 +1,7 @@ +import customOnChange from './custom-on-change'; + +let mod = angular.module('ds.geo.directives', []); + +mod.directive('customOnChange', customOnChange); + +export default mod; diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js new file mode 100644 index 0000000000..56ffa33098 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js @@ -0,0 +1,7 @@ +// import customOnChange from './custom-on-change'; + +let mod = angular.module('ds.geo.services', []); + +// mod.directive('customOnChange', customOnChange); + +export default mod; diff --git a/designsafe/static/vendor/exif-js/.bower.json b/designsafe/static/vendor/exif-js/.bower.json new file mode 100644 index 0000000000..4f503b0004 --- /dev/null +++ b/designsafe/static/vendor/exif-js/.bower.json @@ -0,0 +1,33 @@ +{ + "name": "exif-js", + "version": "2.1.1", + "homepage": "https://github.com/exif-js/exif-js", + "authors": [ + "Jacob Seidelin" + ], + "description": "JavaScript library for reading EXIF image metadata", + "main": "exif.js", + "keywords": [ + "exif" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests", + "spec", + "example" + ], + "_release": "2.1.1", + "_resolution": { + "type": "version", + "tag": "v2.1.1", + "commit": "ee4d6b161215020b3fd8a14a89de7f6456f5014b" + }, + "_source": "https://github.com/jseidelin/exif-js.git", + "_target": "^2.1.1", + "_originalSource": "exif-js", + "_direct": true +} \ No newline at end of file diff --git a/designsafe/static/vendor/exif-js/LICENSE.md b/designsafe/static/vendor/exif-js/LICENSE.md new file mode 100644 index 0000000000..455a8fc587 --- /dev/null +++ b/designsafe/static/vendor/exif-js/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2008 Jacob Seidelin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/designsafe/static/vendor/exif-js/README.md b/designsafe/static/vendor/exif-js/README.md new file mode 100644 index 0000000000..0071072617 --- /dev/null +++ b/designsafe/static/vendor/exif-js/README.md @@ -0,0 +1,3 @@ +#Exif.js + +A JavaScript library for reading EXIF meta data from JPEG image files. \ No newline at end of file diff --git a/designsafe/static/vendor/exif-js/bower.json b/designsafe/static/vendor/exif-js/bower.json new file mode 100644 index 0000000000..8058a05b41 --- /dev/null +++ b/designsafe/static/vendor/exif-js/bower.json @@ -0,0 +1,23 @@ +{ + "name": "exif-js", + "version": "2.1.1", + "homepage": "https://github.com/exif-js/exif-js", + "authors": [ + "Jacob Seidelin" + ], + "description": "JavaScript library for reading EXIF image metadata", + "main": "exif.js", + "keywords": [ + "exif" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests", + "spec", + "example" + ] +} diff --git a/designsafe/static/vendor/exif-js/exif.js b/designsafe/static/vendor/exif-js/exif.js new file mode 100644 index 0000000000..296a338bee --- /dev/null +++ b/designsafe/static/vendor/exif-js/exif.js @@ -0,0 +1,805 @@ +(function() { + + var debug = false; + + var root = this; + + var EXIF = function(obj) { + if (obj instanceof EXIF) return obj; + if (!(this instanceof EXIF)) return new EXIF(obj); + this.EXIFwrapped = obj; + }; + + if (typeof exports !== 'undefined') { + if (typeof module !== 'undefined' && module.exports) { + exports = module.exports = EXIF; + } + exports.EXIF = EXIF; + } else { + root.EXIF = EXIF; + } + + var ExifTags = EXIF.Tags = { + + // version tags + 0x9000 : "ExifVersion", // EXIF version + 0xA000 : "FlashpixVersion", // Flashpix format version + + // colorspace tags + 0xA001 : "ColorSpace", // Color space information tag + + // image configuration + 0xA002 : "PixelXDimension", // Valid width of meaningful image + 0xA003 : "PixelYDimension", // Valid height of meaningful image + 0x9101 : "ComponentsConfiguration", // Information about channels + 0x9102 : "CompressedBitsPerPixel", // Compressed bits per pixel + + // user information + 0x927C : "MakerNote", // Any desired information written by the manufacturer + 0x9286 : "UserComment", // Comments by user + + // related file + 0xA004 : "RelatedSoundFile", // Name of related sound file + + // date and time + 0x9003 : "DateTimeOriginal", // Date and time when the original image was generated + 0x9004 : "DateTimeDigitized", // Date and time when the image was stored digitally + 0x9290 : "SubsecTime", // Fractions of seconds for DateTime + 0x9291 : "SubsecTimeOriginal", // Fractions of seconds for DateTimeOriginal + 0x9292 : "SubsecTimeDigitized", // Fractions of seconds for DateTimeDigitized + + // picture-taking conditions + 0x829A : "ExposureTime", // Exposure time (in seconds) + 0x829D : "FNumber", // F number + 0x8822 : "ExposureProgram", // Exposure program + 0x8824 : "SpectralSensitivity", // Spectral sensitivity + 0x8827 : "ISOSpeedRatings", // ISO speed rating + 0x8828 : "OECF", // Optoelectric conversion factor + 0x9201 : "ShutterSpeedValue", // Shutter speed + 0x9202 : "ApertureValue", // Lens aperture + 0x9203 : "BrightnessValue", // Value of brightness + 0x9204 : "ExposureBias", // Exposure bias + 0x9205 : "MaxApertureValue", // Smallest F number of lens + 0x9206 : "SubjectDistance", // Distance to subject in meters + 0x9207 : "MeteringMode", // Metering mode + 0x9208 : "LightSource", // Kind of light source + 0x9209 : "Flash", // Flash status + 0x9214 : "SubjectArea", // Location and area of main subject + 0x920A : "FocalLength", // Focal length of the lens in mm + 0xA20B : "FlashEnergy", // Strobe energy in BCPS + 0xA20C : "SpatialFrequencyResponse", // + 0xA20E : "FocalPlaneXResolution", // Number of pixels in width direction per FocalPlaneResolutionUnit + 0xA20F : "FocalPlaneYResolution", // Number of pixels in height direction per FocalPlaneResolutionUnit + 0xA210 : "FocalPlaneResolutionUnit", // Unit for measuring FocalPlaneXResolution and FocalPlaneYResolution + 0xA214 : "SubjectLocation", // Location of subject in image + 0xA215 : "ExposureIndex", // Exposure index selected on camera + 0xA217 : "SensingMethod", // Image sensor type + 0xA300 : "FileSource", // Image source (3 == DSC) + 0xA301 : "SceneType", // Scene type (1 == directly photographed) + 0xA302 : "CFAPattern", // Color filter array geometric pattern + 0xA401 : "CustomRendered", // Special processing + 0xA402 : "ExposureMode", // Exposure mode + 0xA403 : "WhiteBalance", // 1 = auto white balance, 2 = manual + 0xA404 : "DigitalZoomRation", // Digital zoom ratio + 0xA405 : "FocalLengthIn35mmFilm", // Equivalent foacl length assuming 35mm film camera (in mm) + 0xA406 : "SceneCaptureType", // Type of scene + 0xA407 : "GainControl", // Degree of overall image gain adjustment + 0xA408 : "Contrast", // Direction of contrast processing applied by camera + 0xA409 : "Saturation", // Direction of saturation processing applied by camera + 0xA40A : "Sharpness", // Direction of sharpness processing applied by camera + 0xA40B : "DeviceSettingDescription", // + 0xA40C : "SubjectDistanceRange", // Distance to subject + + // other tags + 0xA005 : "InteroperabilityIFDPointer", + 0xA420 : "ImageUniqueID" // Identifier assigned uniquely to each image + }; + + var TiffTags = EXIF.TiffTags = { + 0x0100 : "ImageWidth", + 0x0101 : "ImageHeight", + 0x8769 : "ExifIFDPointer", + 0x8825 : "GPSInfoIFDPointer", + 0xA005 : "InteroperabilityIFDPointer", + 0x0102 : "BitsPerSample", + 0x0103 : "Compression", + 0x0106 : "PhotometricInterpretation", + 0x0112 : "Orientation", + 0x0115 : "SamplesPerPixel", + 0x011C : "PlanarConfiguration", + 0x0212 : "YCbCrSubSampling", + 0x0213 : "YCbCrPositioning", + 0x011A : "XResolution", + 0x011B : "YResolution", + 0x0128 : "ResolutionUnit", + 0x0111 : "StripOffsets", + 0x0116 : "RowsPerStrip", + 0x0117 : "StripByteCounts", + 0x0201 : "JPEGInterchangeFormat", + 0x0202 : "JPEGInterchangeFormatLength", + 0x012D : "TransferFunction", + 0x013E : "WhitePoint", + 0x013F : "PrimaryChromaticities", + 0x0211 : "YCbCrCoefficients", + 0x0214 : "ReferenceBlackWhite", + 0x0132 : "DateTime", + 0x010E : "ImageDescription", + 0x010F : "Make", + 0x0110 : "Model", + 0x0131 : "Software", + 0x013B : "Artist", + 0x8298 : "Copyright" + }; + + var GPSTags = EXIF.GPSTags = { + 0x0000 : "GPSVersionID", + 0x0001 : "GPSLatitudeRef", + 0x0002 : "GPSLatitude", + 0x0003 : "GPSLongitudeRef", + 0x0004 : "GPSLongitude", + 0x0005 : "GPSAltitudeRef", + 0x0006 : "GPSAltitude", + 0x0007 : "GPSTimeStamp", + 0x0008 : "GPSSatellites", + 0x0009 : "GPSStatus", + 0x000A : "GPSMeasureMode", + 0x000B : "GPSDOP", + 0x000C : "GPSSpeedRef", + 0x000D : "GPSSpeed", + 0x000E : "GPSTrackRef", + 0x000F : "GPSTrack", + 0x0010 : "GPSImgDirectionRef", + 0x0011 : "GPSImgDirection", + 0x0012 : "GPSMapDatum", + 0x0013 : "GPSDestLatitudeRef", + 0x0014 : "GPSDestLatitude", + 0x0015 : "GPSDestLongitudeRef", + 0x0016 : "GPSDestLongitude", + 0x0017 : "GPSDestBearingRef", + 0x0018 : "GPSDestBearing", + 0x0019 : "GPSDestDistanceRef", + 0x001A : "GPSDestDistance", + 0x001B : "GPSProcessingMethod", + 0x001C : "GPSAreaInformation", + 0x001D : "GPSDateStamp", + 0x001E : "GPSDifferential" + }; + + var StringValues = EXIF.StringValues = { + ExposureProgram : { + 0 : "Not defined", + 1 : "Manual", + 2 : "Normal program", + 3 : "Aperture priority", + 4 : "Shutter priority", + 5 : "Creative program", + 6 : "Action program", + 7 : "Portrait mode", + 8 : "Landscape mode" + }, + MeteringMode : { + 0 : "Unknown", + 1 : "Average", + 2 : "CenterWeightedAverage", + 3 : "Spot", + 4 : "MultiSpot", + 5 : "Pattern", + 6 : "Partial", + 255 : "Other" + }, + LightSource : { + 0 : "Unknown", + 1 : "Daylight", + 2 : "Fluorescent", + 3 : "Tungsten (incandescent light)", + 4 : "Flash", + 9 : "Fine weather", + 10 : "Cloudy weather", + 11 : "Shade", + 12 : "Daylight fluorescent (D 5700 - 7100K)", + 13 : "Day white fluorescent (N 4600 - 5400K)", + 14 : "Cool white fluorescent (W 3900 - 4500K)", + 15 : "White fluorescent (WW 3200 - 3700K)", + 17 : "Standard light A", + 18 : "Standard light B", + 19 : "Standard light C", + 20 : "D55", + 21 : "D65", + 22 : "D75", + 23 : "D50", + 24 : "ISO studio tungsten", + 255 : "Other" + }, + Flash : { + 0x0000 : "Flash did not fire", + 0x0001 : "Flash fired", + 0x0005 : "Strobe return light not detected", + 0x0007 : "Strobe return light detected", + 0x0009 : "Flash fired, compulsory flash mode", + 0x000D : "Flash fired, compulsory flash mode, return light not detected", + 0x000F : "Flash fired, compulsory flash mode, return light detected", + 0x0010 : "Flash did not fire, compulsory flash mode", + 0x0018 : "Flash did not fire, auto mode", + 0x0019 : "Flash fired, auto mode", + 0x001D : "Flash fired, auto mode, return light not detected", + 0x001F : "Flash fired, auto mode, return light detected", + 0x0020 : "No flash function", + 0x0041 : "Flash fired, red-eye reduction mode", + 0x0045 : "Flash fired, red-eye reduction mode, return light not detected", + 0x0047 : "Flash fired, red-eye reduction mode, return light detected", + 0x0049 : "Flash fired, compulsory flash mode, red-eye reduction mode", + 0x004D : "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected", + 0x004F : "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected", + 0x0059 : "Flash fired, auto mode, red-eye reduction mode", + 0x005D : "Flash fired, auto mode, return light not detected, red-eye reduction mode", + 0x005F : "Flash fired, auto mode, return light detected, red-eye reduction mode" + }, + SensingMethod : { + 1 : "Not defined", + 2 : "One-chip color area sensor", + 3 : "Two-chip color area sensor", + 4 : "Three-chip color area sensor", + 5 : "Color sequential area sensor", + 7 : "Trilinear sensor", + 8 : "Color sequential linear sensor" + }, + SceneCaptureType : { + 0 : "Standard", + 1 : "Landscape", + 2 : "Portrait", + 3 : "Night scene" + }, + SceneType : { + 1 : "Directly photographed" + }, + CustomRendered : { + 0 : "Normal process", + 1 : "Custom process" + }, + WhiteBalance : { + 0 : "Auto white balance", + 1 : "Manual white balance" + }, + GainControl : { + 0 : "None", + 1 : "Low gain up", + 2 : "High gain up", + 3 : "Low gain down", + 4 : "High gain down" + }, + Contrast : { + 0 : "Normal", + 1 : "Soft", + 2 : "Hard" + }, + Saturation : { + 0 : "Normal", + 1 : "Low saturation", + 2 : "High saturation" + }, + Sharpness : { + 0 : "Normal", + 1 : "Soft", + 2 : "Hard" + }, + SubjectDistanceRange : { + 0 : "Unknown", + 1 : "Macro", + 2 : "Close view", + 3 : "Distant view" + }, + FileSource : { + 3 : "DSC" + }, + + Components : { + 0 : "", + 1 : "Y", + 2 : "Cb", + 3 : "Cr", + 4 : "R", + 5 : "G", + 6 : "B" + } + }; + + function addEvent(element, event, handler) { + if (element.addEventListener) { + element.addEventListener(event, handler, false); + } else if (element.attachEvent) { + element.attachEvent("on" + event, handler); + } + } + + function imageHasData(img) { + return !!(img.exifdata); + } + + + function base64ToArrayBuffer(base64, contentType) { + contentType = contentType || base64.match(/^data\:([^\;]+)\;base64,/mi)[1] || ''; // e.g. 'data:image/jpeg;base64,...' => 'image/jpeg' + base64 = base64.replace(/^data\:([^\;]+)\;base64,/gmi, ''); + var binary = atob(base64); + var len = binary.length; + var buffer = new ArrayBuffer(len); + var view = new Uint8Array(buffer); + for (var i = 0; i < len; i++) { + view[i] = binary.charCodeAt(i); + } + return buffer; + } + + function objectURLToBlob(url, callback) { + var http = new XMLHttpRequest(); + http.open("GET", url, true); + http.responseType = "blob"; + http.onload = function(e) { + if (this.status == 200 || this.status === 0) { + callback(this.response); + } + }; + http.send(); + } + + function getImageData(img, callback) { + function handleBinaryFile(binFile) { + var data = findEXIFinJPEG(binFile); + var iptcdata = findIPTCinJPEG(binFile); + img.exifdata = data || {}; + img.iptcdata = iptcdata || {}; + if (callback) { + callback.call(img); + } + } + + if (img.src) { + if (/^data\:/i.test(img.src)) { // Data URI + var arrayBuffer = base64ToArrayBuffer(img.src); + handleBinaryFile(arrayBuffer); + + } else if (/^blob\:/i.test(img.src)) { // Object URL + var fileReader = new FileReader(); + fileReader.onload = function(e) { + handleBinaryFile(e.target.result); + }; + objectURLToBlob(img.src, function (blob) { + fileReader.readAsArrayBuffer(blob); + }); + } else { + var http = new XMLHttpRequest(); + http.onload = function() { + if (this.status == 200 || this.status === 0) { + handleBinaryFile(http.response); + } else { + throw "Could not load image"; + } + http = null; + }; + http.open("GET", img.src, true); + http.responseType = "arraybuffer"; + http.send(null); + } + } else if (window.FileReader && (img instanceof window.Blob || img instanceof window.File)) { + var fileReader = new FileReader(); + fileReader.onload = function(e) { + if (debug) console.log("Got file of length " + e.target.result.byteLength); + handleBinaryFile(e.target.result); + }; + + fileReader.readAsArrayBuffer(img); + } + } + + function findEXIFinJPEG(file) { + var dataView = new DataView(file); + + if (debug) console.log("Got file of length " + file.byteLength); + if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) { + if (debug) console.log("Not a valid JPEG"); + return false; // not a valid jpeg + } + + var offset = 2, + length = file.byteLength, + marker; + + while (offset < length) { + if (dataView.getUint8(offset) != 0xFF) { + if (debug) console.log("Not a valid marker at offset " + offset + ", found: " + dataView.getUint8(offset)); + return false; // not a valid marker, something is wrong + } + + marker = dataView.getUint8(offset + 1); + if (debug) console.log(marker); + + // we could implement handling for other markers here, + // but we're only looking for 0xFFE1 for EXIF data + + if (marker == 225) { + if (debug) console.log("Found 0xFFE1 marker"); + + return readEXIFData(dataView, offset + 4, dataView.getUint16(offset + 2) - 2); + + // offset += 2 + file.getShortAt(offset+2, true); + + } else { + offset += 2 + dataView.getUint16(offset+2); + } + + } + + } + + function findIPTCinJPEG(file) { + var dataView = new DataView(file); + + if (debug) console.log("Got file of length " + file.byteLength); + if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) { + if (debug) console.log("Not a valid JPEG"); + return false; // not a valid jpeg + } + + var offset = 2, + length = file.byteLength; + + + var isFieldSegmentStart = function(dataView, offset){ + return ( + dataView.getUint8(offset) === 0x38 && + dataView.getUint8(offset+1) === 0x42 && + dataView.getUint8(offset+2) === 0x49 && + dataView.getUint8(offset+3) === 0x4D && + dataView.getUint8(offset+4) === 0x04 && + dataView.getUint8(offset+5) === 0x04 + ); + }; + + while (offset < length) { + + if ( isFieldSegmentStart(dataView, offset )){ + + // Get the length of the name header (which is padded to an even number of bytes) + var nameHeaderLength = dataView.getUint8(offset+7); + if(nameHeaderLength % 2 !== 0) nameHeaderLength += 1; + // Check for pre photoshop 6 format + if(nameHeaderLength === 0) { + // Always 4 + nameHeaderLength = 4; + } + + var startOffset = offset + 8 + nameHeaderLength; + var sectionLength = dataView.getUint16(offset + 6 + nameHeaderLength); + + return readIPTCData(file, startOffset, sectionLength); + + break; + + } + + + // Not the marker, continue searching + offset++; + + } + + } + var IptcFieldMap = { + 0x78 : 'caption', + 0x6E : 'credit', + 0x19 : 'keywords', + 0x37 : 'dateCreated', + 0x50 : 'byline', + 0x55 : 'bylineTitle', + 0x7A : 'captionWriter', + 0x69 : 'headline', + 0x74 : 'copyright', + 0x0F : 'category' + }; + function readIPTCData(file, startOffset, sectionLength){ + var dataView = new DataView(file); + var data = {}; + var fieldValue, fieldName, dataSize, segmentType, segmentSize; + var segmentStartPos = startOffset; + while(segmentStartPos < startOffset+sectionLength) { + if(dataView.getUint8(segmentStartPos) === 0x1C && dataView.getUint8(segmentStartPos+1) === 0x02){ + segmentType = dataView.getUint8(segmentStartPos+2); + if(segmentType in IptcFieldMap) { + dataSize = dataView.getInt16(segmentStartPos+3); + segmentSize = dataSize + 5; + fieldName = IptcFieldMap[segmentType]; + fieldValue = getStringFromDB(dataView, segmentStartPos+5, dataSize); + // Check if we already stored a value with this name + if(data.hasOwnProperty(fieldName)) { + // Value already stored with this name, create multivalue field + if(data[fieldName] instanceof Array) { + data[fieldName].push(fieldValue); + } + else { + data[fieldName] = [data[fieldName], fieldValue]; + } + } + else { + data[fieldName] = fieldValue; + } + } + + } + segmentStartPos++; + } + return data; + } + + + + function readTags(file, tiffStart, dirStart, strings, bigEnd) { + var entries = file.getUint16(dirStart, !bigEnd), + tags = {}, + entryOffset, tag, + i; + + for (i=0;i 4 ? valueOffset : (entryOffset + 8); + vals = []; + for (n=0;n 4 ? valueOffset : (entryOffset + 8); + return getStringFromDB(file, offset, numValues-1); + + case 3: // short, 16 bit int + if (numValues == 1) { + return file.getUint16(entryOffset + 8, !bigEnd); + } else { + offset = numValues > 2 ? valueOffset : (entryOffset + 8); + vals = []; + for (n=0;n Date: Wed, 15 Feb 2017 16:30:45 -0600 Subject: [PATCH 008/520] exif reader and saving --- .../apps/geo/scripts/build/bundle.js | 31 +++++++++++++++++++ .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 28 +++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index 27b1af88ef..950f2ba45a 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -164,6 +164,37 @@ var MapSidebarCtrl = function () { _this2.map.fitBounds(_this2.drawnItems.getBounds()); }; } + }, { + key: 'load_image', + value: function load_image(ev) { + var _this3 = this; + + //Get the photo from the input form + var input = document.getElementById('Files'); + var files = input.files; + for (var i = 0; i < files.length; i++) { + var file = files[0]; + var reader = new FileReader(); // use HTML5 file reader to get the file + + reader.onloadend = function () { + // get EXIF data + var exif = EXIF.readFromBinaryFile(new BinaryFile(_this3.result)); + + var lat = exif.GPSLatitude; + var lon = exif.GPSLongitude; + + //Convert coordinates to WGS84 decimal + var latRef = exif.GPSLatitudeRef || "N"; + var lonRef = exif.GPSLongitudeRef || "W"; + lat = (lat[0] + lat[1] / 60 + lat[2] / 3600) * (latRef == "N" ? 1 : -1); + lon = (lon[0] + lon[1] / 60 + lon[2] / 3600) * (lonRef == "W" ? -1 : 1); + + //Send the coordinates to your map + Map.AddMarker(lat, lon); + }; + reader.readAsBinaryString(file); + } + } }, { key: 'update_color', value: function update_color() { diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index a88ec9beaf..8f3340a148 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap f7342c032e993657eddb","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"names":["MapSidebarCtrl","$scope","$window","$timeout","LGeo","angular","element","hide","map","L","setView","local_file_selected","attribution","addTo","drawnItems","addLayer","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","object","options","color","fillColor","fillOpacity","$apply","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","setStyle","console","log","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth","directive","restrict","link","onChangeHandler","bind"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;IChEqBA,c;AAEnB,0BAAaC,MAAb,EAAqBC,OAArB,EAA8BC,QAA9B,EAAwC;AACtC;;AADsC;;AAAA;;AAEtC;AACA,SAAKC,IAAL,GAAYF,QAAQE,CAApB;AACA,SAAKD,QAAL,GAAgBA,QAAhB;AACAE,YAAQC,OAAR,CAAgB,QAAhB;AACAD,YAAQC,OAAR,CAAg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SAAO;AACLS,cAAU,GADL;AAELC,UAAuC;AACrC,UAAIC,QAAJ;AACA9D,cAAQ+D,IAAR,CAAa,QAAb,EAAuBD,eAAvB;AACD;AALI,GAAP;AAOD,C;;;;;;;;;;;;;ACRD;;;;;;AAEA,IAAIX,MAAMpD,QAAQqD,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAD,IAAIK,UAAJ,CAAe,gBAAf;;kBAEeL,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMpD,QAAQqD,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeD,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f7342c032e993657eddb","export default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.map = L.map('geo_map').setView([51.505, -0.09], 13);\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n }).addTo(this.map);\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n if (this.current_layer == e.layer) {\n this.current_layer = null;\n } else {\n this.current_layer = e.layer;\n };\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillColor = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n }\n\n open_file_dialog () {\n this.$timeout(()=> {\n angular.element('#local_file').trigger('click');\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n update_color () {\n this.current_layer.setStyle({color: this.current_layer.options.color});\n }\n\n update_fill () {\n this.current_layer.setStyle({fillColor: this.current_layer.options.fillColor});\n this.current_layer.setStyle({color: this.current_layer.options.fillColor});\n }\n\n update_opacity () {\n this.current_layer.setStyle({fillOpacity: this.current_layer.options.fillOpacity});\n }\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 7f0debae0f446c13271f","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"names":["MapSidebarCtrl","$scope","$window","$timeout","LGeo","angular","element","hide","map","L","setView","local_file_selected","attribution","addTo","drawnItems","addLayer","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","object","options","color","fillColor","fillOpacity","$apply","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","input","document","getElementById","files","i","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","console","log","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth","directive","restrict","link","onChangeHandler","bind"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;IChEqBA,c;AAEnB,0BAAaC,MAAb,EAAqBC,OAArB,EAA8BC,QAA9B,EAAwC;AACtC;;AADsC;;AAAA;;AAEtC;AACA,SAAKC,IAAL,GAAYF,QAAQE,CAApB;AACA,SAAKD,QAAL,GAAgBA,QAAhB;AACAE,YAAQC,OAAR,CAAgB,QAAhB;AACAD,YAAQC,OAAR,CAAgB,KAAhB,EAAuBC,IAAvB;AACAF,YAAQC,OAAR,CAAgB,QAAhB,EAA0BC,IAA1B;AACA,SAAKC,GAAL,GAAWC,EAAED,GAAF,CAAM,SAAN,EAAiBE,KAA5B;;AAEA;AACA,SAAKC,mBAAL,GAA2B,KAAKA,MAAhC;;AAEkE;AAC9DC,mBAAa;AADiD,KAAlE,EAEGC,KAFH,CAES,KAAKL,GAFd;AAGA,SAAKM,UAAL,GAAkB,CAAlB;AACA,SAAKN,GAAL,CAASO,QAAT,CAAkB,KAAKD,UAAvB;;AAEqC;AACpCE,gBAAU,UAD0B;AAEpCC,YAAM;AACLC,aAAQ;AADH,OAF8B;AAKpCC,QAAM;AACJC,aADI;AAEJC,gBAAQ;AAFJ;AAL8B,KAAnB,CAAlB;;AAWmC;AACjC,UAAI,MAAKC,aAAL,IAAsBC,EAAEC,KAA5B,EAAmC;AACjC,cAAKF,aAAL,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;;;;;;;;;;;;AC1Bf;;;;;;AAEA,IAAIA,MAAMpE,QAAQqE,MAAR,CAAe,mBAAf,EAAoC,EAApC,CAAV;;AAEAD,IAAIQ,SAAJ,CAAc,gBAAd;;kBAEeR,G;;;;;;;;;;;;;ACNA,GAA0B;AACvC,SAAO;AACLS,cAAU,GADL;AAELC,UAAuC;AACrC,UAAIC,QAAJ;AACA9E,cAAQ+E,IAAR,CAAa,QAAb,EAAuBD,eAAvB;AACD;AALI,GAAP;AAOD,C;;;;;;;;;;;;;ACRD;;;;;;AAEA,IAAIX,MAAMpE,QAAQqE,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAD,IAAIK,UAAJ,CAAe,gBAAf;;kBAEeL,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMpE,QAAQqE,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeD,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 7f0debae0f446c13271f","export default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.map = L.map('geo_map').setView([51.505, -0.09], 13);\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n }).addTo(this.map);\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n if (this.current_layer == e.layer) {\n this.current_layer = null;\n } else {\n this.current_layer = e.layer;\n };\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillColor = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n }\n\n open_file_dialog () {\n this.$timeout(()=> {\n angular.element('#local_file').trigger('click');\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n //Get the photo from the input form\n var input = document.getElementById('Files');\n var files = input.files;\n for (var i = 0; i < files.length; i++) {\n var file = files[0];\n var reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.onloadend = ()=> {\n // get EXIF data\n var exif = EXIF.readFromBinaryFile(new BinaryFile(this.result));\n\n var lat = exif.GPSLatitude;\n var lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n var latRef = exif.GPSLatitudeRef || \"N\";\n var lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n reader.readAsBinaryString(file);\n }\n }\n\n update_color () {\n this.current_layer.setStyle({color: this.current_layer.options.color});\n }\n\n update_fill () {\n this.current_layer.setStyle({fillColor: this.current_layer.options.fillColor});\n this.current_layer.setStyle({color: this.current_layer.options.fillColor});\n }\n\n update_opacity () {\n this.current_layer.setStyle({fillOpacity: this.current_layer.options.fillOpacity});\n }\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index 4b276784f6..91661b5c82 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -73,6 +73,34 @@ export default class MapSidebarCtrl { }; } + load_image (ev) { + //Get the photo from the input form + var input = document.getElementById('Files'); + var files = input.files; + for (var i = 0; i < files.length; i++) { + var file = files[0]; + var reader = new FileReader; // use HTML5 file reader to get the file + + reader.onloadend = ()=> { + // get EXIF data + var exif = EXIF.readFromBinaryFile(new BinaryFile(this.result)); + + var lat = exif.GPSLatitude; + var lon = exif.GPSLongitude; + + //Convert coordinates to WGS84 decimal + var latRef = exif.GPSLatitudeRef || "N"; + var lonRef = exif.GPSLongitudeRef || "W"; + lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == "N" ? 1 : -1); + lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == "W" ? -1 : 1); + + //Send the coordinates to your map + Map.AddMarker(lat,lon); + }; + reader.readAsBinaryString(file); + } + } + update_color () { this.current_layer.setStyle({color: this.current_layer.options.color}); } From e07d8febeaba44f796d32620e8154506ac3bb4b3 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Thu, 16 Feb 2017 08:19:06 -0600 Subject: [PATCH 009/520] images --- .../static/designsafe/apps/geo/html/map.html | 5 +-- .../apps/geo/scripts/build/bundle.js | 17 ++++++---- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 34 +++++++++++-------- .../templates/designsafe/apps/geo/index.html | 7 ++-- 5 files changed, 38 insertions(+), 27 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 0f40dd8bea..7ac28a3bb0 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -20,8 +20,9 @@ Import locally
  • -
  • - Add an image +
  • + + Add an image
  • diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index 950f2ba45a..708c1f8fa0 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -96,7 +96,7 @@ var MapSidebarCtrl = function () { angular.element('header').hide(); angular.element('nav').hide(); angular.element('footer').hide(); - this.map = L.map('geo_map').setView([51.505, -0.09], 13); + this.map = L.map('geo_map').setView([51.505, -0.09], 6); //method binding for callback, sigh... this.local_file_selected = this.local_file_selected.bind(this); @@ -147,6 +147,13 @@ var MapSidebarCtrl = function () { angular.element('#local_file').trigger('click'); }); } + }, { + key: 'open_image_dialog', + value: function open_image_dialog() { + this.$timeout(function () { + angular.element('#local_image').trigger('click'); + }); + } }, { key: 'local_file_selected', value: function local_file_selected(ev) { @@ -169,16 +176,15 @@ var MapSidebarCtrl = function () { value: function load_image(ev) { var _this3 = this; - //Get the photo from the input form - var input = document.getElementById('Files'); - var files = input.files; + var files = ev.target.files; for (var i = 0; i < files.length; i++) { var file = files[0]; var reader = new FileReader(); // use HTML5 file reader to get the file + reader.readAsArrayBuffer(file); reader.onloadend = function () { // get EXIF data - var exif = EXIF.readFromBinaryFile(new BinaryFile(_this3.result)); + var exif = EXIF.readFromBinaryFile(_this3.result); var lat = exif.GPSLatitude; var lon = exif.GPSLongitude; @@ -192,7 +198,6 @@ var MapSidebarCtrl = function () { //Send the coordinates to your map Map.AddMarker(lat, lon); }; - reader.readAsBinaryString(file); } } }, { diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 8f3340a148..bcc899a868 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 7f0debae0f446c13271f","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"names":["MapSidebarCtrl","$scope","$window","$timeout","LGeo","angular","element","hide","map","L","setView","local_file_selected","attribution","addTo","drawnItems","addLayer","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","object","options","color","fillColor","fillOpacity","$apply","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","input","document","getElementById","files","i","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","console","log","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth","directive","restrict","link","onChangeHandler","bind"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AA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C,CAAV;;AAEAD,IAAIK,UAAJ,CAAe,gBAAf;;kBAEeL,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMpE,QAAQqE,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeD,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 7f0debae0f446c13271f","export default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.map = L.map('geo_map').setView([51.505, -0.09], 13);\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n }).addTo(this.map);\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n if (this.current_layer == e.layer) {\n this.current_layer = null;\n } else {\n this.current_layer = e.layer;\n };\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillColor = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n }\n\n open_file_dialog () {\n this.$timeout(()=> {\n angular.element('#local_file').trigger('click');\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n //Get the photo from the input form\n var input = document.getElementById('Files');\n var files = input.files;\n for (var i = 0; i < files.length; i++) {\n var file = files[0];\n var reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.onloadend = ()=> {\n // get EXIF data\n var exif = EXIF.readFromBinaryFile(new BinaryFile(this.result));\n\n var lat = exif.GPSLatitude;\n var lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n var latRef = exif.GPSLatitudeRef || \"N\";\n var lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n reader.readAsBinaryString(file);\n }\n }\n\n update_color () {\n this.current_layer.setStyle({color: this.current_layer.options.color});\n }\n\n update_fill () {\n this.current_layer.setStyle({fillColor: this.current_layer.options.fillColor});\n this.current_layer.setStyle({color: this.current_layer.options.fillColor});\n }\n\n update_opacity () {\n this.current_layer.setStyle({fillOpacity: this.current_layer.options.fillOpacity});\n }\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 3019c84bfce5d7d86c53","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"names":["MapSidebarCtrl","$scope","$window","$timeout","LGeo","angular","element","hide","map","L","setView","local_file_selected","attribution","addTo","drawnItems","addLayer","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","object","options","color","fillColor","fillOpacity","$apply","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","i","files","length","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","console","log","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth","directive","restrict","link","onChangeHandler","bind"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;IChEqBA,c;AAEnB,0BAAaC,MAAb,EAAqBC,OAArB,EAA8BC,QAA9B,EAAwC;AACtC;;AADsC;;AAAA;;AAEtC;AACA,SAAKC,IAAL,GAAYF,QAAQE,CAApB;AACA,SAAKD,QAAL,GAAgBA,QAAhB;AACAE,YAAQC,OAAR,CAAgB,QAAhB;AACAD,YAAQC,OAAR,CAAgB,KAAhB,EAAuBC,IAAvB;AACAF,YAAQC,OAAR,CAAgB,QAAhB,EAA0BC,IAA1B;AACA,SAAKC,GAAL,GAAWC,EAAED,GAAF,CAAM,SAAN,EAAiBE,KAA5B;;AAEA;AACA,SAAKC,mBAAL,GAA2B,KAAKA,MAAhC;;AAEkE;AAC9DC,mBAAa;AADiD,KAAlE,EAEGC,KAFH,CAES,KAAKL,GAFd;AAGA,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N,GAAhB;AACAI,QAAEG,WAAF;AACAH,QAAEI,KAAF;AACD;;;;;;;;;;;;;;;;;;;ACrIH;;AACA;;AACA;;AAEA,IAAIC,MAAMnE,QAAQoE,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASC,MAAT,CAAgBC,cAAhB,EAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BC,YAH0B;AAI1BC,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAEDP,CAAA;;kBAIeA,C;;;;;;;;;;;;;AC1Bf;;;;;;AAEA,IAAIA,MAAMnE,QAAQoE,MAAR,CAAe,mBAAf,EAAoC,EAApC,CAAV;;AAEAD,IAAIQ,SAAJ,CAAc,gBAAd;;kBAEeR,G;;;;;;;;;;;;;ACNA,GAA0B;AACvC,SAAO;AACLS,cAAU,GADL;AAELC,UAAuC;AACrC,UAAIC,QAAJ;AACA7E,cAAQ8E,IAAR,CAAa,QAAb,EAAuBD,eAAvB;AACD;AALI,GAAP;AAOD,C;;;;;;;;;;;;;ACRD;;;;;;AAEA,IAAIX,MAAMnE,QAAQoE,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAD,IAAIK,UAAJ,CAAe,gBAAf;;kBAEeL,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMnE,QAAQoE,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeD,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 3019c84bfce5d7d86c53","export default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.map = L.map('geo_map').setView([51.505, -0.09], 6);\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n }).addTo(this.map);\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n if (this.current_layer == e.layer) {\n this.current_layer = null;\n } else {\n this.current_layer = e.layer;\n };\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillColor = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n }\n\n open_file_dialog () {\n this.$timeout(()=> {\n angular.element('#local_file').trigger('click');\n });\n }\n\n open_image_dialog () {\n this.$timeout(()=> {\n angular.element('#local_image').trigger('click');\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = () => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(this.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_color () {\n this.current_layer.setStyle({color: this.current_layer.options.color});\n }\n\n update_fill () {\n this.current_layer.setStyle({fillColor: this.current_layer.options.fillColor});\n this.current_layer.setStyle({color: this.current_layer.options.fillColor});\n }\n\n update_opacity () {\n this.current_layer.setStyle({fillOpacity: this.current_layer.options.fillOpacity});\n }\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index 91661b5c82..29bf1047b2 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -8,7 +8,7 @@ export default class MapSidebarCtrl { angular.element('header').hide(); angular.element('nav').hide(); angular.element('footer').hide(); - this.map = L.map('geo_map').setView([51.505, -0.09], 13); + this.map = L.map('geo_map').setView([51.505, -0.09], 6); //method binding for callback, sigh... this.local_file_selected = this.local_file_selected.bind(this); @@ -60,6 +60,12 @@ export default class MapSidebarCtrl { }); } + open_image_dialog () { + this.$timeout(()=> { + angular.element('#local_image').trigger('click'); + }); + } + local_file_selected (ev) { let file = ev.target.files[0]; let reader = new FileReader(); @@ -74,30 +80,28 @@ export default class MapSidebarCtrl { } load_image (ev) { - //Get the photo from the input form - var input = document.getElementById('Files'); - var files = input.files; - for (var i = 0; i < files.length; i++) { - var file = files[0]; - var reader = new FileReader; // use HTML5 file reader to get the file - - reader.onloadend = ()=> { + var files = ev.target.files; + for (let i = 0; i < files.length; i++) { + let file = files[0]; + let reader = new FileReader; // use HTML5 file reader to get the file + + reader.readAsArrayBuffer(file); + reader.onloadend = () => { // get EXIF data - var exif = EXIF.readFromBinaryFile(new BinaryFile(this.result)); + let exif = EXIF.readFromBinaryFile(this.result); - var lat = exif.GPSLatitude; - var lon = exif.GPSLongitude; + let lat = exif.GPSLatitude; + let lon = exif.GPSLongitude; //Convert coordinates to WGS84 decimal - var latRef = exif.GPSLatitudeRef || "N"; - var lonRef = exif.GPSLongitudeRef || "W"; + let latRef = exif.GPSLatitudeRef || "N"; + let lonRef = exif.GPSLongitudeRef || "W"; lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == "N" ? 1 : -1); lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == "W" ? -1 : 1); //Send the coordinates to your map Map.AddMarker(lat,lon); }; - reader.readAsBinaryString(file); } } diff --git a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html index 84805c4d1f..de92ec6194 100644 --- a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html +++ b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html @@ -21,9 +21,10 @@ - - - + + + + {% endaddtoblock %} {% addtoblock 'js' %} From f32b791a038fd6283cf018fc874754b6db8e0b88 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Thu, 16 Feb 2017 08:21:12 -0600 Subject: [PATCH 010/520] images --- .../geo/static/designsafe/apps/geo/scripts/build/bundle.js | 6 ++---- .../static/designsafe/apps/geo/scripts/build/bundle.js.map | 2 +- .../designsafe/apps/geo/scripts/controllers/map-sidebar.js | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index 708c1f8fa0..20fd0c6dd5 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -174,17 +174,15 @@ var MapSidebarCtrl = function () { }, { key: 'load_image', value: function load_image(ev) { - var _this3 = this; - var files = ev.target.files; for (var i = 0; i < files.length; i++) { var file = files[0]; var reader = new FileReader(); // use HTML5 file reader to get the file reader.readAsArrayBuffer(file); - reader.onloadend = function () { + reader.onloadend = function (e) { // get EXIF data - var exif = EXIF.readFromBinaryFile(_this3.result); + var exif = EXIF.readFromBinaryFile(e.target.result); var lat = exif.GPSLatitude; var lon = exif.GPSLongitude; diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index bcc899a868..7de0e04500 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 3019c84bfce5d7d86c53","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"names":["MapSidebarCtrl","$scope","$window","$timeout","LGeo","angular","element","hide","map","L","setView","local_file_selected","attribution","addTo","drawnItems","addLayer","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","object","options","color","fillColor","fillOpacity","$apply","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","i","files","length","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","console","log","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth","directive","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DP,CAAA;;kBAIeA,C;;;;;;;;;;;;;AC1Bf;;;;;;AAEA,IAAIA,MAAMnE,QAAQoE,MAAR,CAAe,mBAAf,EAAoC,EAApC,CAAV;;AAEAD,IAAIQ,SAAJ,CAAc,gBAAd;;kBAEeR,G;;;;;;;;;;;;;ACNA,GAA0B;AACvC,SAAO;AACLS,cAAU,GADL;AAELC,UAAuC;AACrC,UAAIC,QAAJ;AACA7E,cAAQ8E,IAAR,CAAa,QAAb,EAAuBD,eAAvB;AACD;AALI,GAAP;AAOD,C;;;;;;;;;;;;;ACRD;;;;;;AAEA,IAAIX,MAAMnE,QAAQoE,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAD,IAAIK,UAAJ,CAAe,gBAAf;;kBAEeL,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMnE,QAAQoE,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeD,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 3019c84bfce5d7d86c53","export default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.map = L.map('geo_map').setView([51.505, -0.09], 6);\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n }).addTo(this.map);\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n if (this.current_layer == e.layer) {\n this.current_layer = null;\n } else {\n this.current_layer = e.layer;\n };\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillColor = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n }\n\n open_file_dialog () {\n this.$timeout(()=> {\n angular.element('#local_file').trigger('click');\n });\n }\n\n open_image_dialog () {\n this.$timeout(()=> {\n angular.element('#local_image').trigger('click');\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = () => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(this.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_color () {\n this.current_layer.setStyle({color: this.current_layer.options.color});\n }\n\n update_fill () {\n this.current_layer.setStyle({fillColor: this.current_layer.options.fillColor});\n this.current_layer.setStyle({color: this.current_layer.options.fillColor});\n }\n\n update_opacity () {\n this.current_layer.setStyle({fillOpacity: this.current_layer.options.fillOpacity});\n }\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 6757067da5d1593a10d4","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"names":["MapSidebarCtrl","$scope","$window","$timeout","LGeo","angular","element","hide","map","L","setView","local_file_selected","attribution","addTo","drawnItems","addLayer","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","object","options","color","fillColor","fillOpacity","$apply","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","console","log","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth","directive","restrict","link","onChangeHandler","bind"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;IChEqBA,c;AAEnB,0BAAaC,MAAb,EAAqBC,OAArB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e,oBAAf,EAAqC,EAArC,CAAV;;AAEAD,IAAIK,UAAJ,CAAe,gBAAf;;kBAEeL,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMpE,QAAQqE,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeD,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 6757067da5d1593a10d4","export default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.map = L.map('geo_map').setView([51.505, -0.09], 6);\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n }).addTo(this.map);\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n if (this.current_layer == e.layer) {\n this.current_layer = null;\n } else {\n this.current_layer = e.layer;\n };\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillColor = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n }\n\n open_file_dialog () {\n this.$timeout(()=> {\n angular.element('#local_file').trigger('click');\n });\n }\n\n open_image_dialog () {\n this.$timeout(()=> {\n angular.element('#local_image').trigger('click');\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_color () {\n this.current_layer.setStyle({color: this.current_layer.options.color});\n }\n\n update_fill () {\n this.current_layer.setStyle({fillColor: this.current_layer.options.fillColor});\n this.current_layer.setStyle({color: this.current_layer.options.fillColor});\n }\n\n update_opacity () {\n this.current_layer.setStyle({fillOpacity: this.current_layer.options.fillOpacity});\n }\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index 29bf1047b2..a41ab9e50f 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -86,9 +86,9 @@ export default class MapSidebarCtrl { let reader = new FileReader; // use HTML5 file reader to get the file reader.readAsArrayBuffer(file); - reader.onloadend = () => { + reader.onloadend = (e) => { // get EXIF data - let exif = EXIF.readFromBinaryFile(this.result); + let exif = EXIF.readFromBinaryFile(e.target.result); let lat = exif.GPSLatitude; let lon = exif.GPSLongitude; From c02de38558e088dee4f027b7871c316395fff81d Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Thu, 16 Feb 2017 14:04:14 -0600 Subject: [PATCH 011/520] good stopping point --- .../static/designsafe/apps/geo/html/map.html | 15 ++--- .../apps/geo/scripts/build/bundle.js | 48 ++++++++++------ .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 56 ++++++++++++------- .../static/designsafe/apps/geo/styles/geo.css | 8 +-- .../templates/designsafe/apps/geo/index.html | 8 +-- 6 files changed, 83 insertions(+), 54 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 7ac28a3bb0..f7c13e1cbc 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -2,13 +2,15 @@
    • - + + +
    • - Create a new project + Create a new map
    • - Open a project + Open a map
    •  
    • @@ -42,7 +43,7 @@ + ng-change=vm.update_layer_style('fillColor')> @@ -52,7 +53,7 @@ + ng-change=vm.update_layer_style('color')> @@ -62,7 +63,7 @@ + ng-change=vm.update_layer_style('fillOpacity')> diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index 20fd0c6dd5..a9789de2ed 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -96,14 +96,36 @@ var MapSidebarCtrl = function () { angular.element('header').hide(); angular.element('nav').hide(); angular.element('footer').hide(); - this.map = L.map('geo_map').setView([51.505, -0.09], 6); + // L.control.layers({ + // "Street": map.tileLayer, + // "Satellite": L.mapbox.tileLayer("my satellite imagery map id") + // }, null).addTo(this.map); //method binding for callback, sigh... this.local_file_selected = this.local_file_selected.bind(this); - L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + var streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' - }).addTo(this.map); + }); + + var satellite = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { + attribution: '©', + maxZoom: 18 + }); + + var basemaps = { + 'Street': streets, + 'Satellite': satellite + }; + + this.map = L.map('geo_map', { layers: [streets, satellite] }).setView([51.505, -0.09], 6); + + L.control.layers(basemaps).addTo(this.map); + // L.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',{ + // maxZoom: 20, + // subdomains:['mt0','mt1','mt2','mt3'] + // }); + this.drawnItems = new L.FeatureGroup(); this.map.addLayer(this.drawnItems); @@ -138,7 +160,7 @@ var MapSidebarCtrl = function () { _this.current_layer = object; _this.$scope.$apply(); }); - } + } // end constructor _createClass(MapSidebarCtrl, [{ key: 'open_file_dialog', @@ -186,6 +208,7 @@ var MapSidebarCtrl = function () { var lat = exif.GPSLatitude; var lon = exif.GPSLongitude; + console.log(exif); //Convert coordinates to WGS84 decimal var latRef = exif.GPSLatitudeRef || "N"; @@ -199,20 +222,9 @@ var MapSidebarCtrl = function () { } } }, { - key: 'update_color', - value: function update_color() { - this.current_layer.setStyle({ color: this.current_layer.options.color }); - } - }, { - key: 'update_fill', - value: function update_fill() { - this.current_layer.setStyle({ fillColor: this.current_layer.options.fillColor }); - this.current_layer.setStyle({ color: this.current_layer.options.fillColor }); - } - }, { - key: 'update_opacity', - value: function update_opacity() { - this.current_layer.setStyle({ fillOpacity: this.current_layer.options.fillOpacity }); + key: 'update_layer_style', + value: function update_layer_style(prop) { + this.current_layer.setStyle({ prop: this.current_layer.options[prop] }); } }, { key: 'save_project', diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 7de0e04500..92c2c3b8df 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 6757067da5d1593a10d4","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"names":["MapSidebarCtrl","$scope","$window","$timeout","LGeo","angular","element","hide","map","L","setView","local_file_selected","attribution","addTo","drawnItems","addLayer","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","object","options","color","fillColor","fillOpacity","$apply","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","console","log","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth","directive","restrict","link","onChangeHandler","bind"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;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AU,GADL;AAELC,UAAuC;AACrC,UAAIC,QAAJ;AACA9E,cAAQ+E,IAAR,CAAa,QAAb,EAAuBD,eAAvB;AACD;AALI,GAAP;AAOD,C;;;;;;;;;;;;;ACRD;;;;;;AAEA,IAAIX,MAAMpE,QAAQqE,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAD,IAAIK,UAAJ,CAAe,gBAAf;;kBAEeL,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMpE,QAAQqE,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeD,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 6757067da5d1593a10d4","export default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.map = L.map('geo_map').setView([51.505, -0.09], 6);\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n }).addTo(this.map);\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n if (this.current_layer == e.layer) {\n this.current_layer = null;\n } else {\n this.current_layer = e.layer;\n };\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillColor = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n }\n\n open_file_dialog () {\n this.$timeout(()=> {\n angular.element('#local_file').trigger('click');\n });\n }\n\n open_image_dialog () {\n this.$timeout(()=> {\n angular.element('#local_image').trigger('click');\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_color () {\n this.current_layer.setStyle({color: this.current_layer.options.color});\n }\n\n update_fill () {\n this.current_layer.setStyle({fillColor: this.current_layer.options.fillColor});\n this.current_layer.setStyle({color: this.current_layer.options.fillColor});\n }\n\n update_opacity () {\n this.current_layer.setStyle({fillOpacity: this.current_layer.options.fillOpacity});\n }\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 06cc69b7de61efc168e1","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"names":["MapSidebarCtrl","$scope","$window","$timeout","LGeo","angular","element","hide","local_file_selected","attribution","maxZoom","streets","satellite","map","addLayer","drawnItems","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","object","options","color","fillColor","fillOpacity","$apply","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","L","geoJSON","getLayers","forEach","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","console","log","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","prop","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth","directive","restrict","link","onChangeHandler","bind"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;IChEqBA,c;AAEnB,0BAAaC,MAAb,EAAqBC,OAArB,EAA8BC,QAA9B,EAAwC;AACtC;;AADsC;;AAAA;;AAEtC;AACA,SAAKC,IAAL,GAAYF,QAAQE,CAApB;AACA,SAAKD,QAAL,GAAgBA,QAAhB;AACAE,YAAQC,OAAR,CAAgB,QAAhB;AACAD,YAAQC,OAAR,CAAgB,KAAhB,EAAuBC,I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vC,OAAd;AACD,OAFD;AAGA;AACA,UAAIwC,MAAOC,IAAIC,eAAJ,CAAoBC,IAApB,CAAX;;AAEA;AACAC,QAAEC,QAAF,GAAgB,aAAhB;AACAD,QAAEE,IAAF,GAAgBN,GAAhB;AACAI,QAAEG,WAAF;AACAH,QAAEI,KAAF;AACD;;;;;;;;;;;;;;;;;;;ACrJH;;AACA;;AACA;;AAEA,IAAIC,MAAMtE,QAAQuE,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASC,MAAT,CAAgBC,cAAhB,EAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BC,YAH0B;AAI1BC,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAEDP,CAAA;;kBAIeA,C;;;;;;;;;;;;;AC1Bf;;;;;;AAEA,IAAIA,MAAMtE,QAAQuE,MAAR,CAAe,mBAAf,EAAoC,EAApC,CAAV;;AAEAD,IAAIQ,SAAJ,CAAc,gBAAd;;kBAEeR,G;;;;;;;;;;;;;ACNA,GAA0B;AACvC,SAAO;AACLS,cAAU,GADL;AAELC,UAAuC;AACrC,UAAIC,QAAJ;AACAhF,cAAQiF,IAAR,CAAa,QAAb,EAAuBD,eAAvB;AACD;AALI,GAAP;AAOD,C;;;;;;;;;;;;;ACRD;;;;;;AAEA,IAAIX,MAAMtE,QAAQuE,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAD,IAAIK,UAAJ,CAAe,gBAAf;;kBAEeL,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMtE,QAAQuE,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeD,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 06cc69b7de61efc168e1","export default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n\n // L.control.layers({\n // \"Street\": map.tileLayer,\n // \"Satellite\": L.mapbox.tileLayer(\"my satellite imagery map id\")\n // }, null).addTo(this.map);\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6);\n\n L.control.layers(basemaps).addTo(this.map);\n // L.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',{\n // maxZoom: 20,\n // subdomains:['mt0','mt1','mt2','mt3']\n // });\n\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n if (this.current_layer == e.layer) {\n this.current_layer = null;\n } else {\n this.current_layer = e.layer;\n };\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillColor = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n open_file_dialog () {\n this.$timeout(()=> {\n angular.element('#local_file').trigger('click');\n });\n }\n\n open_image_dialog () {\n this.$timeout(()=> {\n angular.element('#local_image').trigger('click');\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n console.log(exif)\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index a41ab9e50f..0becabfceb 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -8,26 +8,49 @@ export default class MapSidebarCtrl { angular.element('header').hide(); angular.element('nav').hide(); angular.element('footer').hide(); - this.map = L.map('geo_map').setView([51.505, -0.09], 6); + // L.control.layers({ + // "Street": map.tileLayer, + // "Satellite": L.mapbox.tileLayer("my satellite imagery map id") + // }, null).addTo(this.map); //method binding for callback, sigh... this.local_file_selected = this.local_file_selected.bind(this); - L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' - }).addTo(this.map); + }); + + let satellite = L.tileLayer( + 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { + attribution: '©', + maxZoom: 18, + }); + + let basemaps = { + 'Street': streets, + 'Satellite': satellite + }; + + this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6); + + L.control.layers(basemaps).addTo(this.map); + // L.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',{ + // maxZoom: 20, + // subdomains:['mt0','mt1','mt2','mt3'] + // }); + this.drawnItems = new L.FeatureGroup(); this.map.addLayer(this.drawnItems); let drawControl = new L.Control.Draw({ - position: 'topright', - draw: { - circle: false, - }, - edit: { + position: 'topright', + draw: { + circle: false, + }, + edit: { featureGroup: this.drawnItems, remove: true - } + } }); this.drawnItems.on('click', (e) => { @@ -52,7 +75,7 @@ export default class MapSidebarCtrl { }); - } + } // end constructor open_file_dialog () { this.$timeout(()=> { @@ -92,6 +115,7 @@ export default class MapSidebarCtrl { let lat = exif.GPSLatitude; let lon = exif.GPSLongitude; + console.log(exif) //Convert coordinates to WGS84 decimal let latRef = exif.GPSLatitudeRef || "N"; @@ -105,18 +129,10 @@ export default class MapSidebarCtrl { } } - update_color () { - this.current_layer.setStyle({color: this.current_layer.options.color}); + update_layer_style (prop) { + this.current_layer.setStyle({prop: this.current_layer.options[prop]}); } - update_fill () { - this.current_layer.setStyle({fillColor: this.current_layer.options.fillColor}); - this.current_layer.setStyle({color: this.current_layer.options.fillColor}); - } - - update_opacity () { - this.current_layer.setStyle({fillOpacity: this.current_layer.options.fillOpacity}); - } save_project () { console.log(this.drawnItems); diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css index e761518ccb..60d6ac7b98 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -8,8 +8,8 @@ width: 20%; float: left; flex: 0 0 230px; - background: #364251; - color: #d0d0d0; + background: #373737; + color: #ababab; border-right: 1px solid #d3d3d3; flex-direction: column; display: flex; @@ -22,7 +22,7 @@ } #geo_sidebar .list-group-item { - background-color: #364251; + background-color: #373737; border-bottom: 1px solid #707070; border-left: 0px; border-right: 0px; @@ -32,7 +32,7 @@ } #geo_sidebar .list-group-item.save { - background-color: #379ba0; + background-color: #257b5f; } #geo_sidebar .current-layer-details { diff --git a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html index de92ec6194..26d90f18aa 100644 --- a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html +++ b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html @@ -16,15 +16,14 @@ {% addtoblock "js" %} - - - + - + + {% endaddtoblock %} {% addtoblock 'js' %} @@ -35,6 +34,7 @@ {% addtoblock "css" %} + {% endaddtoblock %} From 6454569e0bf9a1af8c4e13c7d428b5782a68dc53 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Fri, 3 Mar 2017 15:45:46 -0600 Subject: [PATCH 012/520] testing --- .../apps/dashboard/fixtures/user-data.json | 20 +++++++ designsafe/apps/dashboard/tests.py | 57 +++++++++++++++++++ designsafe/apps/dashboard/views.py | 28 +-------- designsafe/common_settings.py | 6 +- 4 files changed, 82 insertions(+), 29 deletions(-) create mode 100644 designsafe/apps/dashboard/fixtures/user-data.json diff --git a/designsafe/apps/dashboard/fixtures/user-data.json b/designsafe/apps/dashboard/fixtures/user-data.json new file mode 100644 index 0000000000..ce1d49e299 --- /dev/null +++ b/designsafe/apps/dashboard/fixtures/user-data.json @@ -0,0 +1,20 @@ +[ + { + "fields": { + "username": "ds_user", + "first_name": "DesignSafe", + "last_name": "User", + "is_active": true, + "is_superuser": false, + "is_staff": false, + "last_login": "2016-03-01T00:00:00.000Z", + "groups": [], + "user_permissions": [], + "password": "", + "email": "user@designsafe-ci.org", + "date_joined": "2016-03-01T00:00:00.000Z" + }, + "model": "auth.user", + "pk": 2 + } +] diff --git a/designsafe/apps/dashboard/tests.py b/designsafe/apps/dashboard/tests.py index e69de29bb2..2123f1bb78 100644 --- a/designsafe/apps/dashboard/tests.py +++ b/designsafe/apps/dashboard/tests.py @@ -0,0 +1,57 @@ +import json +import logging +from elasticsearch_dsl import Q +from django.test import TestCase +from django.contrib.auth import get_user_model, signals +from django.contrib.auth.models import Permission +from django.core.urlresolvers import reverse +from designsafe.apps.auth.signals import on_user_logged_in +from designsafe.apps.api.agave.filemanager.search_index import IndexedFile + +logger = logging.getLogger(__name__) + +class DashboardTests(TestCase): + + fixtures = ['user-data.json'] + + def setUp(self): + # configure regular user + user = get_user_model().objects.get(pk=2) + user.set_password('user/password') + user.save() + + f1 = IndexedFile( + length=1, + path="ds_user/test", + ) + f1.save() + f2 = IndexedFile( + length=1, + path="ds_user/test", + ) + f2.save() + + # disconnect user_logged_in signal + signals.user_logged_in.disconnect(on_user_logged_in) + + def tearDown(self): + s = IndexedFile.search() + res = s.query('bool', must=[Q("match", **{"path._path": "ds_user"})]).extra(size=10000).execute() + for r in res: + print r + r.delete() + + def test_index(self): + url = reverse('designsafe_dashboard:index') + self.client.login(username='ds_user', password='user/password') + resp = self.client.get(url) + self.assertEqual(resp.status_code, 200) + + def test_agg_storage(self): + url = reverse('designsafe_api:user_usage') + + self.client.login(username='ds_user', password='user/password') + resp = self.client.get(url) + self.assertEqual(resp.status_code, 200) + data = json.loads(resp.content) + self.assertEqual(data["total_storage_bytes"], 2) diff --git a/designsafe/apps/dashboard/views.py b/designsafe/apps/dashboard/views.py index ce5b764cc1..f285cf667d 100644 --- a/designsafe/apps/dashboard/views.py +++ b/designsafe/apps/dashboard/views.py @@ -1,21 +1,7 @@ from django.shortcuts import render -from django.contrib import messages -from django.contrib.auth import get_user_model, logout from django.contrib.auth.decorators import login_required, permission_required -from django.core.exceptions import ObjectDoesNotExist -from django.core.urlresolvers import reverse -from django.db.models import Q -from django.http import HttpResponse, HttpResponseRedirect, JsonResponse -from django.shortcuts import render_to_response -from django.utils.translation import ugettext_lazy as _ -from designsafe.apps.accounts import forms, integrations -from designsafe.apps.accounts.models import (NEESUser, DesignSafeProfile, - NotificationPreferences) -from pytas.http import TASClient -from pytas.models import User as TASUser +from django.http import JsonResponse import logging -import json -import re logger = logging.getLogger(__name__) @@ -26,15 +12,5 @@ def index(request): The default accounts view. Provides user settings for managing profile, authentication, notifications, identities, and applications. """ - django_user = request.user - user_profile = TASUser(username=request.user.username) - try: - demographics = django_user.profile - except ObjectDoesNotExist as e: - logger.info('exception e:{} {}'.format(type(e), e)) - - context = { - 'profile': user_profile, - } - return render(request, 'designsafe/apps/dashboard/index.html', context) + return render(request, 'designsafe/apps/dashboard/index.html') diff --git a/designsafe/common_settings.py b/designsafe/common_settings.py index 01eda6e882..d35f4ce4e1 100644 --- a/designsafe/common_settings.py +++ b/designsafe/common_settings.py @@ -197,11 +197,11 @@ # Haystack cms indexing settings -if not (os.environ.get('DS_LOCAL_DEV', 'False').lower() == 'true'): +if os.environ.get('DS_LOCAL_DEV', 'False').lower() == 'true': HAYSTACK_CONNECTIONS = { 'default': { 'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine', - 'URL': 'designsafe-es01.tacc.utexas.edu:9200/', + 'URL': 'elasticsearch:9200/', 'INDEX_NAME': 'cms', } } @@ -209,7 +209,7 @@ HAYSTACK_CONNECTIONS = { 'default': { 'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine', - 'URL': 'elasticsearch:9200/', + 'URL': 'designsafe-es01.tacc.utexas.edu:9200/', 'INDEX_NAME': 'cms', } } From 61812e61cc51ce848c5310814139a6bd382700ca Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Mon, 6 Mar 2017 13:39:08 -0600 Subject: [PATCH 013/520] dashboard backend tests --- designsafe/apps/dashboard/tests.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/designsafe/apps/dashboard/tests.py b/designsafe/apps/dashboard/tests.py index 2123f1bb78..5f38cce2f9 100644 --- a/designsafe/apps/dashboard/tests.py +++ b/designsafe/apps/dashboard/tests.py @@ -19,39 +19,40 @@ def setUp(self): user = get_user_model().objects.get(pk=2) user.set_password('user/password') user.save() - f1 = IndexedFile( length=1, path="ds_user/test", ) - f1.save() + f1.save(refresh=True) f2 = IndexedFile( length=1, path="ds_user/test", ) - f2.save() + f2.save(refresh=True) + print "SetUp" # disconnect user_logged_in signal signals.user_logged_in.disconnect(on_user_logged_in) def tearDown(self): s = IndexedFile.search() - res = s.query('bool', must=[Q("match", **{"path._path": "ds_user"})]).extra(size=10000).execute() - for r in res: - print r - r.delete() + res = s.query('bool', must=[Q("match", **{"path._path": "ds_user"})]).extra(size=10000) + res.execute() + for doc in res: + doc.delete(refresh=True, ignore=404) - def test_index(self): + def test_dashboard_index(self): url = reverse('designsafe_dashboard:index') self.client.login(username='ds_user', password='user/password') resp = self.client.get(url) self.assertEqual(resp.status_code, 200) - def test_agg_storage(self): - url = reverse('designsafe_api:user_usage') + def test_dashboard_agg_storage(self): + url = reverse('designsafe_api:user_usage') self.client.login(username='ds_user', password='user/password') resp = self.client.get(url) self.assertEqual(resp.status_code, 200) data = json.loads(resp.content) self.assertEqual(data["total_storage_bytes"], 2) + pass From 1ad116829ab34db2140bfd17bb6ee537678a3798 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Mon, 6 Mar 2017 13:39:31 -0600 Subject: [PATCH 014/520] dashboard backend tests --- designsafe/apps/dashboard/tests.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/designsafe/apps/dashboard/tests.py b/designsafe/apps/dashboard/tests.py index 5f38cce2f9..221b0fd126 100644 --- a/designsafe/apps/dashboard/tests.py +++ b/designsafe/apps/dashboard/tests.py @@ -29,7 +29,6 @@ def setUp(self): path="ds_user/test", ) f2.save(refresh=True) - print "SetUp" # disconnect user_logged_in signal signals.user_logged_in.disconnect(on_user_logged_in) @@ -55,4 +54,3 @@ def test_dashboard_agg_storage(self): self.assertEqual(resp.status_code, 200) data = json.loads(resp.content) self.assertEqual(data["total_storage_bytes"], 2) - pass From fa08d19c4d408c30863b67dbe4e0f25e299922c0 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Tue, 7 Mar 2017 15:13:33 -0600 Subject: [PATCH 015/520] app count and styles --- designsafe/apps/auth/views.py | 4 ++-- .../static/designsafe/apps/dashboard/html/dashboard.html | 6 +++--- .../apps/dashboard/js/controllers/dashboardCtrl.js | 8 +++++--- .../designsafe/apps/dashboard/styles/dashboard.css | 9 ++++++--- designsafe/templates/includes/header.html | 2 +- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/designsafe/apps/auth/views.py b/designsafe/apps/auth/views.py index 1246088de7..2b7fbb45e0 100644 --- a/designsafe/apps/auth/views.py +++ b/designsafe/apps/auth/views.py @@ -150,8 +150,8 @@ def agave_oauth_callback(request): next_uri = request.session.pop('next') return HttpResponseRedirect(next_uri) else: - return HttpResponseRedirect(settings.LOGIN_REDIRECT_URL) - # return HttpResponseRedirect(reverse('designsafe_dashboard:index')) + # return HttpResponseRedirect(settings.LOGIN_REDIRECT_URL) + return HttpResponseRedirect(reverse('designsafe_dashboard:index')) def agave_session_error(request): return render(request, 'designsafe/apps/auth/agave_session_error.html') diff --git a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/html/dashboard.html b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/html/dashboard.html index 84db9e4cbe..c88c43bb17 100644 --- a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/html/dashboard.html +++ b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/html/dashboard.html @@ -24,7 +24,7 @@
    -->
    -
    +
    @@ -35,7 +35,7 @@
    -
    +
    @@ -75,7 +75,7 @@

    Recent Apps

    diff --git a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js index 1cc79d51ff..db78346a1d 100644 --- a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js +++ b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js @@ -21,14 +21,16 @@ function ($scope, UserService, NotificationService, AgaveService, TicketsService AgaveService.jobsListing({'created.gt':'2017-01-01'}).then(function (resp) { $scope.jobs = resp; $scope.chart_data = AgaveService.jobsByDate(resp); - console.log($scope.jobs); + // console.log($scope.jobs); $scope.chart.data($scope.chart_data); var tmp = _.groupBy($scope.jobs, function (d) {return d.appId}); + // console.log(tmp) $scope.recent_apps = Object.keys(tmp); }) - AgaveService.appsListing({filter:'id', limit:99999}).then(function (resp) { - $scope.apps = resp; + AgaveService.appsListing({limit:99999}).then(function (resp) { + var tmp = _.groupBy(resp, function (d) {return d.label}); + $scope.apps = Object.keys(tmp); }) TicketsService.get().then(function (resp) { diff --git a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/styles/dashboard.css b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/styles/dashboard.css index 209f8a159a..2f72547ad0 100644 --- a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/styles/dashboard.css +++ b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/styles/dashboard.css @@ -32,6 +32,7 @@ display: block; margin-bottom: 25px; overflow: hidden; + padding: 10px; } .dashboard-stat .visual { width: 80px; @@ -67,8 +68,8 @@ .dashboard-stat .details .number { padding-top: 25px; text-align: right; - font-size: 34px; - line-height: 36px; + font-size: 50px; + line-height: 45px; letter-spacing: -1px; margin-bottom: 0px; font-weight: 300; @@ -95,10 +96,12 @@ color: #FFFFFF; opacity: 1; filter: alpha(opacity=100); + font-family: monospace; } .dashboard-stat .details .desc { text-align: right; - font-size: 16px; + font-size: 20px; + line-height: 15px; letter-spacing: 0px; font-weight: 300; } diff --git a/designsafe/templates/includes/header.html b/designsafe/templates/includes/header.html index 568bef27f5..ad2fc90922 100644 --- a/designsafe/templates/includes/header.html +++ b/designsafe/templates/includes/header.html @@ -21,7 +21,7 @@

    DesignSafe-CI: A Natural Hazards Engineering Community

    - Home + Home
    @@ -87,7 +91,13 @@

    Recent Apps

    My Jobs

    -

    No recent jobs!

    +

    + No recent jobs! You can submit jobs in the + Workspace +

    +
    + +
      diff --git a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js index db78346a1d..20880fa6cd 100644 --- a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js +++ b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js @@ -6,6 +6,7 @@ function ($scope, UserService, NotificationService, AgaveService, TicketsService $scope.activities_count = 42; $scope.display_job_details = false; $scope.loading_tickets = true; + $scope.loading_jobs = true; $scope.today = new Date(); $scope.first_jobs_date = new Date($scope.today.getTime() - (14 * 24 * 60 * 60 * 1000 )) @@ -26,6 +27,7 @@ function ($scope, UserService, NotificationService, AgaveService, TicketsService var tmp = _.groupBy($scope.jobs, function (d) {return d.appId}); // console.log(tmp) $scope.recent_apps = Object.keys(tmp); + $scope.loading_jobs = false; }) AgaveService.appsListing({limit:99999}).then(function (resp) { From 7e374ca1af54498fd9d876b0dd763b6f7af30095 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 8 Mar 2017 13:21:26 -0600 Subject: [PATCH 017/520] Adding jwt and cripto requirements --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 22e7de345e..c24c55fe69 100644 --- a/requirements.txt +++ b/requirements.txt @@ -65,7 +65,8 @@ python-dateutil==2.4.2 python-memcached django-haystack==2.6 - +pyjwt==1.4.2 +PyCrypto==2.6.1 chardet==2.3.0 ipdb From c7f57731811fe0a2e30b9efa22ac960a6642d89c Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 8 Mar 2017 13:21:46 -0600 Subject: [PATCH 018/520] Adding decorators file to hold API sepcific decorators --- designsafe/apps/api/decorators.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 designsafe/apps/api/decorators.py diff --git a/designsafe/apps/api/decorators.py b/designsafe/apps/api/decorators.py new file mode 100644 index 0000000000..ed07cbfb22 --- /dev/null +++ b/designsafe/apps/api/decorators.py @@ -0,0 +1,20 @@ +""" +Decorators used for the api +""" +from base64 import b64decode +import jwt as pyjwt +from Crypto.PublicKey import RSA + +def decode_jwt(jwt, pubkey): + """Verified signature on a jwt + + Uses public key to decode the jwt message. + + :param str jwt: JWT string + :param str pubkey: Publick Key string + :return: base64-decoded message + """ + key_der = b64decode(pubkey) + key_pub = RSA.importKey(key_der) + + return pyjwt.decode(jwt, key_pub) From e4c21dad57e7d11adeaa41f057de0d9372a4ef00 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 8 Mar 2017 14:10:38 -0600 Subject: [PATCH 019/520] Creating agave decorator to decode jwt. Testing decoding now --- designsafe/apps/api/decorators.py | 51 +++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/designsafe/apps/api/decorators.py b/designsafe/apps/api/decorators.py index ed07cbfb22..1892a0b0dd 100644 --- a/designsafe/apps/api/decorators.py +++ b/designsafe/apps/api/decorators.py @@ -1,20 +1,65 @@ """ Decorators used for the api + TODO: This is Django specific. We should either move this into some kind of + django specific utils or try and make it as general as possible. """ +import logging +from functools import wraps from base64 import b64decode +from django.utils.six import text_type +from django.conf import settings import jwt as pyjwt from Crypto.PublicKey import RSA -def decode_jwt(jwt, pubkey): +#pylint: disable=invalid-name +logger = logging.getLogger(__name__) +#pylint: enable=invalid-name + +def _decode_jwt(jwt): """Verified signature on a jwt Uses public key to decode the jwt message. :param str jwt: JWT string - :param str pubkey: Publick Key string :return: base64-decoded message """ + pubkey = settings.AGAVE_JWT_PUBKEY key_der = b64decode(pubkey) key_pub = RSA.importKey(key_der) - return pyjwt.decode(jwt, key_pub) + #return pyjwt.decode(jwt, key_pub, issuer='wso2.org/products/am') + return pyjwt.decode(jwt, key_pub, verify=False) + +def _get_auth_headers(request): + """Return auth header as a byte string + + :param django.http.request request: Django Request + """ + auth = request.META.get('HTTP_AUTHORIZATION', b'') + if isinstance(auth, text_type): + # Header encoding (see RFC5987) + auth = auth.encode('iso-8859-1') + + return auth + +def agave_jwt_login(func): + """Decorator to login user with a jwt + """ + #pylint: disable=missing-docstring + @wraps(func) + def decorated_function(request, *args, **kwargs): + if request.is_authenticated(): + return func(request, *args, **kwargs) + + auth = _get_auth_headers(request) + auth_comps = auth.split() + if len(auth_comps) != 2: + raise ValueError("JWT Header format is not correct.") + + jwt_value = auth_comps[1] + payload = _decode_jwt(jwt_value) + logger.debug('jwt payload: %s', payload) + return func(request, *args, **kwargs) + + return decorated_function + #pylint: enable=missing-docstring From 5d7d352a659689f59ac4df48494108c2ada1ee2e Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 8 Mar 2017 14:24:08 -0600 Subject: [PATCH 020/520] Addin jwt decorator on api secure mixin --- designsafe/apps/api/decorators.py | 2 +- designsafe/apps/api/mixins.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/designsafe/apps/api/decorators.py b/designsafe/apps/api/decorators.py index 1892a0b0dd..0e7f5ebb31 100644 --- a/designsafe/apps/api/decorators.py +++ b/designsafe/apps/api/decorators.py @@ -48,7 +48,7 @@ def agave_jwt_login(func): #pylint: disable=missing-docstring @wraps(func) def decorated_function(request, *args, **kwargs): - if request.is_authenticated(): + if request.user.is_authenticated(): return func(request, *args, **kwargs) auth = _get_auth_headers(request) diff --git a/designsafe/apps/api/mixins.py b/designsafe/apps/api/mixins.py index 6d8c4a7695..4279f2e50e 100644 --- a/designsafe/apps/api/mixins.py +++ b/designsafe/apps/api/mixins.py @@ -1,5 +1,6 @@ from django.utils.decorators import method_decorator from django.contrib.auth.decorators import login_required +from designsafe.apps.api.decorators import agave_jwt_login from django.http import HttpResponse from django.core.serializers.json import DjangoJSONEncoder import logging @@ -26,6 +27,7 @@ class SecureMixin(object): should be a class wrapper @method_decorator(login_required, name='dispatch') as per: https://docs.djangoproject.com/en/1.9/topics/class-based-views/intro/#decorating-the-class """ + @method_decorator(agave_jwt_login) @method_decorator(login_required) def dispatch(self, request, *args, **kwargs): return super(SecureMixin, self).dispatch(request, *args, **kwargs) From 812483bd173bb55677be6b46f4712dd6eaca12f8 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 8 Mar 2017 14:29:10 -0600 Subject: [PATCH 021/520] ADding AGAVE_JWT_PUBKEY to env settings and common settings --- designsafe/common_settings.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designsafe/common_settings.py b/designsafe/common_settings.py index 01eda6e882..16896f94b5 100644 --- a/designsafe/common_settings.py +++ b/designsafe/common_settings.py @@ -515,6 +515,8 @@ AGAVE_SUPER_TOKEN = os.environ.get('AGAVE_SUPER_TOKEN') AGAVE_STORAGE_SYSTEM = os.environ.get('AGAVE_STORAGE_SYSTEM') +AGAVE_JWT_PUBKEY = os.environ.get('AGAVE_JWT_PUBKEY') + PROJECT_STORAGE_SYSTEM_TEMPLATE = { 'id': 'project-{}', 'site': 'tacc.utexas.edu', From 3d16cd788f396ee7fc0d916e3e8ed4c36d7f0989 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 8 Mar 2017 14:29:26 -0600 Subject: [PATCH 022/520] Adding agave_jwt_pubkey to env sample --- designsafe.env.sample | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/designsafe.env.sample b/designsafe.env.sample index d62107c242..7fb5dded82 100644 --- a/designsafe.env.sample +++ b/designsafe.env.sample @@ -78,12 +78,19 @@ AGAVE_TENANT_BASEURL=https://agave.designsafe-ci.org AGAVE_CLIENT_KEY= AGAVE_CLIENT_SECRET= AGAVE_TOKEN_SESSION_ID= +AGAVE_JWT_PUBKEY= # Long-lived token used by the portal for "admin" actions; obtain from API store interface AGAVE_SUPER_TOKEN= AGAVE_STORAGE_SYSTEM=designsafe.storage.default +BOX_APP_CLIENT_ID= +BOX_APP_CLIENT_SECRET= + +DROPBOX_APP_KEY= +DROPBOX_APP_SECRET= + # djangoRT RT_HOST=https://hostname.example.com/REST/1.0/ RT_USERNAME=username From 0799aa16b306f1efe78016a745cfeaeca612fb5e Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 8 Mar 2017 16:00:01 -0600 Subject: [PATCH 023/520] Adding falling back if there's no JWT in headers --- designsafe/apps/api/decorators.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designsafe/apps/api/decorators.py b/designsafe/apps/api/decorators.py index 0e7f5ebb31..d6bfd5baa7 100644 --- a/designsafe/apps/api/decorators.py +++ b/designsafe/apps/api/decorators.py @@ -53,8 +53,10 @@ def decorated_function(request, *args, **kwargs): auth = _get_auth_headers(request) auth_comps = auth.split() + logger.debug('auth: %s', auth) if len(auth_comps) != 2: - raise ValueError("JWT Header format is not correct.") + logger.debug('JWT format is not correct. Falling back') + return func(request, *args, **kwargs) jwt_value = auth_comps[1] payload = _decode_jwt(jwt_value) From 612bc13dff446b3be72608e672c8a0b7e823a083 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 8 Mar 2017 16:00:28 -0600 Subject: [PATCH 024/520] Making sure the Secure Mixin dispatch function gets called first --- designsafe/apps/api/projects/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designsafe/apps/api/projects/views.py b/designsafe/apps/api/projects/views.py index 3ed9deb360..76f3079f2a 100644 --- a/designsafe/apps/api/projects/views.py +++ b/designsafe/apps/api/projects/views.py @@ -28,7 +28,7 @@ def template_project_storage_system(project): return system_template -class ProjectCollectionView(BaseApiView, SecureMixin): +class ProjectCollectionView(SecureMixin, BaseApiView): def get(self, request): """ @@ -158,7 +158,7 @@ def post(self, request): return JsonResponse(p, encoder=AgaveJSONEncoder, safe=False) -class ProjectInstanceView(BaseApiView, SecureMixin): +class ProjectInstanceView(SecureMixin, BaseApiView): def get(self, request, project_id): """ @@ -203,7 +203,7 @@ def post(self, request, project_id): return JsonResponse(p, encoder=AgaveJSONEncoder, safe=False) -class ProjectCollaboratorsView(BaseApiView, SecureMixin): +class ProjectCollaboratorsView(SecureMixin, BaseApiView): def get(self, request, project_id): ag = request.user.agave_oauth.client @@ -265,7 +265,7 @@ def delete(self, request, project_id): return JsonResponse({'status': 'ok'}) -class ProjectDataView(BaseApiView, SecureMixin): +class ProjectDataView(SecureMixin, BaseApiView): def get(self, request, project_id, file_path=''): """ From 23485ca847361f505f8ef5741e1ca9c85dcd59e7 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 8 Mar 2017 16:00:38 -0600 Subject: [PATCH 025/520] Making sure the Secure Mixin dispatch function gets called first --- designsafe/apps/api/external_resources/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designsafe/apps/api/external_resources/views.py b/designsafe/apps/api/external_resources/views.py index 077db08c39..9df1d8ab76 100644 --- a/designsafe/apps/api/external_resources/views.py +++ b/designsafe/apps/api/external_resources/views.py @@ -22,7 +22,7 @@ logger = logging.getLogger(__name__) -class FilesListView(BaseApiView, SecureMixin): +class FilesListView(SecureMixin, BaseApiView): """Listing view""" def get(self, request, file_mgr_name, file_id=None): @@ -37,7 +37,7 @@ def get(self, request, file_mgr_name, file_id=None): listing = fmgr.listing(file_id) return JsonResponse(listing, safe=False) -class FileMediaView(BaseApiView, SecureMixin): +class FileMediaView(SecureMixin, BaseApiView): """File Media View""" def get(self, request, file_mgr_name, file_id): @@ -110,6 +110,6 @@ def put(self, request, file_mgr_name, file_id): return HttpResponseBadRequest("Operation not implemented.") -class FilePermissionsView(BaseApiView, SecureMixin): +class FilePermissionsView(SecureMixin, BaseApiView): """File Permissions View""" pass From 9916418601aa98867480e3bccb0b8ff7097a92f4 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Wed, 8 Mar 2017 16:45:34 -0600 Subject: [PATCH 026/520] settings --- designsafe.env.sample | 5 +++++ .../static/designsafe/apps/dashboard/html/dashboard.html | 2 +- designsafe/common_settings.py | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/designsafe.env.sample b/designsafe.env.sample index d62107c242..ef44e974fd 100644 --- a/designsafe.env.sample +++ b/designsafe.env.sample @@ -100,3 +100,8 @@ NEES_DATABASE_HOST= NEES_DATABASE_PORT= NEES_DATABASE_USER= NEES_DATABASE_PASSWORD= + + +# FOR CMS/RECAPTCHA +DJANGOCMS_FORMS_RECAPTCHA_PUBLIC_KEY= +DJANGOCMS_FORMS_RECAPTCHA_SECRET_KEY= diff --git a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/html/dashboard.html b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/html/dashboard.html index 46e5b354c6..05a58ccadb 100644 --- a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/html/dashboard.html +++ b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/html/dashboard.html @@ -142,7 +142,7 @@

      Notifications

      • diff --git a/designsafe/common_settings.py b/designsafe/common_settings.py index d35f4ce4e1..8d5d5473df 100644 --- a/designsafe/common_settings.py +++ b/designsafe/common_settings.py @@ -539,6 +539,11 @@ } } +# RECAPTCHA SETTINGS FOR LESS SPAMMO +DJANGOCMS_FORMS_RECAPTCHA_PUBLIC_KEY = os.environ.get('DJANGOCMS_FORMS_RECAPTCHA_PUBLIC_KEY') +DJANGOCMS_FORMS_RECAPTCHA_SECRET_KEY = os.environ.get('DJANGOCMS_FORMS_RECAPTCHA_SECRET_KEY') + + from celery_settings import * from external_resource_settings import * from elasticsearch_settings import * From 28b3f007abcbc1da5037b74ce75065515074c8e5 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 9 Mar 2017 09:14:46 -0600 Subject: [PATCH 027/520] Adding action attribute to form who post to the same URL so they'll work --- .../templates/designsafe/apps/accounts/email_confirmation.html | 2 +- .../templates/designsafe/apps/accounts/manage_auth.html | 2 +- .../designsafe/apps/accounts/manage_notifications.html | 2 +- .../templates/designsafe/apps/accounts/password_reset.html | 2 +- .../designsafe/apps/accounts/professional_profile_edit.html | 2 +- .../templates/designsafe/apps/accounts/profile_edit.html | 2 +- .../accounts/templates/designsafe/apps/accounts/register.html | 2 +- designsafe/apps/djangoRT/templates/djangoRT/ticketClose.html | 2 +- designsafe/apps/djangoRT/templates/djangoRT/ticketCreate.html | 2 +- .../apps/djangoRT/templates/djangoRT/ticketCreateGuest.html | 2 +- designsafe/apps/djangoRT/templates/djangoRT/ticketList.html | 2 +- designsafe/apps/djangoRT/templates/djangoRT/ticketReply.html | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/designsafe/apps/accounts/templates/designsafe/apps/accounts/email_confirmation.html b/designsafe/apps/accounts/templates/designsafe/apps/accounts/email_confirmation.html index 0cea059c7a..166a042459 100644 --- a/designsafe/apps/accounts/templates/designsafe/apps/accounts/email_confirmation.html +++ b/designsafe/apps/accounts/templates/designsafe/apps/accounts/email_confirmation.html @@ -13,7 +13,7 @@

        Account Activation

        and the username and password you registered with to activate your account.

        -
        + {% csrf_token %} {% bootstrap_form form %} diff --git a/designsafe/apps/accounts/templates/designsafe/apps/accounts/manage_auth.html b/designsafe/apps/accounts/templates/designsafe/apps/accounts/manage_auth.html index 68376748d1..fd399b27a4 100644 --- a/designsafe/apps/accounts/templates/designsafe/apps/accounts/manage_auth.html +++ b/designsafe/apps/accounts/templates/designsafe/apps/accounts/manage_auth.html @@ -13,7 +13,7 @@

        Changing your TACC Password

        as a whole, not just at DesignSafe.
      - + {% csrf_token %} {% bootstrap_form form %} diff --git a/designsafe/apps/accounts/templates/designsafe/apps/accounts/manage_notifications.html b/designsafe/apps/accounts/templates/designsafe/apps/accounts/manage_notifications.html index 7cc91040a5..00436e6595 100644 --- a/designsafe/apps/accounts/templates/designsafe/apps/accounts/manage_notifications.html +++ b/designsafe/apps/accounts/templates/designsafe/apps/accounts/manage_notifications.html @@ -6,7 +6,7 @@

      Notifications


      - + {% csrf_token %}
      diff --git a/designsafe/apps/accounts/templates/designsafe/apps/accounts/password_reset.html b/designsafe/apps/accounts/templates/designsafe/apps/accounts/password_reset.html index 63acd70c16..4d37814257 100644 --- a/designsafe/apps/accounts/templates/designsafe/apps/accounts/password_reset.html +++ b/designsafe/apps/accounts/templates/designsafe/apps/accounts/password_reset.html @@ -17,7 +17,7 @@

      Changing your TACC Password

      as a whole, not just at DesignSafe.
      - + {% csrf_token %} {% bootstrap_form form %} diff --git a/designsafe/apps/accounts/templates/designsafe/apps/accounts/professional_profile_edit.html b/designsafe/apps/accounts/templates/designsafe/apps/accounts/professional_profile_edit.html index 2c3d8ce416..60ef50a885 100644 --- a/designsafe/apps/accounts/templates/designsafe/apps/accounts/professional_profile_edit.html +++ b/designsafe/apps/accounts/templates/designsafe/apps/accounts/professional_profile_edit.html @@ -7,7 +7,7 @@

      Edit Professional Profile


      - + {% csrf_token %} {% bootstrap_form form %}
      diff --git a/designsafe/apps/accounts/templates/designsafe/apps/accounts/profile_edit.html b/designsafe/apps/accounts/templates/designsafe/apps/accounts/profile_edit.html index 547ba47b35..87094f1720 100644 --- a/designsafe/apps/accounts/templates/designsafe/apps/accounts/profile_edit.html +++ b/designsafe/apps/accounts/templates/designsafe/apps/accounts/profile_edit.html @@ -7,7 +7,7 @@

      Edit Profile


      - + {% csrf_token %} {% bootstrap_form form %}
      diff --git a/designsafe/apps/accounts/templates/designsafe/apps/accounts/register.html b/designsafe/apps/accounts/templates/designsafe/apps/accounts/register.html index d0aea2417d..c246447a92 100644 --- a/designsafe/apps/accounts/templates/designsafe/apps/accounts/register.html +++ b/designsafe/apps/accounts/templates/designsafe/apps/accounts/register.html @@ -40,7 +40,7 @@

      information.

      - + {% csrf_token %} {% bootstrap_form account_form %} diff --git a/designsafe/apps/djangoRT/templates/djangoRT/ticketClose.html b/designsafe/apps/djangoRT/templates/djangoRT/ticketClose.html index 06cd80354a..53c59c3328 100755 --- a/designsafe/apps/djangoRT/templates/djangoRT/ticketClose.html +++ b/designsafe/apps/djangoRT/templates/djangoRT/ticketClose.html @@ -23,7 +23,7 @@

      Are you sure you want to close this ticket? Please provide a comment.

      - + {% csrf_token %} {% bootstrap_form form %} diff --git a/designsafe/apps/djangoRT/templates/djangoRT/ticketCreate.html b/designsafe/apps/djangoRT/templates/djangoRT/ticketCreate.html index aef4771774..21f2acb212 100755 --- a/designsafe/apps/djangoRT/templates/djangoRT/ticketCreate.html +++ b/designsafe/apps/djangoRT/templates/djangoRT/ticketCreate.html @@ -18,7 +18,7 @@

      Submit a new ticket

      Fields marked with are required.

      - + {% csrf_token %} {% bootstrap_form form %} diff --git a/designsafe/apps/djangoRT/templates/djangoRT/ticketCreateGuest.html b/designsafe/apps/djangoRT/templates/djangoRT/ticketCreateGuest.html index e3d55168b2..15637b1ed4 100755 --- a/designsafe/apps/djangoRT/templates/djangoRT/ticketCreateGuest.html +++ b/designsafe/apps/djangoRT/templates/djangoRT/ticketCreateGuest.html @@ -5,7 +5,7 @@

      Submit a new ticket

      Fields marked with are required.

      - + {% csrf_token %} {% bootstrap_form form %} diff --git a/designsafe/apps/djangoRT/templates/djangoRT/ticketList.html b/designsafe/apps/djangoRT/templates/djangoRT/ticketList.html index 682fbc9f24..c34e88e5be 100755 --- a/designsafe/apps/djangoRT/templates/djangoRT/ticketList.html +++ b/designsafe/apps/djangoRT/templates/djangoRT/ticketList.html @@ -40,7 +40,7 @@

      {% endif %} - +
      diff --git a/designsafe/apps/djangoRT/templates/djangoRT/ticketReply.html b/designsafe/apps/djangoRT/templates/djangoRT/ticketReply.html index 9f4efd3a7c..ea28af998c 100755 --- a/designsafe/apps/djangoRT/templates/djangoRT/ticketReply.html +++ b/designsafe/apps/djangoRT/templates/djangoRT/ticketReply.html @@ -28,7 +28,7 @@

      {% endif %}

      - + {% csrf_token %} {% bootstrap_form form %} From 66d811a6ff069361e363ed8837a1eb946e3e34d7 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 9 Mar 2017 09:31:06 -0600 Subject: [PATCH 028/520] Project form can be submitted without a PI now --- .../static/scripts/ng-designsafe/services/project-service.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designsafe/static/scripts/ng-designsafe/services/project-service.js b/designsafe/static/scripts/ng-designsafe/services/project-service.js index c5b9f6a01a..5ebc1faef4 100644 --- a/designsafe/static/scripts/ng-designsafe/services/project-service.js +++ b/designsafe/static/scripts/ng-designsafe/services/project-service.js @@ -303,10 +303,12 @@ $scope.ui.busy = true; var projectData = { title: $scope.form.title, - pi: $scope.form.pi.username, awardNumber: $scope.form.awardNumber, description: $scope.form.description }; + if ($scope.form.pi && $scope.form.pi.username){ + projectData.pi = $scope.form.pi.username; + } if ($scope.form.projectType.id !== 'undefined'){ projectData.projectType = $scope.form.projectType.id; } From 314f52ae1eabfebfaa778caaa5b83e03dbe89771 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 9 Mar 2017 10:41:20 -0600 Subject: [PATCH 029/520] Adding debugging statements for JWT request --- designsafe/apps/api/decorators.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designsafe/apps/api/decorators.py b/designsafe/apps/api/decorators.py index d6bfd5baa7..948e917e88 100644 --- a/designsafe/apps/api/decorators.py +++ b/designsafe/apps/api/decorators.py @@ -48,12 +48,14 @@ def agave_jwt_login(func): #pylint: disable=missing-docstring @wraps(func) def decorated_function(request, *args, **kwargs): + logger.debug('HEADERS: %s', request.META) + logger.debug('POST: %s', request.POST.dict()) + logger.debug('GET: %s', request.GET.dict()) if request.user.is_authenticated(): return func(request, *args, **kwargs) auth = _get_auth_headers(request) auth_comps = auth.split() - logger.debug('auth: %s', auth) if len(auth_comps) != 2: logger.debug('JWT format is not correct. Falling back') return func(request, *args, **kwargs) From 17d4af7eafc01de43490cc9b1fa2366ea03b08fd Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 9 Mar 2017 15:55:31 -0600 Subject: [PATCH 030/520] Adding crypto and jwt libraries --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c24c55fe69..b448ddc31b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -65,8 +65,8 @@ python-dateutil==2.4.2 python-memcached django-haystack==2.6 +cryptography==1.7.2 pyjwt==1.4.2 -PyCrypto==2.6.1 chardet==2.3.0 ipdb From e68340c4992f19d699c25f757bdfc778cf6a127e Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 9 Mar 2017 15:56:27 -0600 Subject: [PATCH 031/520] Adding django settings for jwt handling --- designsafe/common_settings.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designsafe/common_settings.py b/designsafe/common_settings.py index 72bafc3c64..26045fc6fc 100644 --- a/designsafe/common_settings.py +++ b/designsafe/common_settings.py @@ -516,6 +516,9 @@ AGAVE_STORAGE_SYSTEM = os.environ.get('AGAVE_STORAGE_SYSTEM') AGAVE_JWT_PUBKEY = os.environ.get('AGAVE_JWT_PUBKEY') +AGAVE_JWT_ISSUER = os.environ.get('AGAVE_JWT_ISSUER') +AGAVE_JWT_HEADER = os.environ.get('AGAVE_JWT_HEADER') +AGAVE_JWT_USER_CLAIM_FIELD = os.environ.get('AGAVE_JWT_USER_CLAIM_FIELD') PROJECT_STORAGE_SYSTEM_TEMPLATE = { 'id': 'project-{}', From 3c11126ca8e553e12446742e40ed3a08ea7efb00 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 9 Mar 2017 15:56:43 -0600 Subject: [PATCH 032/520] Updating env.sample --- designsafe.env.sample | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designsafe.env.sample b/designsafe.env.sample index 9ec13a7752..13f38f29bc 100644 --- a/designsafe.env.sample +++ b/designsafe.env.sample @@ -82,6 +82,9 @@ AGAVE_JWT_PUBKEY= # Long-lived token used by the portal for "admin" actions; obtain from API store interface AGAVE_SUPER_TOKEN= +AGAVE_JWT_ISSUER= +AGAVE_JWT_HEADER= +AGAVE_JWT_USER_CLAIM_FIELD= AGAVE_STORAGE_SYSTEM=designsafe.storage.default From 66c0c57ed99eafe485c4b8a5ae9fb53ab427086e Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 9 Mar 2017 15:56:59 -0600 Subject: [PATCH 033/520] Adding jwt decorator --- designsafe/apps/api/decorators.py | 64 +++++++++++++++++++------------ 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/designsafe/apps/api/decorators.py b/designsafe/apps/api/decorators.py index 948e917e88..fd1634a159 100644 --- a/designsafe/apps/api/decorators.py +++ b/designsafe/apps/api/decorators.py @@ -1,6 +1,4 @@ -""" -Decorators used for the api - TODO: This is Django specific. We should either move this into some kind of +""" Decorators used for the api TODO: This is Django specific. We should either move this into some kind of django specific utils or try and make it as general as possible. """ import logging @@ -8,8 +6,12 @@ from base64 import b64decode from django.utils.six import text_type from django.conf import settings +from django.contrib.auth import get_user_model +from django.contrib.auth import login import jwt as pyjwt -from Crypto.PublicKey import RSA +from cryptography.hazmat.backends import default_backend +from cryptography.hazmat.primitives.asymmetric import rsa +from cryptography.hazmat.primitives.serialization import load_der_public_key #pylint: disable=invalid-name logger = logging.getLogger(__name__) @@ -23,46 +25,58 @@ def _decode_jwt(jwt): :param str jwt: JWT string :return: base64-decoded message """ - pubkey = settings.AGAVE_JWT_PUBKEY + #pubkey = settings.AGAVE_JWT_PUBKEY + pubkey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUp/oV1vWc8/TkQSiAvTousMzO\nM4asB2iltr2QKozni5aVFu818MpOLZIr8LMnTzWllJvvaA5RAAdpbECb+48FjbBe\n0hseUdN5HpwvnH/DW8ZccGvk53I6Orq7hLCv1ZHtuOCokghz/ATrhyPq+QktMfXn\nRS4HrKGJTzxaCcU7OQIDAQAB' + logger.debug('pubkey: %s', pubkey) key_der = b64decode(pubkey) - key_pub = RSA.importKey(key_der) - - #return pyjwt.decode(jwt, key_pub, issuer='wso2.org/products/am') - return pyjwt.decode(jwt, key_pub, verify=False) + key = load_der_public_key(key_der, backend=default_backend()) + + logger.debug('jwt: %s', jwt) + return pyjwt.decode(jwt, key, issuer=settings.AGAVE_JWT_ISSUER) + #return pyjwt.decode(jwt, key, verify=False) -def _get_auth_headers(request): - """Return auth header as a byte string +def _get_jwt_payload(request): + """Return JWT payload as a string :param django.http.request request: Django Request + :return: JWT payload + :rtype: str """ - auth = request.META.get('HTTP_AUTHORIZATION', b'') - if isinstance(auth, text_type): + payload = request.META.get(settings.AGAVE_JWT_HEADER) + if payload and isinstance(payload, text_type): # Header encoding (see RFC5987) - auth = auth.encode('iso-8859-1') + payload = payload.encode('iso-8859-1') - return auth + return payload def agave_jwt_login(func): """Decorator to login user with a jwt + + ..note:: + It will sliently fail and continue executing the wrapped function + if the JWT payload header IS NOT present in the request. If the JWT payload + header IS present then it will continue executing the wrapped function passing + the request object with the correct user logged-in. + Because of this it is assumed that this decorator will be used together with + :func:`django.contrib.auth.decorators.login_required` decorator. This way we do + not disrupt your usual Django login config. """ #pylint: disable=missing-docstring @wraps(func) def decorated_function(request, *args, **kwargs): - logger.debug('HEADERS: %s', request.META) - logger.debug('POST: %s', request.POST.dict()) - logger.debug('GET: %s', request.GET.dict()) if request.user.is_authenticated(): return func(request, *args, **kwargs) - auth = _get_auth_headers(request) - auth_comps = auth.split() - if len(auth_comps) != 2: - logger.debug('JWT format is not correct. Falling back') + payload = _get_jwt_payload(request) + if not payload: + logger.debug('No JWT payload found. Falling back') return func(request, *args, **kwargs) - jwt_value = auth_comps[1] - payload = _decode_jwt(jwt_value) - logger.debug('jwt payload: %s', payload) + jwt_payload = _decode_jwt(payload) + username = jwt_payload.get(settings.AGAVE_JWT_USER_CLAIM_FIELD, '') + user = get_user_model().objects.get(username=username) + user.backend = 'django.contrib.auth.backends.ModelBackend', + login(request, user) return func(request, *args, **kwargs) return decorated_function From 453df5a98ea12e6a6f0de85394a19ea80e2cd7f9 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 9 Mar 2017 15:57:13 -0600 Subject: [PATCH 034/520] Updating secure mixin to handle jwt --- designsafe/apps/api/mixins.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/designsafe/apps/api/mixins.py b/designsafe/apps/api/mixins.py index 4279f2e50e..f6225e3270 100644 --- a/designsafe/apps/api/mixins.py +++ b/designsafe/apps/api/mixins.py @@ -21,8 +21,13 @@ def render_to_json_response(self, context, **response_kwargs): class SecureMixin(object): - """ - View mixin to use login_required + """View mixin to ensure the user has access to a secured view + + This Mixin first checks if the request is done using a JWT. If this is not the case + then it will continue and check if the request is using a regular django session cookie. + Either way the request will be correctly authenticated. This way we can easily + use the same API endpoints and put them behind WSO2. + TODO: When moving into Django 1.9 @method_decorator(login_required) should be a class wrapper @method_decorator(login_required, name='dispatch') as per: https://docs.djangoproject.com/en/1.9/topics/class-based-views/intro/#decorating-the-class From 05b73e3a5ba0c803d94572d0f1cb64141bbca8da Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 9 Mar 2017 15:57:31 -0600 Subject: [PATCH 035/520] Adding project listing endpoint to specifcy another user --- designsafe/apps/api/projects/urls.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designsafe/apps/api/projects/urls.py b/designsafe/apps/api/projects/urls.py index 36b814acc0..a95c9a45a2 100644 --- a/designsafe/apps/api/projects/urls.py +++ b/designsafe/apps/api/projects/urls.py @@ -11,13 +11,15 @@ """ from django.conf.urls import patterns, url, include -from designsafe.apps.api.projects.views import (ProjectCollectionView, +from designsafe.apps.api.projects.views import (ProjectListingView, + ProjectCollectionView, ProjectDataView, ProjectCollaboratorsView, ProjectInstanceView) urlpatterns = [ url(r'^$', ProjectCollectionView.as_view(), name='index'), + url(r'^listing/(?P[a-zA-Z0-9\-_\.]+)', ProjectCollectionView.as_view(), name='listing'), url(r'^(?P[a-z0-9\-]+)/$', ProjectInstanceView.as_view(), name='project'), url(r'^(?P[a-z0-9\-]+)/collaborators/$', ProjectCollaboratorsView.as_view(), name='project_collaborators'), From 86eef1559a7b5e38da6adddffac8625a73c0ee2c Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 9 Mar 2017 15:57:43 -0600 Subject: [PATCH 036/520] Adding project listing view --- designsafe/apps/api/projects/views.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/designsafe/apps/api/projects/views.py b/designsafe/apps/api/projects/views.py index 76f3079f2a..ae12535457 100644 --- a/designsafe/apps/api/projects/views.py +++ b/designsafe/apps/api/projects/views.py @@ -1,6 +1,7 @@ from django.core.urlresolvers import reverse from django.conf import settings from django.http import JsonResponse +from django.http.response import HttpResponseForbidden from django.contrib.auth import get_user_model from django.core.mail import send_mail from designsafe.apps.api import tasks @@ -27,6 +28,21 @@ def template_project_storage_system(project): system_template['storage']['rootDir'].format(project.uuid) return system_template +class ProjectCollectionView(SecureMixin, BaseApiView): + def get(self, request, username): + """Returns a list of Project for a specific user. + + If the requesting user is a super user then we can 'impersonate' + another user. Else this is an unauthorized request. + + """ + if not request.user.is_superuser(): + return HttpResponseForbidden() + + user = get_user_model().objects.get(username=username) + ag = request.user.agave_oauth.client + projects = Project.list_projects(agave_client=ag) + return JsonResponse({'projects': projects}, encoder=AgaveJSONEncoder) class ProjectCollectionView(SecureMixin, BaseApiView): From dd933a1ef343c931dd4e12dc756511536f447e03 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 9 Mar 2017 16:00:22 -0600 Subject: [PATCH 037/520] Typo on class name --- designsafe/apps/api/projects/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designsafe/apps/api/projects/views.py b/designsafe/apps/api/projects/views.py index ae12535457..73fdc5c081 100644 --- a/designsafe/apps/api/projects/views.py +++ b/designsafe/apps/api/projects/views.py @@ -28,7 +28,7 @@ def template_project_storage_system(project): system_template['storage']['rootDir'].format(project.uuid) return system_template -class ProjectCollectionView(SecureMixin, BaseApiView): +class ProjectListingView(SecureMixin, BaseApiView): def get(self, request, username): """Returns a list of Project for a specific user. From fb6ed58a7d82f5e7b3529d9b6ea9e8bef101961a Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 9 Mar 2017 16:02:44 -0600 Subject: [PATCH 038/520] Adding test skipping for dashboard --- designsafe/apps/dashboard/tests.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/designsafe/apps/dashboard/tests.py b/designsafe/apps/dashboard/tests.py index 221b0fd126..8af99da130 100644 --- a/designsafe/apps/dashboard/tests.py +++ b/designsafe/apps/dashboard/tests.py @@ -1,5 +1,6 @@ import json import logging +from unittest import skip from elasticsearch_dsl import Q from django.test import TestCase from django.contrib.auth import get_user_model, signals @@ -37,8 +38,8 @@ def tearDown(self): s = IndexedFile.search() res = s.query('bool', must=[Q("match", **{"path._path": "ds_user"})]).extra(size=10000) res.execute() - for doc in res: - doc.delete(refresh=True, ignore=404) + #for doc in res: + # doc.delete(refresh=True, ignore=404) def test_dashboard_index(self): url = reverse('designsafe_dashboard:index') @@ -46,6 +47,7 @@ def test_dashboard_index(self): resp = self.client.get(url) self.assertEqual(resp.status_code, 200) + @skip('Skiping for now. TODO: Figure out what\'s up') def test_dashboard_agg_storage(self): url = reverse('designsafe_api:user_usage') @@ -53,4 +55,5 @@ def test_dashboard_agg_storage(self): resp = self.client.get(url) self.assertEqual(resp.status_code, 200) data = json.loads(resp.content) + logger.debug('data: %s', data) self.assertEqual(data["total_storage_bytes"], 2) From 710653c28e7c7656167757ad1120a8375110e92f Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 9 Mar 2017 16:50:04 -0600 Subject: [PATCH 039/520] Fixing typos all around --- designsafe/apps/api/projects/urls.py | 2 +- designsafe/apps/api/projects/views.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/designsafe/apps/api/projects/urls.py b/designsafe/apps/api/projects/urls.py index a95c9a45a2..8a2cf07a55 100644 --- a/designsafe/apps/api/projects/urls.py +++ b/designsafe/apps/api/projects/urls.py @@ -19,7 +19,7 @@ urlpatterns = [ url(r'^$', ProjectCollectionView.as_view(), name='index'), - url(r'^listing/(?P[a-zA-Z0-9\-_\.]+)', ProjectCollectionView.as_view(), name='listing'), + url(r'^listing/(?P[a-zA-Z0-9\-_\.]+)/?$', ProjectListingView.as_view(), name='listing'), url(r'^(?P[a-z0-9\-]+)/$', ProjectInstanceView.as_view(), name='project'), url(r'^(?P[a-z0-9\-]+)/collaborators/$', ProjectCollaboratorsView.as_view(), name='project_collaborators'), diff --git a/designsafe/apps/api/projects/views.py b/designsafe/apps/api/projects/views.py index 73fdc5c081..689d44c041 100644 --- a/designsafe/apps/api/projects/views.py +++ b/designsafe/apps/api/projects/views.py @@ -36,11 +36,12 @@ def get(self, request, username): another user. Else this is an unauthorized request. """ - if not request.user.is_superuser(): + if not request.user.is_superuser: return HttpResponseForbidden() user = get_user_model().objects.get(username=username) - ag = request.user.agave_oauth.client + ag = user.agave_oauth.client + logger.debug('profile: %s', ag.profiles.get()) projects = Project.list_projects(agave_client=ag) return JsonResponse({'projects': projects}, encoder=AgaveJSONEncoder) From 760a745d2acb208cd1763d562baf99315ba698de Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 9 Mar 2017 16:51:12 -0600 Subject: [PATCH 040/520] Deleting debug statements --- designsafe/apps/api/decorators.py | 3 --- designsafe/apps/api/projects/views.py | 1 - 2 files changed, 4 deletions(-) diff --git a/designsafe/apps/api/decorators.py b/designsafe/apps/api/decorators.py index fd1634a159..4d79995349 100644 --- a/designsafe/apps/api/decorators.py +++ b/designsafe/apps/api/decorators.py @@ -27,11 +27,8 @@ def _decode_jwt(jwt): """ #pubkey = settings.AGAVE_JWT_PUBKEY pubkey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUp/oV1vWc8/TkQSiAvTousMzO\nM4asB2iltr2QKozni5aVFu818MpOLZIr8LMnTzWllJvvaA5RAAdpbECb+48FjbBe\n0hseUdN5HpwvnH/DW8ZccGvk53I6Orq7hLCv1ZHtuOCokghz/ATrhyPq+QktMfXn\nRS4HrKGJTzxaCcU7OQIDAQAB' - logger.debug('pubkey: %s', pubkey) key_der = b64decode(pubkey) key = load_der_public_key(key_der, backend=default_backend()) - - logger.debug('jwt: %s', jwt) return pyjwt.decode(jwt, key, issuer=settings.AGAVE_JWT_ISSUER) #return pyjwt.decode(jwt, key, verify=False) diff --git a/designsafe/apps/api/projects/views.py b/designsafe/apps/api/projects/views.py index 689d44c041..7da02189fe 100644 --- a/designsafe/apps/api/projects/views.py +++ b/designsafe/apps/api/projects/views.py @@ -41,7 +41,6 @@ def get(self, request, username): user = get_user_model().objects.get(username=username) ag = user.agave_oauth.client - logger.debug('profile: %s', ag.profiles.get()) projects = Project.list_projects(agave_client=ag) return JsonResponse({'projects': projects}, encoder=AgaveJSONEncoder) From 35781b0c96d808396969cec6440f2061dd58fd0a Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Thu, 9 Mar 2017 17:04:58 -0600 Subject: [PATCH 041/520] datetimes in js are a gd mess --- .../apps/dashboard/js/charts/DS_TSBarChart.js | 36 ++++++++----------- .../dashboard/js/controllers/dashboardCtrl.js | 26 +++++++------- .../apps/dashboard/styles/dashboard.css | 1 + 3 files changed, 29 insertions(+), 34 deletions(-) diff --git a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/charts/DS_TSBarChart.js b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/charts/DS_TSBarChart.js index 7e82c73215..f08ec86a86 100644 --- a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/charts/DS_TSBarChart.js +++ b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/charts/DS_TSBarChart.js @@ -6,14 +6,16 @@ function DS_TSBarChart (element_id) { height = 500 - margin.top - margin.bottom, xSelector = function (d) {return d.datetime_utc;}, ySelector = function (d) {return d.value;}, - start_date = new Date(new Date().getTime() - 14 * 24 * 60 * 60 * 1000), - end_date = new Date(), + start_date = new Date(new Date(new Date().getTime() - 14 * 24 * 60 * 60 * 1000).setHours(0,0,0,0)), + end_date = new Date(new Date().setHours(0,0,0,0)), data, x, y, xAxis, yAxis, axis_label, focus, svg, dispatch = d3.dispatch('bar_click'); + var num_days = (end_date.getTime() - start_date.getTime()) / (24 * 60 * 60 *1000); + console.log(num_days) d3.select(window).on('resize', function () { width = $(element_id).width() - margin.left - margin.right; exports(); @@ -22,7 +24,7 @@ function DS_TSBarChart (element_id) { function exports () { d3.select(element_id).html(''); - x = d3.scaleTime().range([0, width]).domain([start_date, end_date]); + x = d3.scaleTime().range([0, width - margin.left-margin.right]).domain([start_date, end_date]); y = d3.scaleLinear().range([height, 0]); svg = d3.select(element_id).append("svg") @@ -86,27 +88,14 @@ function DS_TSBarChart (element_id) { .call(yAxis); focus.selectAll('.bar').remove(); - // focus.append("g") - // .selectAll("g") - // .data(data) - // .enter().append("g") - // // .attr("fill", function(d) { return z(d.key); }) - // .attr("x", function (d) { return x(xSelector(d)) - (width / x.ticks().length / 2) + 2.5 ;}) - // .selectAll("rect") - // .data(function(d) { console.log(d); return d.values; }) - // .enter().append("rect") - // .attr("class", "bar") - // - // .attr("y", function(d, i) { return height - y(i); }) - // .attr("height", function(d, i) { return y}) - // .attr("width", 15); focus.selectAll(".bar") .data(data) .enter().append("rect") .attr("class", "bar") - .attr("x", function (d) { return x(xSelector(d)) - (width / x.ticks().length / 2) + 2.5 ;}) - .attr("width", width / x.ticks().length - 5) + // .attr("x", function (d) { return x(xSelector(d)) - ( (width - margin.right - margin.right) / x.ticks().length / 2) + 2.5 ;}) + .attr("x", function (d) { return x(xSelector(d)) - (width - margin.left - margin.right) / num_days/2 + 2.5 }) + .attr("width", (width - margin.left - margin.right) / num_days - 5) .attr("y", function (d) {return y(ySelector(d));}) .attr("height", function(d) { return height - y(ySelector(d)); }) .on('click', bar_click); @@ -160,13 +149,18 @@ function DS_TSBarChart (element_id) { exports.start_date = function (d) { if (!arguments.length) return start_date; - start_date = d; + start_date = new Date(new Date(d.getTime() - (24 * 60 * 60 *1000)).setHours(0,0,0,0)); + x.domain([start_date, end_date]) + num_days = (end_date.getTime() - start_date.getTime()) / (24 * 60 * 60 *1000); + console.log(num_days) return exports; } exports.end_date = function (d) { if (!arguments.length) return end_date; - end_date = d; + end_date = new Date(new Date(d.getTime() - (24 * 60 * 60 *1000)).setHours(0,0,0,0)); + x.domain([start_date, end_date]); + num_days = (end_date.getTime() - start_date.getTime()) / (24 * 60 * 60 *1000); return exports; } diff --git a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js index 20880fa6cd..2e6646c7bc 100644 --- a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js +++ b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js @@ -1,14 +1,23 @@ angular.module('designsafe').controller('DashboardCtrl', ['$scope', 'UserService', 'NotificationService', 'AgaveService', 'TicketsService', function ($scope, UserService, NotificationService, AgaveService, TicketsService) { - $scope.jobs_count = 12; - $scope.storage_count = 151231231231232; - $scope.apps_count = 45; - $scope.activities_count = 42; $scope.display_job_details = false; $scope.loading_tickets = true; $scope.loading_jobs = true; $scope.today = new Date(); $scope.first_jobs_date = new Date($scope.today.getTime() - (14 * 24 * 60 * 60 * 1000 )) + $scope.first_jobs_date = new Date($scope.first_jobs_date.setHours(0,0,0,0)); + console.log($scope.first_jobs_date.getTime()); + $scope.chart = new DS_TSBarChart('#ds_jobs_chart') + .height(250) + .xSelector(function (d) { return d.key;}) + .ySelector(function (d) { return d.values.length;}) + .start_date($scope.first_jobs_date); + + $scope.chart.on('bar_click', function (ev, toggled) { + (toggled) ? $scope.display_job_details = true : $scope.display_job_details = false; + $scope.jobs_details = ev.values; + $scope.$apply(); + }); NotificationService.list({limit:5}).then(function (resp) { // console.log(resp) @@ -43,15 +52,6 @@ function ($scope, UserService, NotificationService, AgaveService, TicketsService $scope.loading_tickets = false; }) - $scope.chart = new DS_TSBarChart('#ds_jobs_chart') - .height(250) - .xSelector(function (d) { return d.key;}) - .ySelector(function (d) { return d.values.length;}); - $scope.chart.on('bar_click', function (ev, toggled) { - (toggled) ? $scope.display_job_details = true : $scope.display_job_details = false; - $scope.jobs_details = ev.values; - $scope.$apply(); - }); }]) diff --git a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/styles/dashboard.css b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/styles/dashboard.css index 2f72547ad0..0af7c905c8 100644 --- a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/styles/dashboard.css +++ b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/styles/dashboard.css @@ -26,6 +26,7 @@ .ds-chart .y.axis path { fill: none; + stroke: #d3d3d3; } .dashboard-stat { From fc0e4aa362cb237de3f435e437b04e47661a5690 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Fri, 10 Mar 2017 12:05:29 -0600 Subject: [PATCH 042/520] dashboarding --- .../designsafe/apps/dashboard/js/charts/DS_TSBarChart.js | 7 ++++--- .../apps/dashboard/js/controllers/dashboardCtrl.js | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/charts/DS_TSBarChart.js b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/charts/DS_TSBarChart.js index f08ec86a86..259156acf3 100644 --- a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/charts/DS_TSBarChart.js +++ b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/charts/DS_TSBarChart.js @@ -34,11 +34,11 @@ function DS_TSBarChart (element_id) { xAxis = d3.axisBottom(x) .tickPadding(0) // .tickSize(-height, 1, 0) - .ticks(13) + // .ticks(14) .tickFormat(d3.timeFormat("%m/%d")); yAxis = d3.axisLeft(y) - .ticks(3) + // .ticks(3) .tickSize(-width, 0, 0) .tickFormat(function(e){ if(Math.floor(e) != e) { @@ -149,10 +149,11 @@ function DS_TSBarChart (element_id) { exports.start_date = function (d) { if (!arguments.length) return start_date; + //this just gives a little padding for the first bar, so that + //it doesn't go outside the chart start_date = new Date(new Date(d.getTime() - (24 * 60 * 60 *1000)).setHours(0,0,0,0)); x.domain([start_date, end_date]) num_days = (end_date.getTime() - start_date.getTime()) / (24 * 60 * 60 *1000); - console.log(num_days) return exports; } diff --git a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js index 2e6646c7bc..0479edd15c 100644 --- a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js +++ b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/js/controllers/dashboardCtrl.js @@ -28,9 +28,10 @@ function ($scope, UserService, NotificationService, AgaveService, TicketsService $scope.usage = resp; }); - AgaveService.jobsListing({'created.gt':'2017-01-01'}).then(function (resp) { + AgaveService.jobsListing({'created.gt':moment($scope.first_jobs_date).format('Y-M-D')}).then(function (resp) { $scope.jobs = resp; $scope.chart_data = AgaveService.jobsByDate(resp); + // console.log($scope.jobs); $scope.chart.data($scope.chart_data); var tmp = _.groupBy($scope.jobs, function (d) {return d.appId}); From 6ee33b981e9ece89b13963ba4b645bd85f5d33b9 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Mon, 13 Mar 2017 14:53:34 -0500 Subject: [PATCH 043/520] map layout --- .../static/designsafe/apps/geo/html/map.html | 61 +++--- .../apps/geo/scripts/build/bundle.js | 179 +++++++++--------- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 5 +- .../static/designsafe/apps/geo/styles/geo.css | 35 ++-- .../templates/designsafe/apps/geo/index.html | 9 +- designsafe/common_settings.py | 2 +- 7 files changed, 151 insertions(+), 142 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index f7c13e1cbc..4df679390e 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -1,4 +1,4 @@ -
      +
      • @@ -6,33 +6,6 @@
      • -
      • - Create a new map -
      • -
      • - Open a map -
      • - -
      • - Import from Designsafe -
      • -
      • - - Import locally -
      • -
      • - - Add an image -
      • -
      • -   -
      • -
      • - - Save -
      @@ -78,5 +51,35 @@
      -
      +
      +
      +
      +
      +
      + + +
      + + +
      + + +
      + +
      +
      +
      +
      diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index a9789de2ed..661387b644 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -63,7 +63,7 @@ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 1); +/******/ return __webpack_require__(__webpack_require__.s = 5); /******/ }) /************************************************************************/ /******/ ([ @@ -73,6 +73,70 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _mapSidebar = __webpack_require__(3); + +var _mapSidebar2 = _interopRequireDefault(_mapSidebar); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mod = angular.module('ds.geo.controllers', []); + +mod.controller('MapSidebarCtrl', _mapSidebar2.default); + +exports.default = mod; + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _customOnChange = __webpack_require__(4); + +var _customOnChange2 = _interopRequireDefault(_customOnChange); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mod = angular.module('ds.geo.directives', []); + +mod.directive('customOnChange', _customOnChange2.default); + +exports.default = mod; + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +// import customOnChange from './custom-on-change'; + +var mod = angular.module('ds.geo.services', []); + +// mod.directive('customOnChange', customOnChange); + +exports.default = mod; + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + Object.defineProperty(exports, "__esModule", { value: true }); @@ -121,10 +185,7 @@ var MapSidebarCtrl = function () { this.map = L.map('geo_map', { layers: [streets, satellite] }).setView([51.505, -0.09], 6); L.control.layers(basemaps).addTo(this.map); - // L.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',{ - // maxZoom: 20, - // subdomains:['mt0','mt1','mt2','mt3'] - // }); + this.map.zoomControl.setPosition('bottomleft'); this.drawnItems = new L.FeatureGroup(); this.map.addLayer(this.drawnItems); @@ -250,70 +311,7 @@ var MapSidebarCtrl = function () { exports.default = MapSidebarCtrl; /***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -config.$inject = ["$stateProvider"]; -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _directives = __webpack_require__(2); - -var _controllers = __webpack_require__(4); - -var _services = __webpack_require__(5); - -var mod = angular.module('designsafe'); -mod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services'); - -function config($stateProvider) { - 'ngInject'; - - $stateProvider.state('geo', { - url: '', - templateUrl: '/static/designsafe/apps/geo/html/map.html', - controller: 'MapSidebarCtrl as vm', - resolve: { - auth: function auth() { - return true; - } - } - }); -} - -mod.config(config); - -exports.default = mod; - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _customOnChange = __webpack_require__(3); - -var _customOnChange2 = _interopRequireDefault(_customOnChange); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var mod = angular.module('ds.geo.directives', []); - -mod.directive('customOnChange', _customOnChange2.default); - -exports.default = mod; - -/***/ }), -/* 3 */ +/* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -334,43 +332,42 @@ function customOnChange() { } /***/ }), -/* 4 */ +/* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +config.$inject = ["$stateProvider"]; Object.defineProperty(exports, "__esModule", { value: true }); -var _mapSidebar = __webpack_require__(0); - -var _mapSidebar2 = _interopRequireDefault(_mapSidebar); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var mod = angular.module('ds.geo.controllers', []); - -mod.controller('MapSidebarCtrl', _mapSidebar2.default); +var _directives = __webpack_require__(1); -exports.default = mod; - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { +var _controllers = __webpack_require__(0); -"use strict"; +var _services = __webpack_require__(2); +var mod = angular.module('designsafe'); +mod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services'); -Object.defineProperty(exports, "__esModule", { - value: true -}); -// import customOnChange from './custom-on-change'; +function config($stateProvider) { + 'ngInject'; -var mod = angular.module('ds.geo.services', []); + $stateProvider.state('geo', { + url: '', + templateUrl: '/static/designsafe/apps/geo/html/map.html', + controller: 'MapSidebarCtrl as vm', + resolve: { + auth: function auth() { + return true; + } + } + }); +} -// mod.directive('customOnChange', customOnChange); +mod.config(config); exports.default = mod; diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 92c2c3b8df..8d45680154 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 06cc69b7de61efc168e1","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"names":["MapSidebarCtrl","$scope","$window","$timeout","LGeo","angular","element","hide","local_file_selected","attribution","maxZoom","streets","satellite","map","addLayer","drawnItems","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","object","options","color","fillColor","fillOpacity","$apply","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","L","geoJSON","getLayers","forEach","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","console","log","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","prop","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","mod","module","config","$stateProvider","templateUrl","controller","resolve","auth","directive","restrict","link","onChangeHandler","bind"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAA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,QAAb,EAAuBD,eAAvB;AACD;AALI,GAAP;AAOD,C;;;;;;;;;;;;;ACRD;;;;;;AAEA,IAAIX,MAAMtE,QAAQuE,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAD,IAAIK,UAAJ,CAAe,gBAAf;;kBAEeL,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMtE,QAAQuE,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeD,G","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 06cc69b7de61efc168e1","export default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n\n // L.control.layers({\n // \"Street\": map.tileLayer,\n // \"Satellite\": L.mapbox.tileLayer(\"my satellite imagery map id\")\n // }, null).addTo(this.map);\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6);\n\n L.control.layers(basemaps).addTo(this.map);\n // L.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',{\n // maxZoom: 20,\n // subdomains:['mt0','mt1','mt2','mt3']\n // });\n\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n if (this.current_layer == e.layer) {\n this.current_layer = null;\n } else {\n this.current_layer = e.layer;\n };\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillColor = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n open_file_dialog () {\n this.$timeout(()=> {\n angular.element('#local_file').trigger('click');\n });\n }\n\n open_image_dialog () {\n this.$timeout(()=> {\n angular.element('#local_image').trigger('click');\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n console.log(exif)\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 4241d9c3133f98e0c8ec","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","MapSidebarCtrl","$scope","$window","$timeout","LGeo","element","hide","local_file_selected","attribution","maxZoom","streets","satellite","map","zoomControl","setPosition","addLayer","drawnItems","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","object","options","color","fillColor","fillOpacity","$apply","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","L","geoJSON","getLayers","forEach","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","console","log","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","prop","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","customOnChange","restrict","link","onChangeHandler","scope","$eval","attrs","bind","config","$stateProvider","templateUrl","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;ACh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gC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BxF,YAH0B;AAI1ByF,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAED7F,CAAA;;kBAIeA,C","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 4241d9c3133f98e0c8ec","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","export default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n\n // L.control.layers({\n // \"Street\": map.tileLayer,\n // \"Satellite\": L.mapbox.tileLayer(\"my satellite imagery map id\")\n // }, null).addTo(this.map);\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6);\n\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n if (this.current_layer == e.layer) {\n this.current_layer = null;\n } else {\n this.current_layer = e.layer;\n };\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillColor = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n open_file_dialog () {\n this.$timeout(()=> {\n angular.element('#local_file').trigger('click');\n });\n }\n\n open_image_dialog () {\n this.$timeout(()=> {\n angular.element('#local_image').trigger('click');\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n console.log(exif)\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index 0becabfceb..c514d094d9 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -34,10 +34,7 @@ export default class MapSidebarCtrl { this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6); L.control.layers(basemaps).addTo(this.map); - // L.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',{ - // maxZoom: 20, - // subdomains:['mt0','mt1','mt2','mt3'] - // }); + this.map.zoomControl.setPosition('bottomleft'); this.drawnItems = new L.FeatureGroup(); this.map.addLayer(this.drawnItems); diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css index 60d6ac7b98..e5d0df7679 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -1,5 +1,5 @@ -#map_container { +#container { display: flex; min-height: 100vh; } @@ -15,11 +15,7 @@ display: flex; } -#geo_map { - width: 80%; - flex: 1; - background: grey; -} + #geo_sidebar .list-group-item { background-color: #373737; @@ -31,16 +27,25 @@ cursor: pointer; } -#geo_sidebar .list-group-item.save { - background-color: #257b5f; -} - #geo_sidebar .current-layer-details { - bottom: 0; flex-grow: 1; vertical-align: bottom; display: flex; - flex-direction: column-reverse; + /*flex-direction: column-reverse;*/ +} + +#right_panel { + width: 100%; + display: flex; + flex-direction: column; + align-items: stretch; + background-color: #fff; +} + +#top_toolbar { + height: 2em; + border-bottom: 1px solid #d2d2d2; + background-color: #d2d2d2; } .current-layer-details table { @@ -48,3 +53,9 @@ color: #6b6a6a; margin-bottom: 0px; } + +#geo_map { + width: 100%; + flex: 1; + background: grey; +} diff --git a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html index 26d90f18aa..abcbb4bddd 100644 --- a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html +++ b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html @@ -23,13 +23,14 @@ + -{% endaddtoblock %} - -{% addtoblock 'js' %} - + + + + {% endaddtoblock %} {% addtoblock "css" %} diff --git a/designsafe/common_settings.py b/designsafe/common_settings.py index daedb7ec86..551db0a3a4 100644 --- a/designsafe/common_settings.py +++ b/designsafe/common_settings.py @@ -97,7 +97,7 @@ 'designsafe.apps.user_activity', 'designsafe.apps.token_access', 'designsafe.apps.search', - 'designsafe.apps.geo' + 'designsafe.apps.geo', #haystack integration 'haystack' From 3f1475604d835d76b9058451aaf641929b15a396 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Mon, 13 Mar 2017 17:15:43 -0500 Subject: [PATCH 044/520] map refactoring --- .../static/designsafe/apps/geo/html/map.html | 20 ++++- .../apps/geo/scripts/build/bundle.js | 75 ++++++++++++++++--- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 33 +++++--- .../apps/geo/scripts/models/layer_group.js | 12 +++ .../static/designsafe/apps/geo/styles/geo.css | 18 +++-- 6 files changed, 131 insertions(+), 29 deletions(-) create mode 100644 designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 4df679390e..44ad605b67 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -1,13 +1,27 @@
      + + +
      @@ -43,7 +57,7 @@
      Description - +
      diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index 661387b644..7de2ec257a 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -143,8 +143,16 @@ Object.defineProperty(exports, "__esModule", { var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _layer_group = __webpack_require__(6); + +var _layer_group2 = _interopRequireDefault(_layer_group); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +console.log(_layer_group2.default); + var MapSidebarCtrl = function () { MapSidebarCtrl.$inject = ["$scope", "$window", "$timeout"]; function MapSidebarCtrl($scope, $window, $timeout) { @@ -161,10 +169,6 @@ var MapSidebarCtrl = function () { angular.element('nav').hide(); angular.element('footer').hide(); - // L.control.layers({ - // "Street": map.tileLayer, - // "Satellite": L.mapbox.tileLayer("my satellite imagery map id") - // }, null).addTo(this.map); //method binding for callback, sigh... this.local_file_selected = this.local_file_selected.bind(this); @@ -183,25 +187,28 @@ var MapSidebarCtrl = function () { }; this.map = L.map('geo_map', { layers: [streets, satellite] }).setView([51.505, -0.09], 6); - + this.map_title = 'New Map'; L.control.layers(basemaps).addTo(this.map); this.map.zoomControl.setPosition('bottomleft'); - this.drawnItems = new L.FeatureGroup(); - this.map.addLayer(this.drawnItems); + // this.drawnItems = new L.FeatureGroup(); + // this.map.addLayer(this.drawnItems); + this.layer_groups = [new _layer_group2.default('New Layer', [new L.FeatureGroup()])]; + this.map.addLayer(this.layer_groups[0].feature_group[0]); + this.active_layer_group = this.layer_groups[0]; var drawControl = new L.Control.Draw({ position: 'topright', draw: { circle: false }, edit: { - featureGroup: this.drawnItems, + featureGroup: this.active_layer_group.feature_group, remove: true } }); - this.drawnItems.on('click', function (e) { + this.active_layer_group.on('click', function (e) { if (_this.current_layer == e.layer) { _this.current_layer = null; } else { @@ -210,7 +217,7 @@ var MapSidebarCtrl = function () { _this.$scope.$apply(); }); - this.map.addControl(drawControl); + // this.map.addControl(drawControl); this.map.on('draw:created', function (e) { var object = e.layer; @@ -224,6 +231,18 @@ var MapSidebarCtrl = function () { } // end constructor _createClass(MapSidebarCtrl, [{ + key: 'create_layer', + value: function create_layer() { + console.log("create_layer"); + this.layers_groups.push(new L.LayerGroup()); + } + }, { + key: 'select_active_layer_group', + value: function select_active_layer_group(lg) { + this.active_layer_group = lg; + lg.active = true; + } + }, { key: 'open_file_dialog', value: function open_file_dialog() { this.$timeout(function () { @@ -371,6 +390,42 @@ mod.config(config); exports.default = mod; +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var LayerGroup = function () { + function LayerGroup(label, fg) { + _classCallCheck(this, LayerGroup); + + this.label = label; + this.feature_group = fg; + console.log(this.feature_group); + } + + _createClass(LayerGroup, [{ + key: "add_feature", + value: function add_feature(f) { + this.feature_group.push(f); + } + }]); + + return LayerGroup; +}(); + +exports.default = LayerGroup; + /***/ }) /******/ ]); //# sourceMappingURL=bundle.js.map \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 8d45680154..736e8194cb 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 4241d9c3133f98e0c8ec","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","MapSidebarCtrl","$scope","$window","$timeout","LGeo","element","hide","local_file_selected","attribution","maxZoom","streets","satellite","map","zoomControl","setPosition","addLayer","drawnItems","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","object","options","color","fillColor","fillOpacity","$apply","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","L","geoJSON","getLayers","forEach","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","console","log","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","prop","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","customOnChange","restrict","link","onChangeHandler","scope","$eval","attrs","bind","config","$stateProvider","templateUrl","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DA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V;AACA;;AAEA,SAASuF,MAAT,CAAgBC,cAAhB,EAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BxF,YAH0B;AAI1ByF,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAED7F,CAAA;;kBAIeA,C","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 4241d9c3133f98e0c8ec","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","export default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n\n // L.control.layers({\n // \"Street\": map.tileLayer,\n // \"Satellite\": L.mapbox.tileLayer(\"my satellite imagery map id\")\n // }, null).addTo(this.map);\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6);\n\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n this.drawnItems = new L.FeatureGroup();\n this.map.addLayer(this.drawnItems);\n\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.drawnItems,\n remove: true\n }\n });\n\n this.drawnItems.on('click', (e) => {\n if (this.current_layer == e.layer) {\n this.current_layer = null;\n } else {\n this.current_layer = e.layer;\n };\n this.$scope.$apply();\n });\n\n this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillColor = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n open_file_dialog () {\n this.$timeout(()=> {\n angular.element('#local_file').trigger('click');\n });\n }\n\n open_image_dialog () {\n this.$timeout(()=> {\n angular.element('#local_image').trigger('click');\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n console.log(exif)\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap fdeadf933d75c8ac0f5d","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js"],"names":["mod","angular","module","controller","directive","console","log","MapSidebarCtrl","$scope","$window","$timeout","LGeo","element","hide","local_file_selected","attribution","maxZoom","streets","satellite","map_title","L","control","layers","basemaps","map","zoomControl","setPosition","addLayer","layer_groups","feature_group","active_layer_group","drawControl","Control","Draw","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","object","options","color","fillColor","fillOpacity","drawnItems","$apply","layers_groups","push","lg","active","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","prop","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","customOnChange","restrict","link","onChangeHandler","scope","$eval","attrs","bind","config","$stateProvider","templateUrl","resolve","auth","LayerGroup","label"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;;;AAEA,IAAIA,MAAMC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B;AACAD,QAAEE,IAAF,GAAgBN,GAAhB;AACAI,QAAEG,WAAF;AACAH,QAAEI,KAAF;AACD;;;;;;;;;;;;;;;;;;;AC/JY,SAASC,cAAT,GAA0B;AACvC,SAAO;AACLC,UADK;AAELC,UAAM,QAAiC;AACrC,UAAIC,kBAAkBC,MAAMC,KAAN,CAAYC,MAAMN,EAAxC;AACAnF,cAAQ0F,IAAR,CAAa,QAAb,EAAuBJ,eAAvB;AACD;AALI,GAAP;AAOD,C;;;;;;;;;;;;;ACRD;;AACA;;AACA;;AAEA,IAAIlG,MAAMC,QAAQC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASqG,MAAT,CAAgBC,cAAhB,EAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BtG,YAH0B;AAI1BuG,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAED3G,CAAA;;kBAIeA,C;;;;;;;;;;;;;;;;;IC1BM4G,U;AAEK;AAAA;;AACtB,SAAKC,KAAL,GAAaA,KAAb;AACA;AACAxG,YAAQC,GAAR,CAAY,KAAKuB,EAAjB;AACD;;;;6BAEe;AACd,WAAKA,YAAL;AACD","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fdeadf933d75c8ac0f5d","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","import LayerGroup from '../models/layer_group.js';\nconsole.log(LayerGroup)\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // this.drawnItems = new L.FeatureGroup();\n // this.map.addLayer(this.drawnItems);\n\n this.layer_groups = [new LayerGroup('New Layer', [new L.FeatureGroup()])];\n this.map.addLayer(this.layer_groups[0].feature_group[0]);\n this.active_layer_group = this.layer_groups[0];\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.active_layer_group.feature_group,\n remove: true\n }\n });\n\n this.active_layer_group.on('click', (e) => {\n if (this.current_layer == e.layer) {\n this.current_layer = null;\n } else {\n this.current_layer = e.layer;\n };\n this.$scope.$apply();\n });\n\n // this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillColor = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n create_layer () {\n console.log(\"create_layer\");\n this.layers_groups.push(new L.LayerGroup());\n\n }\n\n select_active_layer_group(lg) {\n this.active_layer_group = lg;\n lg.active = true;\n }\n\n open_file_dialog () {\n this.$timeout(()=> {\n angular.element('#local_file').trigger('click');\n });\n }\n\n open_image_dialog () {\n this.$timeout(()=> {\n angular.element('#local_image').trigger('click');\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n console.log(exif)\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n console.log(this.feature_group)\n }\n\n add_feature (f) {\n this.feature_group.push(f);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index c514d094d9..c1ad1eac6a 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -1,3 +1,6 @@ +import LayerGroup from '../models/layer_group.js'; +console.log(LayerGroup) + export default class MapSidebarCtrl { constructor ($scope, $window, $timeout) { @@ -9,10 +12,6 @@ export default class MapSidebarCtrl { angular.element('nav').hide(); angular.element('footer').hide(); - // L.control.layers({ - // "Street": map.tileLayer, - // "Satellite": L.mapbox.tileLayer("my satellite imagery map id") - // }, null).addTo(this.map); //method binding for callback, sigh... this.local_file_selected = this.local_file_selected.bind(this); @@ -32,25 +31,28 @@ export default class MapSidebarCtrl { }; this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6); - + this.map_title = 'New Map'; L.control.layers(basemaps).addTo(this.map); this.map.zoomControl.setPosition('bottomleft'); - this.drawnItems = new L.FeatureGroup(); - this.map.addLayer(this.drawnItems); + // this.drawnItems = new L.FeatureGroup(); + // this.map.addLayer(this.drawnItems); + this.layer_groups = [new LayerGroup('New Layer', [new L.FeatureGroup()])]; + this.map.addLayer(this.layer_groups[0].feature_group[0]); + this.active_layer_group = this.layer_groups[0]; let drawControl = new L.Control.Draw({ position: 'topright', draw: { circle: false, }, edit: { - featureGroup: this.drawnItems, + featureGroup: this.active_layer_group.feature_group, remove: true } }); - this.drawnItems.on('click', (e) => { + this.active_layer_group.on('click', (e) => { if (this.current_layer == e.layer) { this.current_layer = null; } else { @@ -59,7 +61,7 @@ export default class MapSidebarCtrl { this.$scope.$apply(); }); - this.map.addControl(drawControl); + // this.map.addControl(drawControl); this.map.on('draw:created', (e) => { let object = e.layer; @@ -74,6 +76,17 @@ export default class MapSidebarCtrl { } // end constructor + create_layer () { + console.log("create_layer"); + this.layers_groups.push(new L.LayerGroup()); + + } + + select_active_layer_group(lg) { + this.active_layer_group = lg; + lg.active = true; + } + open_file_dialog () { this.$timeout(()=> { angular.element('#local_file').trigger('click'); diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js new file mode 100644 index 0000000000..eafb44d311 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js @@ -0,0 +1,12 @@ +export default class LayerGroup { + + constructor (label, fg) { + this.label = label; + this.feature_group = fg; + console.log(this.feature_group) + } + + add_feature (f) { + this.feature_group.push(f); + } +} diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css index e5d0df7679..66b2485d1c 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -6,10 +6,11 @@ #geo_sidebar { width: 20%; + font-size: 0.85em; float: left; flex: 0 0 230px; - background: #373737; - color: #ababab; + background: #404040; + color: #fff; border-right: 1px solid #d3d3d3; flex-direction: column; display: flex; @@ -17,16 +18,23 @@ -#geo_sidebar .list-group-item { - background-color: #373737; +#geo_sidebar .list-group-item.menu{ + background-color: #404040; border-bottom: 1px solid #707070; - border-left: 0px; + border-left: 5px; border-right: 0px; border-top: 0px; margin-top: 1px; cursor: pointer; + padding-top: 3px; + padding-bottom: 3px; } +#geo_sidebar .list-group-item.menu.active { + border-left: 5px solid cyan; +} + + #geo_sidebar .current-layer-details { flex-grow: 1; vertical-align: bottom; From 0985602bd4b5bf571f22353c02a4d09b6e4fba80 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Tue, 14 Mar 2017 11:16:20 -0500 Subject: [PATCH 045/520] adding layers etc --- .../static/designsafe/apps/geo/html/map.html | 20 +-- .../apps/geo/scripts/build/bundle.js | 117 ++++++++---------- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 46 +++---- .../apps/geo/scripts/models/layer_group.js | 5 +- .../static/designsafe/apps/geo/styles/geo.css | 1 + 6 files changed, 91 insertions(+), 100 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 44ad605b67..38f28a2bf8 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -18,10 +18,13 @@ +
      @@ -83,15 +86,16 @@
      -
      - + + diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index 7de2ec257a..ba22a8f4f4 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -63,7 +63,7 @@ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 5); +/******/ return __webpack_require__(__webpack_require__.s = 6); /******/ }) /************************************************************************/ /******/ ([ @@ -143,7 +143,7 @@ Object.defineProperty(exports, "__esModule", { var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _layer_group = __webpack_require__(6); +var _layer_group = __webpack_require__(5); var _layer_group2 = _interopRequireDefault(_layer_group); @@ -168,6 +168,8 @@ var MapSidebarCtrl = function () { angular.element('header').hide(); angular.element('nav').hide(); angular.element('footer').hide(); + this.primary_color = '#ff0000'; + this.secondary_color = '#ff0000'; //method binding for callback, sigh... this.local_file_selected = this.local_file_selected.bind(this); @@ -194,8 +196,8 @@ var MapSidebarCtrl = function () { // this.drawnItems = new L.FeatureGroup(); // this.map.addLayer(this.drawnItems); - this.layer_groups = [new _layer_group2.default('New Layer', [new L.FeatureGroup()])]; - this.map.addLayer(this.layer_groups[0].feature_group[0]); + this.layer_groups = [new _layer_group2.default('New Group', new L.FeatureGroup())]; + this.map.addLayer(this.layer_groups[0].feature_group); this.active_layer_group = this.layer_groups[0]; var drawControl = new L.Control.Draw({ position: 'topright', @@ -208,24 +210,22 @@ var MapSidebarCtrl = function () { } }); - this.active_layer_group.on('click', function (e) { - if (_this.current_layer == e.layer) { - _this.current_layer = null; - } else { - _this.current_layer = e.layer; - }; - _this.$scope.$apply(); + this.active_layer_group.feature_group.on('click', function (e) { + // console.log(e, e.layer) }); - // this.map.addControl(drawControl); + this.map.addControl(drawControl); this.map.on('draw:created', function (e) { var object = e.layer; - object.options.color = '#ff0000'; - object.options.fillColor = '#ff0000'; + object.on('click', function (e) { + console.log(e); + }); + object.options.color = _this.secondary_color; + object.options.fillColor = _this.primary_color; object.options.fillOpacity = 0.8; - _this.drawnItems.addLayer(object); - _this.current_layer = object; + _this.active_layer_group.feature_group.addLayer(object); + // this.current_layer = object; _this.$scope.$apply(); }); } // end constructor @@ -234,28 +234,27 @@ var MapSidebarCtrl = function () { key: 'create_layer', value: function create_layer() { console.log("create_layer"); - this.layers_groups.push(new L.LayerGroup()); + var lg = new _layer_group2.default("New Group", new L.LayerGroup()); + this.layer_groups.push(lg); + this.active_layer_group = this.layer_groups[this.layer_groups.length - 1]; + this.map.addLayer(lg.feature_group); + } + }, { + key: 'show_hide_layer_group', + value: function show_hide_layer_group(lg) { + console.log(lg); + lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group); } }, { key: 'select_active_layer_group', value: function select_active_layer_group(lg) { this.active_layer_group = lg; lg.active = true; + lg.show = true; } }, { key: 'open_file_dialog', - value: function open_file_dialog() { - this.$timeout(function () { - angular.element('#local_file').trigger('click'); - }); - } - }, { - key: 'open_image_dialog', - value: function open_image_dialog() { - this.$timeout(function () { - angular.element('#local_image').trigger('click'); - }); - } + value: function open_file_dialog() {} }, { key: 'local_file_selected', value: function local_file_selected(ev) { @@ -357,6 +356,30 @@ function customOnChange() { "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var LayerGroup = function LayerGroup(label, fg) { + _classCallCheck(this, LayerGroup); + + this.label = label; + this.feature_group = fg; + this.show = true; + console.log(this.feature_group); +}; + +exports.default = LayerGroup; + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + config.$inject = ["$stateProvider"]; Object.defineProperty(exports, "__esModule", { value: true @@ -390,42 +413,6 @@ mod.config(config); exports.default = mod; -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var LayerGroup = function () { - function LayerGroup(label, fg) { - _classCallCheck(this, LayerGroup); - - this.label = label; - this.feature_group = fg; - console.log(this.feature_group); - } - - _createClass(LayerGroup, [{ - key: "add_feature", - value: function add_feature(f) { - this.feature_group.push(f); - } - }]); - - return LayerGroup; -}(); - -exports.default = LayerGroup; - /***/ }) /******/ ]); //# sourceMappingURL=bundle.js.map \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 736e8194cb..9c98dddb2e 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap fdeadf933d75c8ac0f5d","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js"],"names":["mod","angular","module","controller","directive","console","log","MapSidebarCtrl","$scope","$window","$timeout","LGeo","element","hide","local_file_selected","attribution","maxZoom","streets","satellite","map_title","L","control","layers","basemaps","map","zoomControl","setPosition","addLayer","layer_groups","feature_group","active_layer_group","drawControl","Control","Draw","position","draw","circle","edit","featureGroup","remove","current_layer","e","layer","object","options","color","fillColor","fillOpacity","drawnItems","$apply","layers_groups","push","lg","active","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","prop","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","customOnChange","restrict","link","onChangeHandler","scope","$eval","attrs","bind","config","$stateProvider","templateUrl","resolve","auth","LayerGroup","label"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,oBAAf,EAAqC,EAArC,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I,QAAEG,WAAF;AACAH,QAAEI,KAAF;AACD;;;;;;;;;;;;;;;;;;;AC/JY,SAASC,cAAT,GAA0B;AACvC,SAAO;AACLC,UADK;AAELC,UAAM,QAAiC;AACrC,UAAIC,kBAAkBC,MAAMC,KAAN,CAAYC,MAAMN,EAAxC;AACAnF,cAAQ0F,IAAR,CAAa,QAAb,EAAuBJ,eAAvB;AACD;AALI,GAAP;AAOD,C;;;;;;;;;;;;;ACRD;;AACA;;AACA;;AAEA,IAAIlG,MAAMC,QAAQC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASqG,MAAT,CAAgBC,cAAhB,EAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BtG,YAH0B;AAI1BuG,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAED3G,CAAA;;kBAIeA,C;;;;;;;;;;;;;;;;;IC1BM4G,U;AAEK;AAAA;;AACtB,SAAKC,KAAL,GAAaA,KAAb;AACA;AACAxG,YAAQC,GAAR,CAAY,KAAKuB,EAAjB;AACD;;;;6BAEe;AACd,WAAKA,YAAL;AACD","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fdeadf933d75c8ac0f5d","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","import LayerGroup from '../models/layer_group.js';\nconsole.log(LayerGroup)\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // this.drawnItems = new L.FeatureGroup();\n // this.map.addLayer(this.drawnItems);\n\n this.layer_groups = [new LayerGroup('New Layer', [new L.FeatureGroup()])];\n this.map.addLayer(this.layer_groups[0].feature_group[0]);\n this.active_layer_group = this.layer_groups[0];\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.active_layer_group.feature_group,\n remove: true\n }\n });\n\n this.active_layer_group.on('click', (e) => {\n if (this.current_layer == e.layer) {\n this.current_layer = null;\n } else {\n this.current_layer = e.layer;\n };\n this.$scope.$apply();\n });\n\n // this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = '#ff0000';\n object.options.fillColor = '#ff0000';\n object.options.fillOpacity = 0.8;\n this.drawnItems.addLayer(object);\n this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n create_layer () {\n console.log(\"create_layer\");\n this.layers_groups.push(new L.LayerGroup());\n\n }\n\n select_active_layer_group(lg) {\n this.active_layer_group = lg;\n lg.active = true;\n }\n\n open_file_dialog () {\n this.$timeout(()=> {\n angular.element('#local_file').trigger('click');\n });\n }\n\n open_image_dialog () {\n this.$timeout(()=> {\n angular.element('#local_image').trigger('click');\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n console.log(exif)\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n console.log(this.feature_group)\n }\n\n add_feature (f) {\n this.feature_group.push(f);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 3a956ced4d967b2773b4","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","console","log","MapSidebarCtrl","$scope","$window","$timeout","LGeo","element","hide","primary_color","secondary_color","local_file_selected","attribution","maxZoom","streets","satellite","map_title","L","control","layers","basemaps","map","zoomControl","setPosition","addLayer","layer_groups","feature_group","active_layer_group","drawControl","Control","Draw","position","draw","circle","edit","featureGroup","remove","object","e","layer","on","options","fillColor","fillOpacity","$apply","lg","push","show","active","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","current_layer","setStyle","prop","drawnItems","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","customOnChange","restrict","link","onChangeHandler","scope","$eval","attrs","bind","config","$stateProvider","templateUrl","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAF,IAAIG,UAAJ,CAAe,gBAAf;;kBAEeH,G;;;;;;;;;;;;;ACNf;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,mBAAf,EAAoC,EAApC,CAAV;;AAEAF,IAAII,SAAJ,CAAc,gBAAd;;kBAEeJ,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeF,G;;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;;;ACNyB;AAAA;;AACtB;AACA,OAAKrE,aAAL;AACA,OAAKqB,IAAL,GAAY,IAAZ;AACA/C,UAAQC,GAAR,CAAY,KAAZ;AACD,C;;;;;;;;;;;;;;;ACPH;;AACA;;AACA;;AAEA,IAAIN,MAAMC,QAAQC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASuG,MAAT,CAAgBC,cAAhB,EAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BxG,YAH0B;AAI1ByG,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAED7G,CAAA;;kBAIeA,C","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 3a956ced4d967b2773b4","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","import LayerGroup from '../models/layer_group.js';\nconsole.log(LayerGroup)\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // this.drawnItems = new L.FeatureGroup();\n // this.map.addLayer(this.drawnItems);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.active_layer_group.feature_group,\n remove: true\n }\n });\n\n this.active_layer_group.feature_group.on('click', (e) => {\n // console.log(e, e.layer)\n });\n\n this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.on('click', e => {\n console.log(e)\n })\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n // this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n create_layer () {\n console.log(\"create_layer\");\n let lg = new LayerGroup(\"New Group\", new L.LayerGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n }\n\n show_hide_layer_group (lg) {\n console.log(lg);\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_file_dialog () {\n\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n console.log(exif)\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n console.log(this.feature_group)\n }\n\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index c1ad1eac6a..b83ebcaf5e 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -11,6 +11,8 @@ export default class MapSidebarCtrl { angular.element('header').hide(); angular.element('nav').hide(); angular.element('footer').hide(); + this.primary_color = '#ff0000'; + this.secondary_color = '#ff0000'; //method binding for callback, sigh... this.local_file_selected = this.local_file_selected.bind(this); @@ -38,8 +40,8 @@ export default class MapSidebarCtrl { // this.drawnItems = new L.FeatureGroup(); // this.map.addLayer(this.drawnItems); - this.layer_groups = [new LayerGroup('New Layer', [new L.FeatureGroup()])]; - this.map.addLayer(this.layer_groups[0].feature_group[0]); + this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())]; + this.map.addLayer(this.layer_groups[0].feature_group); this.active_layer_group = this.layer_groups[0]; let drawControl = new L.Control.Draw({ position: 'topright', @@ -52,24 +54,22 @@ export default class MapSidebarCtrl { } }); - this.active_layer_group.on('click', (e) => { - if (this.current_layer == e.layer) { - this.current_layer = null; - } else { - this.current_layer = e.layer; - }; - this.$scope.$apply(); + this.active_layer_group.feature_group.on('click', (e) => { + // console.log(e, e.layer) }); - // this.map.addControl(drawControl); + this.map.addControl(drawControl); this.map.on('draw:created', (e) => { let object = e.layer; - object.options.color = '#ff0000'; - object.options.fillColor = '#ff0000'; + object.on('click', e => { + console.log(e) + }) + object.options.color = this.secondary_color; + object.options.fillColor = this.primary_color; object.options.fillOpacity = 0.8; - this.drawnItems.addLayer(object); - this.current_layer = object; + this.active_layer_group.feature_group.addLayer(object); + // this.current_layer = object; this.$scope.$apply(); }); @@ -78,25 +78,25 @@ export default class MapSidebarCtrl { create_layer () { console.log("create_layer"); - this.layers_groups.push(new L.LayerGroup()); + let lg = new LayerGroup("New Group", new L.LayerGroup()); + this.layer_groups.push(lg); + this.active_layer_group = this.layer_groups[this.layer_groups.length -1]; + this.map.addLayer(lg.feature_group); + } + show_hide_layer_group (lg) { + console.log(lg); + lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group); } select_active_layer_group(lg) { this.active_layer_group = lg; lg.active = true; + lg.show = true; } open_file_dialog () { - this.$timeout(()=> { - angular.element('#local_file').trigger('click'); - }); - } - open_image_dialog () { - this.$timeout(()=> { - angular.element('#local_image').trigger('click'); - }); } local_file_selected (ev) { diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js index eafb44d311..e2cfe4d09d 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js @@ -3,10 +3,9 @@ export default class LayerGroup { constructor (label, fg) { this.label = label; this.feature_group = fg; + this.show = true; console.log(this.feature_group) } - add_feature (f) { - this.feature_group.push(f); - } + } diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css index 66b2485d1c..bb0986070f 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -32,6 +32,7 @@ #geo_sidebar .list-group-item.menu.active { border-left: 5px solid cyan; + background-color: #646464; } From f257d5a55cee68090e750a6abad637ec1320201e Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Tue, 14 Mar 2017 17:10:16 -0500 Subject: [PATCH 046/520] css is aweful --- .../static/designsafe/apps/geo/html/map.html | 144 +++++++++++------- .../apps/geo/scripts/build/bundle.js | 77 ++++++---- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 50 +++--- .../apps/geo/scripts/models/layer_group.js | 4 +- .../static/designsafe/apps/geo/styles/geo.css | 61 ++++++-- designsafe/apps/geo/views.py | 2 - 7 files changed, 224 insertions(+), 116 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 38f28a2bf8..4b7a955716 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -1,4 +1,4 @@ -
      +
      -
      -
      - - - - - - - - - - - - - - - - -
      Fill - - -
      Stroke - - -
      Opacity - - -
      Description - -
      -
      + + +
      +
      +
      + + +
      + + + + +
      @@ -83,7 +124,6 @@
    -
    - - + +
    + Lat: {{vm.current_mouse_coordinates.lat | number:3}} Lon: {{vm.current_mouse_coordinates.lng| number:3 }}
    +
    diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index ba22a8f4f4..ae842db3e5 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -151,8 +151,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -console.log(_layer_group2.default); - var MapSidebarCtrl = function () { MapSidebarCtrl.$inject = ["$scope", "$window", "$timeout"]; function MapSidebarCtrl($scope, $window, $timeout) { @@ -199,58 +197,71 @@ var MapSidebarCtrl = function () { this.layer_groups = [new _layer_group2.default('New Group', new L.FeatureGroup())]; this.map.addLayer(this.layer_groups[0].feature_group); this.active_layer_group = this.layer_groups[0]; - var drawControl = new L.Control.Draw({ - position: 'topright', - draw: { - circle: false - }, - edit: { - featureGroup: this.active_layer_group.feature_group, - remove: true - } - }); + // update the current layer to show the details tab this.active_layer_group.feature_group.on('click', function (e) { - // console.log(e, e.layer) + _this.current_layer ? _this.current_layer = null : _this.current_layer = e.layer; + _this.$scope.$apply(); }); - this.map.addControl(drawControl); + this.add_draw_controls(this.active_layer_group.feature_group); this.map.on('draw:created', function (e) { var object = e.layer; - object.on('click', function (e) { - console.log(e); - }); object.options.color = _this.secondary_color; object.options.fillColor = _this.primary_color; object.options.fillOpacity = 0.8; _this.active_layer_group.feature_group.addLayer(object); // this.current_layer = object; _this.$scope.$apply(); + console.log(_this.active_layer_group); + }); + + this.map.on('mousemove', function (e) { + _this.current_mouse_coordinates = e.latlng; + _this.$scope.$apply(); }); } // end constructor _createClass(MapSidebarCtrl, [{ + key: 'add_draw_controls', + value: function add_draw_controls(fg) { + var dc = new L.Control.Draw({ + position: 'topright', + draw: { + circle: false + }, + edit: { + featureGroup: fg, + remove: true + } + }); + this.map.addControl(dc); + this.drawControl = dc; + } + }, { key: 'create_layer', value: function create_layer() { - console.log("create_layer"); - var lg = new _layer_group2.default("New Group", new L.LayerGroup()); + var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); this.layer_groups.push(lg); this.active_layer_group = this.layer_groups[this.layer_groups.length - 1]; this.map.addLayer(lg.feature_group); + this.select_active_layer_group(this.active_layer_group); } }, { key: 'show_hide_layer_group', value: function show_hide_layer_group(lg) { - console.log(lg); lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group); } }, { key: 'select_active_layer_group', value: function select_active_layer_group(lg) { + this.map.removeControl(this.drawControl); + this.add_draw_controls(lg.feature_group); this.active_layer_group = lg; lg.active = true; lg.show = true; + debugger; } }, { key: 'open_file_dialog', @@ -360,16 +371,28 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var LayerGroup = function LayerGroup(label, fg) { - _classCallCheck(this, LayerGroup); +var LayerGroup = function () { + function LayerGroup(label, fg) { + _classCallCheck(this, LayerGroup); + + this.label = label; + this.feature_group = fg; + this.show = true; + } - this.label = label; - this.feature_group = fg; - this.show = true; - console.log(this.feature_group); -}; + _createClass(LayerGroup, [{ + key: "num_features", + value: function num_features() { + return this.feature_group.getLayers().length; + } + }]); + + return LayerGroup; +}(); exports.default = LayerGroup; diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 9c98dddb2e..921d456465 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 3a956ced4d967b2773b4","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","console","log","MapSidebarCtrl","$scope","$window","$timeout","LGeo","element","hide","primary_color","secondary_color","local_file_selected","attribution","maxZoom","streets","satellite","map_title","L","control","layers","basemaps","map","zoomControl","setPosition","addLayer","layer_groups","feature_group","active_layer_group","drawControl","Control","Draw","position","draw","circle","edit","featureGroup","remove","object","e","layer","on","options","fillColor","fillOpacity","$apply","lg","push","show","active","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","current_layer","setStyle","prop","drawnItems","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","customOnChange","restrict","link","onChangeHandler","scope","$eval","attrs","bind","config","$stateProvider","templateUrl","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8D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d;AACD,OAFD;AAGA;AACA,UAAI0C,MAAOC,IAAIC,eAAJ,CAAoBC,IAApB,CAAX;;AAEA;AACAC,QAAEC,QAAF,GAAgB,aAAhB;AACAD,QAAEE,IAAF,GAAgBN,GAAhB;AACAI,QAAEG,WAAF;AACAH,QAAEI,KAAF;AACD;;;;;;;;;;;;;;;;;;;AC/JY,SAASC,cAAT,GAA0B;AACvC,SAAO;AACLC,UADK;AAELC,UAAM,QAAiC;AACrC,UAAIC,kBAAkBC,MAAMC,KAAN,CAAYC,MAAMN,EAAxC;AACArF,cAAQ4F,IAAR,CAAa,QAAb,EAAuBJ,eAAvB;AACD;AALI,GAAP;AAOD,C;;;;;;;;;;;;;;;ACNyB;AAAA;;AACtB;AACA,OAAKrE,aAAL;AACA,OAAKqB,IAAL,GAAY,IAAZ;AACA/C,UAAQC,GAAR,CAAY,KAAZ;AACD,C;;;;;;;;;;;;;;;ACPH;;AACA;;AACA;;AAEA,IAAIN,MAAMC,QAAQC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASuG,MAAT,CAAgBC,cAAhB,EAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BxG,YAH0B;AAI1ByG,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAED7G,CAAA;;kBAIeA,C","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 3a956ced4d967b2773b4","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","import LayerGroup from '../models/layer_group.js';\nconsole.log(LayerGroup)\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // this.drawnItems = new L.FeatureGroup();\n // this.map.addLayer(this.drawnItems);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n let drawControl = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: this.active_layer_group.feature_group,\n remove: true\n }\n });\n\n this.active_layer_group.feature_group.on('click', (e) => {\n // console.log(e, e.layer)\n });\n\n this.map.addControl(drawControl);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.on('click', e => {\n console.log(e)\n })\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n // this.current_layer = object;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n create_layer () {\n console.log(\"create_layer\");\n let lg = new LayerGroup(\"New Group\", new L.LayerGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n }\n\n show_hide_layer_group (lg) {\n console.log(lg);\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_file_dialog () {\n\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n console.log(exif)\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n console.log(this.feature_group)\n }\n\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap e0f56d729e2ce757772d","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","MapSidebarCtrl","$scope","$window","$timeout","LGeo","element","hide","primary_color","secondary_color","local_file_selected","attribution","maxZoom","streets","satellite","map_title","L","control","layers","basemaps","map","zoomControl","setPosition","addLayer","layer_groups","feature_group","active_layer_group","on","current_layer","$apply","object","e","layer","options","color","fillColor","fillOpacity","console","log","current_mouse_coordinates","latlng","dc","Control","Draw","position","draw","circle","edit","featureGroup","remove","drawControl","lg","push","select_active_layer_group","show","removeControl","add_draw_controls","active","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","prop","drawnItems","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","customOnChange","restrict","link","onChangeHandler","scope","$eval","attrs","bind","label","fg","config","$stateProvider","templateUrl","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAF,IAAIG,UAAJ,CAAe,gBAAf;;k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EyB;AACxB,WAAKjD,aAAL,CAAmB0D,QAAnB,CAA4B,EAACC,MAAM,IAAnC;AACD;;;wBAGe;AACdlD,cAAQC,GAAR,CAAY,KAAKkD,UAAjB;AACA,WAAKA,UAAL,CAAgBC,SAAhB,CAA0B,GAAa;AACrCpD,gBAAQC,GAAR,CAAYoD,EAAEzD,OAAd;AACD,OAFD;AAGA;AACA,UAAI0D,MAAOC,IAAIC,eAAJ,CAAoBC,IAApB,CAAX;;AAEA;AACAC,QAAEC,QAAF,GAAgB,aAAhB;AACAD,QAAEE,IAAF,GAAgBN,GAAhB;AACAI,QAAEG,WAAF;AACAH,QAAEI,KAAF;AACD;;;;;;;;;;;;;;;;;;;AC3KY,SAASC,cAAT,GAA0B;AACvC,SAAO;AACLC,UADK;AAELC,UAAM,QAAiC;AACrC,UAAIC,kBAAkBC,MAAMC,KAAN,CAAYC,MAAMN,EAAxC;AACA9F,cAAQqG,IAAR,CAAa,QAAb,EAAuBJ,eAAvB;AACD;AALI,GAAP;AAOD,C;;;;;;;;;;;;;;;;;;ACNC,sBAAaK,KAAb,EAAoBC,CAAI;AAAA;;AACtB;AACA,SAAKpF,aAAL;AACA,SAAK6B,IAAL,GAAY,IAAZ;AACD;;;;wBAEe;AACd,aAAO,KAAK7B,aAAL,CAAmB2C,IAA1B;AACD;;;;;;;;;;;;;;;;;;;ACVH;;AACA;;AACA;;AAEA,IAAIxE,MAAMC,QAAQC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASgH,MAAT,CAAgBC,cAAhB,EAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BjH,YAH0B;AAI1BkH,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAEDtH,CAAA;;kBAIeA,C","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e0f56d729e2ce757772d","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","import LayerGroup from '../models/layer_group.js';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // this.drawnItems = new L.FeatureGroup();\n // this.map.addLayer(this.drawnItems);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n // this.current_layer = object;\n this.$scope.$apply();\n console.log(this.active_layer_group)\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n debugger;\n }\n\n open_file_dialog () {\n\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n console.log(exif)\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index b83ebcaf5e..e80e90aa57 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -1,5 +1,4 @@ import LayerGroup from '../models/layer_group.js'; -console.log(LayerGroup) export default class MapSidebarCtrl { @@ -43,56 +42,69 @@ export default class MapSidebarCtrl { this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())]; this.map.addLayer(this.layer_groups[0].feature_group); this.active_layer_group = this.layer_groups[0]; - let drawControl = new L.Control.Draw({ - position: 'topright', - draw: { - circle: false, - }, - edit: { - featureGroup: this.active_layer_group.feature_group, - remove: true - } - }); + // update the current layer to show the details tab this.active_layer_group.feature_group.on('click', (e) => { - // console.log(e, e.layer) + this.current_layer ? this.current_layer = null : this.current_layer = e.layer; + this.$scope.$apply(); }); - this.map.addControl(drawControl); + this.add_draw_controls(this.active_layer_group.feature_group); this.map.on('draw:created', (e) => { let object = e.layer; - object.on('click', e => { - console.log(e) - }) object.options.color = this.secondary_color; object.options.fillColor = this.primary_color; object.options.fillOpacity = 0.8; this.active_layer_group.feature_group.addLayer(object); // this.current_layer = object; this.$scope.$apply(); + console.log(this.active_layer_group) + }); + + this.map.on('mousemove', (e) => { + this.current_mouse_coordinates = e.latlng; + this.$scope.$apply(); }); } // end constructor + add_draw_controls (fg) { + let dc = new L.Control.Draw({ + position: 'topright', + draw: { + circle: false, + }, + edit: { + featureGroup: fg, + remove: true + } + }); + this.map.addControl(dc); + this.drawControl = dc; + } + + create_layer () { - console.log("create_layer"); - let lg = new LayerGroup("New Group", new L.LayerGroup()); + let lg = new LayerGroup("New Group", new L.FeatureGroup()); this.layer_groups.push(lg); this.active_layer_group = this.layer_groups[this.layer_groups.length -1]; this.map.addLayer(lg.feature_group); + this.select_active_layer_group(this.active_layer_group); } show_hide_layer_group (lg) { - console.log(lg); lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group); } select_active_layer_group(lg) { + this.map.removeControl(this.drawControl); + this.add_draw_controls(lg.feature_group); this.active_layer_group = lg; lg.active = true; lg.show = true; + debugger; } open_file_dialog () { diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js index e2cfe4d09d..1ec03c1f1f 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js @@ -4,8 +4,10 @@ export default class LayerGroup { this.label = label; this.feature_group = fg; this.show = true; - console.log(this.feature_group) } + num_features () { + return this.feature_group.getLayers().length; + } } diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css index bb0986070f..f78c605e92 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -1,16 +1,16 @@ -#container { +#geo_container { display: flex; min-height: 100vh; + color: #fff; } -#geo_sidebar { +#geo_sidebar, #current_layer_details{ width: 20%; font-size: 0.85em; float: left; flex: 0 0 230px; background: #404040; - color: #fff; border-right: 1px solid #d3d3d3; flex-direction: column; display: flex; @@ -18,7 +18,21 @@ -#geo_sidebar .list-group-item.menu{ +#geo_sidebar .list-group-item { + +} + +#geo_sidebar .list-group-item > div { + float: left; +} + +#geo_sidebar .list-group-item input[type=text] { + color: #000; + background-color: #c4c4c4; + width: 70%; +} + +#geo_sidebar .list-group-item.menu, #current_layer_details .list-group-item.menu{ background-color: #404040; border-bottom: 1px solid #707070; border-left: 5px; @@ -26,8 +40,10 @@ border-top: 0px; margin-top: 1px; cursor: pointer; - padding-top: 3px; + padding: 3px; padding-bottom: 3px; + padding-right: 3px; + line-height: 1.25em; } #geo_sidebar .list-group-item.menu.active { @@ -36,11 +52,9 @@ } -#geo_sidebar .current-layer-details { - flex-grow: 1; - vertical-align: bottom; - display: flex; - /*flex-direction: column-reverse;*/ +#geo_sidebar .lg-count { + font-size: 0.9em; + color: #c9c9c9; } #right_panel { @@ -57,14 +71,31 @@ background-color: #d2d2d2; } -.current-layer-details table { - background: #f0f0f0; - color: #6b6a6a; - margin-bottom: 0px; -} #geo_map { width: 100%; flex: 1; background: grey; } + +#current_layer_details .list-group-item .left { + float: left; + width: 50%; +} +#current_layer_details .list-group-item .right { + float: right; + width: 50%; +} + +#current_layer_details .list-group-item input[type=color] { + /*height: inherit;*/ + padding: 0px; + line-height: 1.2em; + height:1.2em; +} + +#mouse_coordinates { + font-family: monospace; + font-size: 0.9em; + color: #505050 +} diff --git a/designsafe/apps/geo/views.py b/designsafe/apps/geo/views.py index e75bd44d90..5b7d16553f 100644 --- a/designsafe/apps/geo/views.py +++ b/designsafe/apps/geo/views.py @@ -3,7 +3,6 @@ from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_POST -from agavepy.agave import AgaveException from requests import HTTPError from django.contrib.auth import get_user_model @@ -17,5 +16,4 @@ def index(request): - logger.debug('search index') return render(request, 'designsafe/apps/geo/index.html') From 17df7b8bf500924cfdca0cc15c7cf87ccf154e2a Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Tue, 14 Mar 2017 17:39:22 -0500 Subject: [PATCH 047/520] geo stuff ctd --- .../static/designsafe/apps/geo/html/map.html | 61 ++++++++++--------- .../apps/geo/scripts/build/bundle.js | 14 ++++- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 12 +++- .../apps/geo/scripts/models/layer_group.js | 1 + 5 files changed, 59 insertions(+), 31 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 4b7a955716..87efaa605b 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -19,36 +19,41 @@ New Layer Group
  • - +
    + + + +
    + + + + diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index ae842db3e5..2e89d2fc24 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -261,11 +261,22 @@ var MapSidebarCtrl = function () { this.active_layer_group = lg; lg.active = true; lg.show = true; - debugger; } }, { key: 'open_file_dialog', value: function open_file_dialog() {} + }, { + key: 'zoom_to', + value: function zoom_to(feature) { + console.log(feature); + if (feature instanceof L.Marker) { + var latLngs = [feature.getLatLng()]; + var markerBounds = L.latLngBounds(latLngs); + this.map.fitBounds(markerBounds); + } else { + this.map.fitBounds(feature.getBounds()); + }; + } }, { key: 'local_file_selected', value: function local_file_selected(ev) { @@ -382,6 +393,7 @@ var LayerGroup = function () { this.label = label; this.feature_group = fg; this.show = true; + this.show_contents = true; } _createClass(LayerGroup, [{ diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 921d456465..51f2db1a18 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap e0f56d729e2ce757772d","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","MapSidebarCtrl","$scope","$window","$timeout","LGeo","element","hide","primary_color","secondary_color","local_file_selected","attribution","maxZoom","streets","satellite","map_title","L","control","layers","basemaps","map","zoomControl","setPosition","addLayer","layer_groups","feature_group","active_layer_group","on","current_layer","$apply","object","e","layer","options","color","fillColor","fillOpacity","console","log","current_mouse_coordinates","latlng","dc","Control","Draw","position","draw","circle","edit","featureGroup","remove","drawControl","lg","push","select_active_layer_group","show","removeControl","add_draw_controls","active","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","prop","drawnItems","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","customOnChange","restrict","link","onChangeHandler","scope","$eval","attrs","bind","label","fg","config","$stateProvider","templateUrl","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;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AAAA;AAE1BC,iBAAa,cAFa;AAG1BjH,YAH0B;AAI1BkH,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAEDtH,CAAA;;kBAIeA,C","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e0f56d729e2ce757772d","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","import LayerGroup from '../models/layer_group.js';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // this.drawnItems = new L.FeatureGroup();\n // this.map.addLayer(this.drawnItems);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n // this.current_layer = object;\n this.$scope.$apply();\n console.log(this.active_layer_group)\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n debugger;\n }\n\n open_file_dialog () {\n\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n console.log(exif)\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 2daf2ab67d3533f89a3f","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","MapSidebarCtrl","$scope","$window","$timeout","LGeo","element","hide","primary_color","secondary_color","local_file_selected","attribution","maxZoom","streets","satellite","map_title","L","control","layers","basemaps","map","zoomControl","setPosition","addLayer","layer_groups","feature_group","active_layer_group","on","current_layer","$apply","object","e","layer","options","color","fillColor","fillOpacity","console","log","current_mouse_coordinates","latlng","dc","Control","Draw","position","draw","circle","edit","featureGroup","remove","drawControl","lg","push","select_active_layer_group","show","removeControl","add_draw_controls","active","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","prop","drawnItems","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","customOnChange","restrict","link","onChangeHandler","scope","$eval","attrs","bind","label","fg","show_contents","config","$stateProvider","templateUrl","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAF,IAAIG,UAAJ,CAAe,gBAAf;;kBAEeH,G;;;;;;;;;;;;;ACNf;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,mBAAf,EAAoC,EAApC,CAAV;;AAEAF,IAAII,SAAJ,CAAc,gBAAd;;kBAEeJ,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeF,G;;;;;;;;;;;;;;;ACNf;;;;;;;;IAEqBK,c;AAEnB,0BAAaC,MAAb,EAAqBC,OAArB,EAA8BC,QAA9B,EAAwC;AACtC;;AADsC;;AAAA;;AAEtC;AACA,SAAKC,IAAL,GAAYF,QAAQE,CAApB;AACA,SAAKD,Q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AAR,CAAY0D,EAAE/D,OAAd;AACD,OAFD;AAGA;AACA,UAAIgE,MAAOC,IAAIC,eAAJ,CAAoBC,IAApB,CAAX;;AAEA;AACAC,QAAEC,QAAF,GAAgB,aAAhB;AACAD,QAAEE,IAAF,GAAgBN,GAAhB;AACAI,QAAEG,WAAF;AACAH,QAAEI,KAAF;AACD;;;;;;;;;;;;;;;;;;;ACrLY,SAASC,cAAT,GAA0B;AACvC,SAAO;AACLC,UADK;AAELC,UAAM,QAAiC;AACrC,UAAIC,kBAAkBC,MAAMC,KAAN,CAAYC,MAAMN,EAAxC;AACApG,cAAQ2G,IAAR,CAAa,QAAb,EAAuBJ,eAAvB;AACD;AALI,GAAP;AAOD,C;;;;;;;;;;;;;;;;;;ACNC,sBAAaK,KAAb,EAAoBC,CAAI;AAAA;;AACtB;AACA,SAAK1F,aAAL;AACA,SAAK6B,IAAL,GAAY,IAAZ;AACA,SAAK8D,YAAL;AACD;;;;wBAEe;AACd,aAAO,KAAK3F,aAAL,CAAmBiD,IAA1B;AACD;;;;;;;;;;;;;;;;;;;ACXH;;AACA;;AACA;;AAEA,IAAI9E,MAAMC,QAAQC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASuH,MAAT,CAAgBC,cAAhB,EAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BxH,YAH0B;AAI1ByH,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAED7H,CAAA;;kBAIeA,C","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 2daf2ab67d3533f89a3f","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","import LayerGroup from '../models/layer_group.js';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // this.drawnItems = new L.FeatureGroup();\n // this.map.addLayer(this.drawnItems);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n // this.current_layer = object;\n this.$scope.$apply();\n console.log(this.active_layer_group)\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_file_dialog () {\n\n }\n\n zoom_to(feature) {\n console.log(feature);\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n console.log(exif)\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index e80e90aa57..d21f3cbd6e 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -104,13 +104,23 @@ export default class MapSidebarCtrl { this.active_layer_group = lg; lg.active = true; lg.show = true; - debugger; } open_file_dialog () { } + zoom_to(feature) { + console.log(feature); + if (feature instanceof L.Marker) { + let latLngs = [ feature.getLatLng() ]; + let markerBounds = L.latLngBounds(latLngs); + this.map.fitBounds(markerBounds); + } else { + this.map.fitBounds(feature.getBounds()); + }; + } + local_file_selected (ev) { let file = ev.target.files[0]; let reader = new FileReader(); diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js index 1ec03c1f1f..7652a7a367 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js @@ -4,6 +4,7 @@ export default class LayerGroup { this.label = label; this.feature_group = fg; this.show = true; + this.show_contents = true; } num_features () { From 02b7aef4a94d3505ae0d57a83326f3897f6b658d Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Tue, 14 Mar 2017 17:47:44 -0500 Subject: [PATCH 048/520] geo stuff ctd --- .../apps/geo/static/designsafe/apps/geo/html/map.html | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 87efaa605b..f95f4cddb8 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -10,9 +10,7 @@ From 36948d5dc0232a24a95171cecf4b945e6061b1a3 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 15 Mar 2017 14:30:34 -0500 Subject: [PATCH 049/520] Creating API utils --- designsafe/apps/api/projects/views.py | 2 ++ designsafe/apps/api/utils.py | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 designsafe/apps/api/utils.py diff --git a/designsafe/apps/api/projects/views.py b/designsafe/apps/api/projects/views.py index 7da02189fe..f5926051cd 100644 --- a/designsafe/apps/api/projects/views.py +++ b/designsafe/apps/api/projects/views.py @@ -12,6 +12,7 @@ from designsafe.apps.api.agave.models.files import BaseFileResource from designsafe.apps.api.agave.models.util import AgaveJSONEncoder from designsafe.apps.accounts.models import DesignSafeProfile +from requests.exceptions import HTTPError import logging import json @@ -53,6 +54,7 @@ def get(self, request): :return: A list of Projects to which the current user has access :rtype: JsonResponse """ + #raise HTTPError('Custom Error') ag = request.user.agave_oauth.client projects = Project.list_projects(agave_client=ag) data = {'projects': projects} diff --git a/designsafe/apps/api/utils.py b/designsafe/apps/api/utils.py new file mode 100644 index 0000000000..1f1911913e --- /dev/null +++ b/designsafe/apps/api/utils.py @@ -0,0 +1,24 @@ +"""Utilities for APIs +""" +import logging +from django.conf import settings + +#pylint: disable=invalid-name +logger = logging.getLogger(__name__) +#pylint: enable=invalid-name + +def is_jwt(request): + """Checks if a request is authenticated with a JWT + + :param obj request: Django request object + + ..note:: This function only checks if the correct header + is present and if the value of said header is not empty. + Use :func:`~designsafe.apps.api.decorators.agave_jwt_login` to + decorate protected views. + """ + val = request.META.get(settings.AGAVE_JWT_HEADER) + if val: + return True + + return False From 5a714d97c3acf4e0558f30fc24dd53b4fcb5731e Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Wed, 15 Mar 2017 15:42:33 -0500 Subject: [PATCH 050/520] save/load --- .../static/designsafe/apps/geo/html/map.html | 40 ++++++++-- .../apps/geo/scripts/build/bundle.js | 73 +++++++++++++++---- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 59 ++++++++++++--- .../scripts/directives/custom-on-change.js | 10 ++- .../apps/geo/scripts/models/layer_group.js | 1 - .../static/designsafe/apps/geo/styles/geo.css | 30 ++++++-- .../templates/designsafe/apps/geo/index.html | 1 + 8 files changed, 172 insertions(+), 44 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index f95f4cddb8..7db6831544 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -1,5 +1,6 @@ +
    Lat: {{vm.current_mouse_coordinates.lat | number:3}} Lon: {{vm.current_mouse_coordinates.lng| number:3 }}
    diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index 2e89d2fc24..5122acfbc3 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -191,8 +191,10 @@ var MapSidebarCtrl = function () { L.control.layers(basemaps).addTo(this.map); this.map.zoomControl.setPosition('bottomleft'); - // this.drawnItems = new L.FeatureGroup(); - // this.map.addLayer(this.drawnItems); + // trick to fix the tiles that sometimes don't load for some reason... + $timeout(function () { + _this.map.invalidateSize(); + }, 10); this.layer_groups = [new _layer_group2.default('New Group', new L.FeatureGroup())]; this.map.addLayer(this.layer_groups[0].feature_group); @@ -248,6 +250,12 @@ var MapSidebarCtrl = function () { this.map.addLayer(lg.feature_group); this.select_active_layer_group(this.active_layer_group); } + }, { + key: 'delete_feature', + value: function delete_feature(f) { + this.map.removeLayer(f); + this.active_layer_group.feature_group.removeLayer(f); + } }, { key: 'show_hide_layer_group', value: function show_hide_layer_group(lg) { @@ -264,11 +272,15 @@ var MapSidebarCtrl = function () { } }, { key: 'open_file_dialog', - value: function open_file_dialog() {} + value: function open_file_dialog() { + console.log("open_file_dialog"); + this.$timeout(function () { + $('#file_picker').click(); + }, 0); + } }, { key: 'zoom_to', value: function zoom_to(feature) { - console.log(feature); if (feature instanceof L.Marker) { var latLngs = [feature.getLatLng()]; var markerBounds = L.latLngBounds(latLngs); @@ -287,11 +299,31 @@ var MapSidebarCtrl = function () { reader.readAsText(file); reader.onload = function (e) { var json = JSON.parse(e.target.result); - L.geoJSON(json).getLayers().forEach(function (l) { - ; - _this2.drawnItems.addLayer(l); + + // we add in a field into the json blob when saved. If it is such, + // handle potential multiple layers. + if (json.ds_map) { + // each feature in the collection represents a layer + json.features.forEach(function (f) { + var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); + L.geoJSON(f).getLayers().forEach(function (l) { + lg.feature_group.addLayer(l); + }); + _this2.layer_groups.push(lg); + }); + } else { + var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); + L.geoJSON(json).getLayers().forEach(function (l) { + console.log(l); + _this2.layer_groups[0].feature_group.addLayer(l); + }); + _this2.layer_groups.push(lg); + } + var bounds = []; + _this2.layer_groups.forEach(function (lg) { + bounds.push(lg.feature_group.getBounds()); }); - _this2.map.fitBounds(_this2.drawnItems.getBounds()); + _this2.map.fitBounds(bounds); }; } }, { @@ -330,11 +362,18 @@ var MapSidebarCtrl = function () { }, { key: 'save_project', value: function save_project() { - console.log(this.drawnItems); - this.drawnItems.eachLayer(function (l) { - console.log(l.options); + var out = { + "type": "FeatureCollection", + "features": [], + "ds_map": true + }; + this.layer_groups.forEach(function (lg) { + var json = lg.feature_group.toGeoJSON(); + //add in any options + + out.features.push(json); }); - var blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], { type: "application/json" }); + var blob = new Blob([JSON.stringify(out)], { type: "application/json" }); var url = URL.createObjectURL(blob); var a = document.createElement('a'); @@ -364,9 +403,15 @@ exports.default = customOnChange; function customOnChange() { return { restrict: 'A', + scope: { + handler: '&' + }, link: function link(scope, element, attrs) { - var onChangeHandler = scope.$eval(attrs.customOnChange); - element.bind('change', onChangeHandler); + element.on('change', function (ev) { + scope.$apply(function () { + scope.handler({ ev: ev }); + }); + }); } }; } diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 51f2db1a18..fa9896ba47 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 2daf2ab67d3533f89a3f","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","MapSidebarCtrl","$scope","$window","$timeout","LGeo","element","hide","primary_color","secondary_color","local_file_selected","attribution","maxZoom","streets","satellite","map_title","L","control","layers","basemaps","map","zoomControl","setPosition","addLayer","layer_groups","feature_group","active_layer_group","on","current_layer","$apply","object","e","layer","options","color","fillColor","fillOpacity","console","log","current_mouse_coordinates","latlng","dc","Control","Draw","position","draw","circle","edit","featureGroup","remove","drawControl","lg","push","select_active_layer_group","show","removeControl","add_draw_controls","active","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","geoJSON","getLayers","forEach","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","prop","drawnItems","eachLayer","l","url","URL","createObjectURL","blob","a","download","href","textContent","click","customOnChange","restrict","link","onChangeHandler","scope","$eval","attrs","bind","label","fg","show_contents","config","$stateProvider","templateUrl","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAF,IAAIG,UAAJ,CAAe,gBAAf;;kBAEeH,G;;;;;;;;;;;;;ACNf;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,mBAAf,EAAoC,EAApC,CAAV;;AAEAF,IAAII,SAAJ,CAAc,gBAAd;;kBAEeJ,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeF,G;;;;;;;;;;;;;;;ACNf;;;;;;;;IAEqBK,c;AAEnB,0BAAaC,MAAb,EAAqBC,OAArB,EAA8B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AQC,GAAR,CAAY,KAAKwD,UAAjB;AACA,WAAKA,UAAL,CAAgBC,SAAhB,CAA0B,GAAa;AACrC1D,gBAAQC,GAAR,CAAY0D,EAAE/D,OAAd;AACD,OAFD;AAGA;AACA,UAAIgE,MAAOC,IAAIC,eAAJ,CAAoBC,IAApB,CAAX;;AAEA;AACAC,QAAEC,QAAF,GAAgB,aAAhB;AACAD,QAAEE,IAAF,GAAgBN,GAAhB;AACAI,QAAEG,WAAF;AACAH,QAAEI,KAAF;AACD;;;;;;;;;;;;;;;;;;;ACrLY,SAASC,cAAT,GAA0B;AACvC,SAAO;AACLC,UADK;AAELC,UAAM,QAAiC;AACrC,UAAIC,kBAAkBC,MAAMC,KAAN,CAAYC,MAAMN,EAAxC;AACApG,cAAQ2G,IAAR,CAAa,QAAb,EAAuBJ,eAAvB;AACD;AALI,GAAP;AAOD,C;;;;;;;;;;;;;;;;;;ACNC,sBAAaK,KAAb,EAAoBC,CAAI;AAAA;;AACtB;AACA,SAAK1F,aAAL;AACA,SAAK6B,IAAL,GAAY,IAAZ;AACA,SAAK8D,YAAL;AACD;;;;wBAEe;AACd,aAAO,KAAK3F,aAAL,CAAmBiD,IAA1B;AACD;;;;;;;;;;;;;;;;;;;ACXH;;AACA;;AACA;;AAEA,IAAI9E,MAAMC,QAAQC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAASuH,MAAT,CAAgBC,cAAhB,EAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1BxH,YAH0B;AAI1ByH,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAED7H,CAAA;;kBAIeA,C","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 2daf2ab67d3533f89a3f","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","import LayerGroup from '../models/layer_group.js';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // this.drawnItems = new L.FeatureGroup();\n // this.map.addLayer(this.drawnItems);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n // this.current_layer = object;\n this.$scope.$apply();\n console.log(this.active_layer_group)\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_file_dialog () {\n\n }\n\n zoom_to(feature) {\n console.log(feature);\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n L.geoJSON(json).getLayers().forEach( (l) => {;\n this.drawnItems.addLayer(l);\n });\n this.map.fitBounds(this.drawnItems.getBounds());\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n console.log(exif)\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n console.log(this.drawnItems);\n this.drawnItems.eachLayer(function (l) {\n console.log(l.options);\n });\n let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n link: function (scope, element, attrs) {\n var onChangeHandler = scope.$eval(attrs.customOnChange);\n element.bind('change', onChangeHandler);\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 87a216baa67a70de9aa3","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","MapSidebarCtrl","$scope","$window","$timeout","LGeo","element","hide","primary_color","secondary_color","local_file_selected","attribution","maxZoom","streets","satellite","map_title","L","control","layers","basemaps","map","zoomControl","setPosition","invalidateSize","addLayer","layer_groups","feature_group","active_layer_group","on","current_layer","$apply","object","e","layer","options","color","fillColor","fillOpacity","console","log","current_mouse_coordinates","latlng","dc","Control","Draw","position","draw","circle","edit","featureGroup","remove","drawControl","lg","push","select_active_layer_group","removeLayer","f","show","removeControl","add_draw_controls","active","$","click","feature","Marker","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","reader","FileReader","readAsText","file","onload","json","JSON","parse","target","ds_map","features","forEach","geoJSON","getLayers","l","bounds","getBounds","files","ev","i","length","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","Map","AddMarker","setStyle","prop","out","toGeoJSON","url","URL","createObjectURL","blob","a","download","href","textContent","customOnChange","restrict","scope","handler","link","label","fg","show_contents","config","$stateProvider","templateUrl","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAF,IAAIG,UAAJ,CAAe,gBAAf;;kBAEeH,G;;;;;;;;;;;;;ACNf;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,mBAAf,EAAoC,EAApC,CAAV;;AAEAF,IAAII,SAAJ,CAAc,gBAAd;;kBAEeJ,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeF,G;;;;;;;;;;;;;;;ACNf;;;;;;;;IAEqBK,c;AAEnB,0BAAaC,MAAb,EAAqBC,OAArB,EAA8BC,QAA9B,EAAwC;AACtC;;AADsC;;AAAA;;AAEtC;AACA,SAAKC,IAAL,GAAYF,QAAQE,CAApB;AACA,SAAKD,QAAL,GAAgBA,QAAhB;AACAP,YAAQS,OAAR,CAAgB,QAAhB;AACAT,YAAQS,OAAR,CAAgB,KAAhB,EAAuBC,IAAvB;AACAV,YAAQS,OAAR,CAAgB,QAAhB,E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,GAAP;AAaD,C;;;;;;;;;;;;;;;;;;ACZC,sBAAagC,KAAb,EAAoBC,CAAI;AAAA;;AACtB;AACA,SAAK/F,aAAL;AACA,SAAK+B,IAAL,GAAY,IAAZ;AACA,SAAKiE,YAAL;AACD;;;;wBAEe;AACd,aAAO,KAAKhG,aAAL,CAAmByD,IAA1B;AACD;;;;;;;;;;;;;;;;;;;ACXH;;AACA;;AACA;;AAEA,IAAIvF,MAAMC,QAAQC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEA,SAAS6H,MAAT,CAAgBC,cAAhB,EAAgC;AAC9B;;AACAA,aAA4B;AAAA;AAE1BC,iBAAa,cAFa;AAG1B9H,YAH0B;AAI1B+H,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;AAWD;;AAEDnI,CAAA;;kBAIeA,C","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 87a216baa67a70de9aa3","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","import LayerGroup from '../models/layer_group.js';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([51.505, -0.09], 6);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n // this.current_layer = object;\n this.$scope.$apply();\n console.log(this.active_layer_group)\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_file_dialog () {\n console.log(\"open_file_dialog\");\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let json = JSON.parse(e.target.result);\n\n // we add in a field into the json blob when saved. If it is such,\n // handle potential multiple layers.\n if (json.ds_map) {\n // each feature in the collection represents a layer\n json.features.forEach( (f) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(f).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n });\n }\n else {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json).getLayers().forEach( (l) => {\n console.log(l);\n this.layer_groups[0].feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n }\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n console.log(exif)\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n Map.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = \"backup.json\";\n a.href = url;\n a.textContent = \"Download backup.json\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index d21f3cbd6e..1af1e086ab 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -36,8 +36,8 @@ export default class MapSidebarCtrl { L.control.layers(basemaps).addTo(this.map); this.map.zoomControl.setPosition('bottomleft'); - // this.drawnItems = new L.FeatureGroup(); - // this.map.addLayer(this.drawnItems); + // trick to fix the tiles that sometimes don't load for some reason... + $timeout( () => {this.map.invalidateSize();}, 10); this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())]; this.map.addLayer(this.layer_groups[0].feature_group); @@ -94,6 +94,11 @@ export default class MapSidebarCtrl { this.select_active_layer_group(this.active_layer_group); } + delete_feature (f) { + this.map.removeLayer(f); + this.active_layer_group.feature_group.removeLayer(f); + } + show_hide_layer_group (lg) { lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group); } @@ -107,11 +112,13 @@ export default class MapSidebarCtrl { } open_file_dialog () { - + console.log("open_file_dialog"); + this.$timeout(() => { + $('#file_picker').click(); + }, 0); } zoom_to(feature) { - console.log(feature); if (feature instanceof L.Marker) { let latLngs = [ feature.getLatLng() ]; let markerBounds = L.latLngBounds(latLngs); @@ -121,16 +128,39 @@ export default class MapSidebarCtrl { }; } + local_file_selected (ev) { let file = ev.target.files[0]; let reader = new FileReader(); reader.readAsText(file); reader.onload = (e) => { let json = JSON.parse(e.target.result); - L.geoJSON(json).getLayers().forEach( (l) => {; - this.drawnItems.addLayer(l); + + // we add in a field into the json blob when saved. If it is such, + // handle potential multiple layers. + if (json.ds_map) { + // each feature in the collection represents a layer + json.features.forEach( (f) => { + let lg = new LayerGroup("New Group", new L.FeatureGroup()); + L.geoJSON(f).getLayers().forEach( (l) => { + lg.feature_group.addLayer(l); + }); + this.layer_groups.push(lg); + }); + } + else { + let lg = new LayerGroup("New Group", new L.FeatureGroup()); + L.geoJSON(json).getLayers().forEach( (l) => { + console.log(l); + this.layer_groups[0].feature_group.addLayer(l); + }); + this.layer_groups.push(lg); + } + let bounds = []; + this.layer_groups.forEach((lg) => { + bounds.push(lg.feature_group.getBounds()); }); - this.map.fitBounds(this.drawnItems.getBounds()); + this.map.fitBounds(bounds); }; } @@ -167,11 +197,18 @@ export default class MapSidebarCtrl { save_project () { - console.log(this.drawnItems); - this.drawnItems.eachLayer(function (l) { - console.log(l.options); + let out = { + "type": "FeatureCollection", + "features": [], + "ds_map": true + }; + this.layer_groups.forEach( (lg) => { + let json = lg.feature_group.toGeoJSON(); + //add in any options + + out.features.push(json); }); - let blob = new Blob([JSON.stringify(this.drawnItems.toGeoJSON())], {type: "application/json"}); + let blob = new Blob([JSON.stringify(out)], {type: "application/json"}); let url = URL.createObjectURL(blob); let a = document.createElement('a'); diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js index 2360d6f53f..16df7b3ef7 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js @@ -1,9 +1,15 @@ export default function customOnChange() { return { restrict: 'A', + scope: { + handler: '&' + }, link: function (scope, element, attrs) { - var onChangeHandler = scope.$eval(attrs.customOnChange); - element.bind('change', onChangeHandler); + element.on('change', function (ev) { + scope.$apply(function(){ + scope.handler({ev:ev}); + }); + }); } }; } diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js index 7652a7a367..2e532aba68 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js @@ -10,5 +10,4 @@ export default class LayerGroup { num_features () { return this.feature_group.getLayers().length; } - } diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css index f78c605e92..8109b35840 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -3,20 +3,25 @@ display: flex; min-height: 100vh; color: #fff; + font-family: 'Open Sans', sans-serif; } #geo_sidebar, #current_layer_details{ width: 20%; - font-size: 0.85em; + font-size: 11px; + letter-spacing: 0px; float: left; flex: 0 0 230px; background: #404040; - border-right: 1px solid #d3d3d3; + border-right: 1px solid #6e6e6e; flex-direction: column; display: flex; } - +.strong { + font-family: 'Open Sans Bold',sans-serif; + font-weight: 400; +} #geo_sidebar .list-group-item { @@ -54,7 +59,11 @@ #geo_sidebar .lg-count { font-size: 0.9em; - color: #c9c9c9; + color: #fff; + margin-left: 5px; + padding: 3px; + border-radius: 3px; + background-color: #524e90; } #right_panel { @@ -95,7 +104,14 @@ } #mouse_coordinates { - font-family: monospace; - font-size: 0.9em; - color: #505050 + font-family: monospace; + font-size: 0.9em; + color: #505050; + margin-top: 0px; + background-color: #f2f5dc; + padding: 5px; +} + +.dropdown-menu { + background-color: #646464; } diff --git a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html index abcbb4bddd..a3dd587eb0 100644 --- a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html +++ b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html @@ -3,6 +3,7 @@ {% load static %} {% block head_extra %} + {% endblock %} From f6c37ba49da5055ddc84022d4da2f6121c4c6bef Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Wed, 15 Mar 2017 17:30:27 -0500 Subject: [PATCH 051/520] css mainly --- .../static/designsafe/apps/geo/html/map.html | 30 +++++++++++++------ .../apps/geo/scripts/build/bundle.js | 30 ++++++++++++++++--- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 19 +++++++++++- .../designsafe/apps/geo/scripts/index.js | 5 +++- .../static/designsafe/apps/geo/styles/geo.css | 18 ++++++++++- .../templates/designsafe/apps/geo/index.html | 2 +- 7 files changed, 88 insertions(+), 18 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 7db6831544..cf7f3077d5 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -9,12 +9,18 @@ - - @@ -38,20 +44,26 @@ {{lg.num_features()}} features -
    -
    - +
    - + -
    +
    diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index 4bb997cdcb..0c97f02b74 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -143,13 +143,13 @@ Object.defineProperty(exports, "__esModule", { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var DBModal = function DBModal($scope) { - _classCallCheck(this, DBModal); +var DBModalCtrl = function DBModalCtrl($scope) { + _classCallCheck(this, DBModalCtrl); this.$scope = $scope; }; -exports.default = DBModal; +exports.default = DBModalCtrl; /***/ }), /* 4 */ @@ -311,6 +311,15 @@ var MapSidebarCtrl = function () { lg.active = true; lg.show = true; } + }, { + key: 'open_db_modal', + value: function open_db_modal() { + this.$uibModal.open({ + templateUrl: "/static/designsafe/apps/geo/html/db-modal.html", + controller: _dbModal2.default, + controllerAs: 'vm' + }); + } }, { key: 'open_file_dialog', value: function open_file_dialog() { diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index cb282092ac..9ef0c15b50 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 1a960a7e73e9856fc60d","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js"],"names":["mod","angular","module","controller","directive","DBModal","$scope","GeoUtils","MapSidebarCtrl","$window","$timeout","$uibModal","LGeo","element","hide","primary_color","secondary_color","local_file_selected","attribution","maxZoom","streets","satellite","map_title","L","control","layers","basemaps","map","zoomControl","setPosition","invalidateSize","addLayer","layer_groups","feature_group","active_layer_group","on","current_layer","$apply","object","e","layer","options","color","fillColor","fillOpacity","current_mouse_coordinates","latlng","dc","Control","Draw","position","draw","circle","edit","featureGroup","remove","drawControl","lg","push","select_active_layer_group","removeLayer","splice","i","f","show","removeControl","add_draw_controls","active","$","click","Marker","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","src_lg","data","pidx","getLayers","console","log","ev","ext","reader","readAsText","file","onload","l","omnivore","kml","parse","target","result","d","gpx","json","ds_map","features","forEach","geoJSON","bounds","getBounds","files","length","FileReader","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","AddMarker","setStyle","prop","out","toGeoJSON","label","url","URL","createObjectURL","blob","a","download","href","textContent","customOnChange","restrict","scope","handler","link","fg","show_contents","config","$stateProvider","$uibTooltipProvider","templateUrl","resolve","auth","get_file_extension","fname","split","pop","MapProject","name"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAF,IAAIG,UAAJ,CAAe,gBAAf;;kBAEeH,G;;;;;;;;;;;;;ACNf;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,mBAAf,EAAoC,EAApC,CAAV;;AAEAF,IAAII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AAA;AAE1BE,iBAAa,cAFa;AAG1B1I,YAH0B;AAI1B2I,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;;AAWA;AACA;AAED;;AAED/I,CAAA;;kBAIeA,C;;;;;;;;;;;;QC7BCgJ,K;AAAT,GAAoC;AACzC,SAAOC,MAAMC,KAAN,CAAY,GAAZ,EAAiBC,GAAjB,EAAP;AACD,C;;;;;;;;;;;;;;;;ICDoBC,U,GAEnB,oBAAaC,IAAb,EAAmB;AAAA;;AACjB,OAAKA,IAAL,GAAYA,IAAZ;AACA;AACD,C","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 1a960a7e73e9856fc60d","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","export default class DBModal {\n\n constructor ($scope) {\n this.$scope = $scope;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModal from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n console.log(GeoUtils);\n\n let ext = GeoUtils.get_file_extension(file.name);\n console.log(ext);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n if (ext === 'kml') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.kml.parse(e.target.result);\n // debugger\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else if (ext === 'gpx') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.gpx.parse(e.target.result);\n lg.feature_group.addLayer(l);\n\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else {\n let json = JSON.parse(e.target.result);\n\n // we add in a field into the json blob when saved. If it is such,\n // handle potential multiple layers.\n if (json.ds_map) {\n // each feature in the collection represents a layer\n json.features.forEach( (f) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(f).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n else {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json).getLayers().forEach( (l) => {\n this.layer_groups[0].feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n }\n\n };\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n this.active_layer_group.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 48e24b8f9adc80c6be93","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js"],"names":["mod","angular","module","controller","directive","DBModalCtrl","$scope","GeoUtils","MapSidebarCtrl","$window","$timeout","$uibModal","LGeo","element","hide","primary_color","secondary_color","local_file_selected","attribution","maxZoom","streets","satellite","map_title","L","control","layers","basemaps","map","zoomControl","setPosition","invalidateSize","addLayer","layer_groups","feature_group","active_layer_group","on","current_layer","$apply","object","e","layer","options","color","fillColor","fillOpacity","current_mouse_coordinates","latlng","dc","Control","Draw","position","draw","circle","edit","featureGroup","remove","drawControl","lg","push","select_active_layer_group","removeLayer","splice","i","f","show","removeControl","add_draw_controls","active","open","templateUrl","controllerAs","$","click","Marker","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","src_lg","data","pidx","getLayers","console","log","ev","ext","reader","readAsText","file","onload","l","omnivore","kml","parse","target","result","d","gpx","json","ds_map","features","forEach","geoJSON","bounds","getBounds","files","length","FileReader","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","AddMarker","setStyle","prop","out","toGeoJSON","label","url","URL","createObjectURL","blob","a","download","href","textContent","customOnChange","restrict","scope","handler","link","fg","show_contents","config","$stateProvider","$uibTooltipProvider","resolve","auth","get_file_extension","fname","split","pop","MapProject","name"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAF,IAAIG,UAAJ,CAAe,gBAAf;;kBAEeH,G;;;;;;;;;;;;;ACNf;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,mBAAf,EAAoC,EAApC,CAAV;;AAEAF,IAAII,SAAJ,CAAc,gBAAd;;kBAEeJ,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,iBAAf,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D;;AACAD,aAA4B;AAAA;AAE1BzE,iBAAa,cAFa;AAG1BlE,YAH0B;AAI1B6I,aAAS;AACPC,YAAM,gBAAY;AAChB;AACD;AAHM;AAJiB,GAA5B;;AAWA;AACA;AAED;;AAEDjJ,CAAA;;kBAIeA,C;;;;;;;;;;;;QC7BCkJ,K;AAAT,GAAoC;AACzC,SAAOC,MAAMC,KAAN,CAAY,GAAZ,EAAiBC,GAAjB,EAAP;AACD,C;;;;;;;;;;;;;;;;ICDoBC,U,GAEnB,oBAAaC,IAAb,EAAmB;AAAA;;AACjB,OAAKA,IAAL,GAAYA,IAAZ;AACA;AACD,C","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 48e24b8f9adc80c6be93","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","export default class DBModalCtrl {\n\n constructor ($scope) {\n this.$scope = $scope;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: DBModalCtrl,\n controllerAs: 'vm'\n });\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n console.log(GeoUtils);\n\n let ext = GeoUtils.get_file_extension(file.name);\n console.log(ext);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n if (ext === 'kml') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.kml.parse(e.target.result);\n // debugger\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else if (ext === 'gpx') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.gpx.parse(e.target.result);\n lg.feature_group.addLayer(l);\n\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else {\n let json = JSON.parse(e.target.result);\n\n // we add in a field into the json blob when saved. If it is such,\n // handle potential multiple layers.\n if (json.ds_map) {\n // each feature in the collection represents a layer\n json.features.forEach( (f) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(f).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n else {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json).getLayers().forEach( (l) => {\n this.layer_groups[0].feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n }\n\n };\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n this.active_layer_group.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js index 0a5383f743..b2916761be 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js @@ -1,4 +1,4 @@ -export default class DBModal { +export default class DBModalCtrl { constructor ($scope) { this.$scope = $scope; diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index b1e8e41c36..f337161335 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -1,6 +1,6 @@ import LayerGroup from '../models/layer_group'; import MapProject from '../models/map-project'; -import DBModal from './db-modal'; +import DBModalCtrl from './db-modal'; import * as GeoUtils from '../utils/geo-utils'; export default class MapSidebarCtrl { @@ -119,6 +119,14 @@ export default class MapSidebarCtrl { lg.show = true; } + open_db_modal () { + this.$uibModal.open({ + templateUrl: "/static/designsafe/apps/geo/html/db-modal.html", + controller: DBModalCtrl, + controllerAs: 'vm' + }); + } + open_file_dialog () { this.$timeout(() => { $('#file_picker').click(); diff --git a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html index 9ac55491f1..784b52a6ee 100644 --- a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html +++ b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html @@ -25,7 +25,7 @@ - + From 61db07500003f945d867fe64651ec1cf870f0f96 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Sun, 19 Mar 2017 10:45:11 -0500 Subject: [PATCH 063/520] navbar --- .../designsafe/apps/geo/html/db-modal.html | 11 +- .../static/designsafe/apps/geo/html/map.html | 5 + .../apps/geo/scripts/build/bundle.js | 112 +++++++++++------- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../apps/geo/scripts/controllers/db-modal.js | 12 +- .../static/designsafe/apps/geo/styles/geo.css | 19 +++ 6 files changed, 110 insertions(+), 51 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/db-modal.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/db-modal.html index a34b5788ae..8ad76c46c5 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/db-modal.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/db-modal.html @@ -2,10 +2,15 @@
    diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 1ee3fec9a3..91d13ea887 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -1,4 +1,9 @@
    +
      diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index 0c97f02b74..69bc8ad5e5 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -63,7 +63,7 @@ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 8); +/******/ return __webpack_require__(__webpack_require__.s = 9); /******/ }) /************************************************************************/ /******/ ([ @@ -141,13 +141,35 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var DBModalCtrl = function DBModalCtrl($scope) { - _classCallCheck(this, DBModalCtrl); +var DBModalCtrl = function () { + DBModalCtrl.$inject = ["$scope", "$uibModalInstance"]; + function DBModalCtrl($scope, $uibModalInstance) { + 'ngInject'; + + _classCallCheck(this, DBModalCtrl); - this.$scope = $scope; -}; + this.$scope = $scope; + this.$uibModalInstance = $uibModalInstance; + } + + _createClass(DBModalCtrl, [{ + key: 'ok', + value: function ok() { + this.$uibModalInstance.close(); + } + }, { + key: 'cancel', + value: function cancel() { + this.$uibModalInstance.dismiss('cancel'); + } + }]); + + return DBModalCtrl; +}(); exports.default = DBModalCtrl; @@ -168,7 +190,7 @@ var _layer_group = __webpack_require__(6); var _layer_group2 = _interopRequireDefault(_layer_group); -var _mapProject = __webpack_require__(11); +var _mapProject = __webpack_require__(7); var _mapProject2 = _interopRequireDefault(_mapProject); @@ -176,7 +198,7 @@ var _dbModal = __webpack_require__(3); var _dbModal2 = _interopRequireDefault(_dbModal); -var _geoUtils = __webpack_require__(9); +var _geoUtils = __webpack_require__(8); var GeoUtils = _interopRequireWildcard(_geoUtils); @@ -560,13 +582,49 @@ var LayerGroup = function () { exports.default = LayerGroup; /***/ }), -/* 7 */, +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var MapProject = function MapProject(name) { + _classCallCheck(this, MapProject); + + this.name = name; + this.layer_groups = []; +}; + +exports.default = MapProject; + +/***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.get_file_extension = get_file_extension; +function get_file_extension(fname) { + return fname.split('.').pop(); +} + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + config.$inject = ["$stateProvider", "$uibTooltipProvider"]; Object.defineProperty(exports, "__esModule", { value: true @@ -603,44 +661,6 @@ mod.config(config); exports.default = mod; -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.get_file_extension = get_file_extension; -function get_file_extension(fname) { - return fname.split('.').pop(); -} - -/***/ }), -/* 10 */, -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var MapProject = function MapProject(name) { - _classCallCheck(this, MapProject); - - this.name = name; - this.layer_groups = []; -}; - -exports.default = MapProject; - /***/ }) /******/ ]); //# sourceMappingURL=bundle.js.map \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 9ef0c15b50..1941863b60 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 48e24b8f9adc80c6be93","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js"],"names":["mod","angular","module","controller","directive","DBModalCtrl","$scope","GeoUtils","MapSidebarCtrl","$window","$timeout","$uibModal","LGeo","element","hide","primary_color","secondary_color","local_file_selected","attribution","maxZoom","streets","satellite","map_title","L","control","layers","basemaps","map","zoomControl","setPosition","invalidateSize","addLayer","layer_groups","feature_group","active_layer_group","on","current_layer","$apply","object","e","layer","options","color","fillColor","fillOpacity","current_mouse_coordinates","latlng","dc","Control","Draw","position","draw","circle","edit","featureGroup","remove","drawControl","lg","push","select_active_layer_group","removeLayer","splice","i","f","show","removeControl","add_draw_controls","active","open","templateUrl","controllerAs","$","click","Marker","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","src_lg","data","pidx","getLayers","console","log","ev","ext","reader","readAsText","file","onload","l","omnivore","kml","parse","target","result","d","gpx","json","ds_map","features","forEach","geoJSON","bounds","getBounds","files","length","FileReader","onloadend","exif","EXIF","lon","GPSLongitude","latRef","GPSLatitudeRef","lonRef","GPSLongitudeRef","lat","AddMarker","setStyle","prop","out","toGeoJSON","label","url","URL","createObjectURL","blob","a","download","href","textContent","customOnChange","restrict","scope","handler","link","fg","show_contents","config","$stateProvider","$uibTooltipProvider","resolve","auth","get_file_extension","fname","split","pop","MapProject","name"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAF,IAAIG,UAAJ,CAAe,gBAAf;;kBAEeH,G;;;;;;;;;;;;;ACNf;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,mBAAf,EAAoC,EAApC,CAAV;;AAEAF,IAAII,SAAJ,CAAc,gBAAd;;kBAEeJ,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeF,G;;;;;;;;;;;;;;;ICNMK,W,GAEnB,qBAAaC,MAAb,EAAqB;AAAA;;AACnB,OAAKA,MAAL,GAAcA,MAAd;AACD,C;;kBAJkBD,W;;;;;;;;;;;;;;;ACArB;;;;AACA;;;;AACA;;;;AACA;;IAAYE,Q;;;;;;;;IAESC,c;AAEnB,0BAAaF,MAAb,EAAqBG,OA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AjB,EAAP;AACD,C;;;;;;;;;;;;;;;;ICDoBC,U,GAEnB,oBAAaC,IAAb,EAAmB;AAAA;;AACjB,OAAKA,IAAL,GAAYA,IAAZ;AACA;AACD,C","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 48e24b8f9adc80c6be93","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","export default class DBModalCtrl {\n\n constructor ($scope) {\n this.$scope = $scope;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: DBModalCtrl,\n controllerAs: 'vm'\n });\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n console.log(GeoUtils);\n\n let ext = GeoUtils.get_file_extension(file.name);\n console.log(ext);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n if (ext === 'kml') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.kml.parse(e.target.result);\n // debugger\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else if (ext === 'gpx') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.gpx.parse(e.target.result);\n lg.feature_group.addLayer(l);\n\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else {\n let json = JSON.parse(e.target.result);\n\n // we add in a field into the json blob when saved. If it is such,\n // handle potential multiple layers.\n if (json.ds_map) {\n // each feature in the collection represents a layer\n json.features.forEach( (f) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(f).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n else {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json).getLayers().forEach( (l) => {\n this.layer_groups[0].feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n }\n\n };\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n this.active_layer_group.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 070130558a2b5ebbad7f","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","DBModalCtrl","$scope","$uibModalInstance","dismiss","$timeout","$window","$uibModal","element","hide","primary_color","secondary_color","streets","L","tileLayer","maxZoom","satellite","control","layers","basemaps","addTo","map","zoomControl","setPosition","invalidateSize","layer_groups","active_layer_group","current_layer","$apply","on","e","object","options","color","fillColor","fillOpacity","feature_group","addLayer","dc","Control","position","draw","circle","edit","featureGroup","remove","lg","push","length","select_active_layer_group","removeLayer","splice","i","show","removeControl","drawControl","add_draw_controls","active","open","templateUrl","controllerAs","$","click","f","Marker","Polygon","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","getBounds","src_lg","getLayers","console","log","file","ev","target","ext","GeoUtils","get_file_extension","reader","FileReader","readAsText","onload","l","omnivore","kml","parse","result","forEach","d","gpx","json","JSON","ds_map","features","geoJSON","bounds","files","readAsArrayBuffer","exif","EXIF","readFromBinaryFile","lat","GPSLatitude","lonRef","GPSLongitudeRef","lon","setStyle","out","map_title","label","blob","Blob","a","document","createElement","href","url","textContent","restrict","scope","handler","link","LayerGroup","show_contents","MapProject","name","fname","split","pop","requires","config","$stateProvider","$uibTooltipProvider","state","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAF,IAAIG,UAAJ,CAAe,gBAAf;;kBAEeH,G;;;;;;;;;;;;;ACNf;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,mBAAf,EAAoC,EAApC,CAAV;;AAEAF,IAAII,SAAJ,CAAc,gBAAd;;kBAEeJ,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeF,G;;;;;;;;;;;;;;;;;ICNMK,W;AAEnB,uBAAaC,MAAb,EAAqBC,iBAArB,EAAwC;AACtC;;AADsC;;AAEtC;AACA,SAAKA,gBAAL;AACD;;;;cAEK;A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KLC,UAAM,QAAiC;AACrCtH,MAAmC;AACjCoH,cAAMhG,MAAN,CAAa,YAAU;AACrBgG,gBAAMC,OAAN,CAAc,EAAC/C,IAAGA,EAAJ,EAAd;AACD,SAFD;AAGD,OAJD;AAKD;AAXI,GAAP;AAaD,C;;;;;;;;;;;;;;;;;ICdoBiD,U;AAEK;AAAA;;AACtB,SAAKb,KAAL,GAAaA,KAAb;AACA;AACA,SAAK7D,IAAL,GAAY,IAAZ;AACA,SAAK2E,aAAL,GAAqB,GAArB;AACD;;;;6BAEe;AACd,aAAO,KAAK5F,MAAZ;AACD;;;;;;;;;;;;;;;;;;;;;ICVkB6F,U,GAEnB,oBAAaC,IAAb,EAAmB;AAAA;;AACjB,OAAKA,IAAL,GAAYA,IAAZ;AACA;AACD,C;;;;;;;;;;;;;;QCNahD,K;AAAT,GAAoC;AACzC,SAAOiD,MAAMC,KAAN,CAAY,GAAZ,EAAiBC,GAAjB,EAAP;AACD,C;;;;;;;;;;;;;ACFD;;AACA;;AACA;;AAEA;AACAzI,IAAI0I,QAAJ,CAAavF,IAAb,CAAkB,WAAlB,EAA+B,QAA/B;;AAEA,SAASwF,MAAT,CAAgBC,cAAhB,EAAgCC,OAAqB;AACnD;;AACAD,iBAAeE,KAAf,CAAqB,KAArB,EAA4B;AAC1BjB,SAAK,EADqB;AAAA;AAG1B1H,gBAAY,eAHc;AAI1B4I,YAAS;AACPC,YAAM,gBAAY;AAChB,eAAO,IAAP;AACD;AAHM;AAJiB,GAA5B;;AAWA;AACAH,KAAA;AAED;;AAED7I,IAAI2I,MAAJ,CAAWA,MAAX","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 9);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 070130558a2b5ebbad7f","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","export default class DBModalCtrl {\n\n constructor ($scope, $uibModalInstance) {\n 'ngInject';\n this.$scope = $scope;\n this.$uibModalInstance = $uibModalInstance;\n }\n\n ok () {\n this.$uibModalInstance.close();\n };\n\n cancel () {\n this.$uibModalInstance.dismiss('cancel');\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: DBModalCtrl,\n controllerAs: 'vm'\n });\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n console.log(GeoUtils);\n\n let ext = GeoUtils.get_file_extension(file.name);\n console.log(ext);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n if (ext === 'kml') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.kml.parse(e.target.result);\n // debugger\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else if (ext === 'gpx') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.gpx.parse(e.target.result);\n lg.feature_group.addLayer(l);\n\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else {\n let json = JSON.parse(e.target.result);\n\n // we add in a field into the json blob when saved. If it is such,\n // handle potential multiple layers.\n if (json.ds_map) {\n // each feature in the collection represents a layer\n json.features.forEach( (f) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(f).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n else {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json).getLayers().forEach( (l) => {\n this.layer_groups[0].feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n }\n\n };\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n this.active_layer_group.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js index b2916761be..329059afd4 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js @@ -1,6 +1,16 @@ export default class DBModalCtrl { - constructor ($scope) { + constructor ($scope, $uibModalInstance) { + 'ngInject'; this.$scope = $scope; + this.$uibModalInstance = $uibModalInstance; } + + ok () { + this.$uibModalInstance.close(); + }; + + cancel () { + this.$uibModalInstance.dismiss('cancel'); + }; } diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css index bdad17661d..dfd4c7d145 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -6,6 +6,25 @@ font-family: 'Open Sans', sans-serif; } +#navbar { + background-color: #313131; + flex: 0 0 40; + flex-direction: column; + border-right: 1px solid #6e6e6e; + color: #d2d2d2; + padding-top: 55px; +} + +#navbar .nav-icon { + margin-left: 5px; + padding: 5px 10px 10px 10px; +} +#navbar .nav-icon.active{ + margin-left: 0px; + border-left: 5px solid red; + background-color: #404040; +} + #geo_sidebar, #current_layer_details{ width: 20%; font-size: 11px; From 7a7a2c28792f353b0c443c09917ea9bf0a59d7eb Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Sun, 19 Mar 2017 17:00:33 -0500 Subject: [PATCH 064/520] css fiddling --- .../static/designsafe/apps/geo/html/map.html | 11 ++++++----- .../static/designsafe/apps/geo/styles/geo.css | 17 +++++++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 91d13ea887..baad7e5194 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -1,20 +1,21 @@
      -
        + -
      - + + +
      - {{lg.num_features()}} features + {{lg.num_features()}} features
      @@ -68,6 +70,7 @@ ng-show="lg.show_contents" ng-repeat="feature in lg.feature_group.getLayers() track by $index" ng-mouseover="feature.hover=true" + ng-class="{'active': lg == vm.active_layer_group}" ng-mouseleave="feature.hover=false" on-drop-success="vm.drop_feature_success($event, $index, feature)" ui-draggable="true" diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index 69bc8ad5e5..430f07114d 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -109,7 +109,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de var mod = angular.module('ds.geo.directives', []); mod.directive('customOnChange', _customOnChange2.default); - exports.default = mod; /***/ }), diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 1941863b60..48289d44b5 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 070130558a2b5ebbad7f","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","DBModalCtrl","$scope","$uibModalInstance","dismiss","$timeout","$window","$uibModal","element","hide","primary_color","secondary_color","streets","L","tileLayer","maxZoom","satellite","control","layers","basemaps","addTo","map","zoomControl","setPosition","invalidateSize","layer_groups","active_layer_group","current_layer","$apply","on","e","object","options","color","fillColor","fillOpacity","feature_group","addLayer","dc","Control","position","draw","circle","edit","featureGroup","remove","lg","push","length","select_active_layer_group","removeLayer","splice","i","show","removeControl","drawControl","add_draw_controls","active","open","templateUrl","controllerAs","$","click","f","Marker","Polygon","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","getBounds","src_lg","getLayers","console","log","file","ev","target","ext","GeoUtils","get_file_extension","reader","FileReader","readAsText","onload","l","omnivore","kml","parse","result","forEach","d","gpx","json","JSON","ds_map","features","geoJSON","bounds","files","readAsArrayBuffer","exif","EXIF","readFromBinaryFile","lat","GPSLatitude","lonRef","GPSLongitudeRef","lon","setStyle","out","map_title","label","blob","Blob","a","document","createElement","href","url","textContent","restrict","scope","handler","link","LayerGroup","show_contents","MapProject","name","fname","split","pop","requires","config","$stateProvider","$uibTooltipProvider","state","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;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P;AACD,C;;;;;;;;;;;;;ACFD;;AACA;;AACA;;AAEA;AACAzI,IAAI0I,QAAJ,CAAavF,IAAb,CAAkB,WAAlB,EAA+B,QAA/B;;AAEA,SAASwF,MAAT,CAAgBC,cAAhB,EAAgCC,OAAqB;AACnD;;AACAD,iBAAeE,KAAf,CAAqB,KAArB,EAA4B;AAC1BjB,SAAK,EADqB;AAAA;AAG1B1H,gBAAY,eAHc;AAI1B4I,YAAS;AACPC,YAAM,gBAAY;AAChB,eAAO,IAAP;AACD;AAHM;AAJiB,GAA5B;;AAWA;AACAH,KAAA;AAED;;AAED7I,IAAI2I,MAAJ,CAAWA,MAAX","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 9);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 070130558a2b5ebbad7f","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\nmod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","export default class DBModalCtrl {\n\n constructor ($scope, $uibModalInstance) {\n 'ngInject';\n this.$scope = $scope;\n this.$uibModalInstance = $uibModalInstance;\n }\n\n ok () {\n this.$uibModalInstance.close();\n };\n\n cancel () {\n this.$uibModalInstance.dismiss('cancel');\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: DBModalCtrl,\n controllerAs: 'vm'\n });\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n console.log(GeoUtils);\n\n let ext = GeoUtils.get_file_extension(file.name);\n console.log(ext);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n if (ext === 'kml') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.kml.parse(e.target.result);\n // debugger\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else if (ext === 'gpx') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.gpx.parse(e.target.result);\n lg.feature_group.addLayer(l);\n\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else {\n let json = JSON.parse(e.target.result);\n\n // we add in a field into the json blob when saved. If it is such,\n // handle potential multiple layers.\n if (json.ds_map) {\n // each feature in the collection represents a layer\n json.features.forEach( (f) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(f).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n else {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json).getLayers().forEach( (l) => {\n this.layer_groups[0].feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n }\n\n };\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n this.active_layer_group.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 048044f95176b0262c17","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","DBModalCtrl","$scope","$uibModalInstance","dismiss","$timeout","$window","$uibModal","element","hide","primary_color","secondary_color","streets","L","tileLayer","maxZoom","satellite","control","layers","basemaps","addTo","map","zoomControl","setPosition","invalidateSize","layer_groups","active_layer_group","current_layer","$apply","on","e","object","options","color","fillColor","fillOpacity","feature_group","addLayer","dc","Control","position","draw","circle","edit","featureGroup","remove","lg","push","length","select_active_layer_group","removeLayer","splice","i","show","removeControl","drawControl","add_draw_controls","active","open","templateUrl","controllerAs","$","click","f","Marker","Polygon","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","getBounds","src_lg","getLayers","console","log","file","ev","target","ext","GeoUtils","get_file_extension","reader","FileReader","readAsText","onload","l","omnivore","kml","parse","result","forEach","d","gpx","json","JSON","ds_map","features","geoJSON","bounds","files","readAsArrayBuffer","exif","EXIF","readFromBinaryFile","lat","GPSLatitude","lonRef","GPSLongitudeRef","lon","setStyle","out","map_title","label","blob","Blob","a","document","createElement","href","url","textContent","restrict","scope","handler","link","LayerGroup","show_contents","MapProject","name","fname","split","pop","requires","config","$stateProvider","$uibTooltipProvider","state","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAF,IAAIG,UAAJ,CAAe,gBAAf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,eAHc;AAI1B4I,YAAS;AACPC,YAAM,gBAAY;AAChB,eAAO,IAAP;AACD;AAHM;AAJiB,GAA5B;;AAWA;AACAH,KAAA;AAED;;AAED7I,IAAI2I,MAAJ,CAAWA,MAAX","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 9);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 048044f95176b0262c17","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\n\nmod.directive('customOnChange', customOnChange);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","export default class DBModalCtrl {\n\n constructor ($scope, $uibModalInstance) {\n 'ngInject';\n this.$scope = $scope;\n this.$uibModalInstance = $uibModalInstance;\n }\n\n ok () {\n this.$uibModalInstance.close();\n };\n\n cancel () {\n this.$uibModalInstance.dismiss('cancel');\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: DBModalCtrl,\n controllerAs: 'vm'\n });\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n console.log(GeoUtils);\n\n let ext = GeoUtils.get_file_extension(file.name);\n console.log(ext);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n if (ext === 'kml') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.kml.parse(e.target.result);\n // debugger\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else if (ext === 'gpx') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.gpx.parse(e.target.result);\n lg.feature_group.addLayer(l);\n\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else {\n let json = JSON.parse(e.target.result);\n\n // we add in a field into the json blob when saved. If it is such,\n // handle potential multiple layers.\n if (json.ds_map) {\n // each feature in the collection represents a layer\n json.features.forEach( (f) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(f).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n else {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json).getLayers().forEach( (l) => {\n this.layer_groups[0].feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n }\n\n };\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n this.active_layer_group.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js index 111a4e0b55..045aefd8f2 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js @@ -2,6 +2,6 @@ import customOnChange from './custom-on-change'; let mod = angular.module('ds.geo.directives', []); -mod.directive('customOnChange', customOnChange); +mod.directive('customOnChange', customOnChange); export default mod; diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css index 517ade6d2d..0b90088654 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -7,7 +7,7 @@ } #navbar { - background-color: #313131; + background-color: #272727; flex: 0 0 40; flex-direction: column; border-right: 1px solid #6e6e6e; @@ -34,17 +34,17 @@ letter-spacing: 0px; float: left; flex: 0 0 230px; - background: #404040; + background: #313131; border-right: 1px solid #6e6e6e; flex-direction: column; display: flex; + /*overflow-y: scroll;*/ } -.list-group-item.clearfix.subgroup { - margin-left: 10px; -} + + .strong { font-family: 'Open Sans Bold',sans-serif; @@ -68,7 +68,7 @@ } #geo_sidebar .list-group-item.menu, #current_layer_details .list-group-item.menu{ - background-color: #404040; + background-color: #313131; border-bottom: 1px solid #707070; border-left: 5px; border-right: 0px; @@ -83,7 +83,7 @@ #geo_sidebar .list-group-item.menu.active { border-left: 5px solid cyan; - background-color: #646464; + background-color: #444444; } #geo_sidebar .list-group-item.menu.lg-tools { background-color: #29948a; @@ -93,6 +93,17 @@ background-color: #4575b0; } +#geo_sidebar .list-group-item.subgroup { + margin-left: 0px; + padding-left: 10px; +} +#geo_sidebar .list-group-item.subgroup.active { + margin-left: 0px; + border-left: 0px; + padding-left: 10px; + +} + #geo_sidebar .list-group-item.menu.title{ background-color: #404040; padding-top: 15px; diff --git a/webpack.config.js b/webpack.config.js index b9210225e0..c82fea393c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -45,6 +45,7 @@ module.exports = { d3: 'd3', moment: 'moment', _: '_', + L: 'L', window: 'window', } }; From fefbfdcf5b36506e7794a68afa36070d915482ec Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Mon, 20 Mar 2017 16:15:59 -0500 Subject: [PATCH 066/520] my data browser directive start --- .../templates/designsafe/apps/geo/index.html | 3 +- .../apps/workspace/html/data-browser.html | 2 +- .../directives/my-data-browser.js | 60 +++++++++++++++++++ .../html/directives/my-data-browser.html | 49 +++++++++++++++ .../ng-designsafe/services/data-service.js | 6 +- designsafe/templates/base.html | 1 + 6 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js create mode 100644 designsafe/static/scripts/ng-designsafe/html/directives/my-data-browser.html diff --git a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html index 784b52a6ee..70f5b18563 100644 --- a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html +++ b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html @@ -12,7 +12,8 @@ {% block content %}
      -
      + +
      {% addtoblock "js" %} diff --git a/designsafe/apps/workspace/static/designsafe/apps/workspace/html/data-browser.html b/designsafe/apps/workspace/static/designsafe/apps/workspace/html/data-browser.html index 7ed586eaa8..32fd18ddd3 100644 --- a/designsafe/apps/workspace/static/designsafe/apps/workspace/html/data-browser.html +++ b/designsafe/apps/workspace/static/designsafe/apps/workspace/html/data-browser.html @@ -29,7 +29,7 @@

      Data Depot Browser

      - + - - -

      - My Data Browser +
      +
      + + + + + + + + + + + + + + + + + +
      +
      + + {{dirElem}} + + / +
      File nameSize
      + + + + {{renderName(f)}} + + {{f.length|bytes:0}}

      Loading files...

      {{data.error}}

      + + Loading... + +
      +
      +
      diff --git a/designsafe/static/scripts/ng-designsafe/services/data-service.js b/designsafe/static/scripts/ng-designsafe/services/data-service.js index 0f81a06ec1..77755f2d1d 100644 --- a/designsafe/static/scripts/ng-designsafe/services/data-service.js +++ b/designsafe/static/scripts/ng-designsafe/services/data-service.js @@ -19,7 +19,7 @@ service.getIcon = function(type, ext) { - if (type === 'folder') { + if ((type === 'folder') || (type === 'dir')) { return 'fa-folder'; } @@ -312,7 +312,7 @@ * * Search in the ES index using a query string. * An array with the string name of each extra field to search - * can be passed. + * can be passed. * * @param {string} q * @param {array} fields @@ -324,7 +324,7 @@ var url = djangoUrl.reverse('designsafe_api:search', params); url += '&q=' + q; if (fields && fields.length >= 1){ - url += '&fields=' + fields; + url += '&fields=' + fields; } if (page){ var offset = page * 100; diff --git a/designsafe/templates/base.html b/designsafe/templates/base.html index bed5c366b8..33e4d3e70f 100644 --- a/designsafe/templates/base.html +++ b/designsafe/templates/base.html @@ -77,6 +77,7 @@ + From 82b47e6bcf40eb16cacceb46035a279b0b6c47d6 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Mon, 20 Mar 2017 17:11:15 -0500 Subject: [PATCH 067/520] data picker ctd --- .../apps/geo/scripts/build/bundle.js | 35 +++++++++++++++++-- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/services/geo-state-service.js | 10 ++++++ .../apps/geo/scripts/services/index.js | 3 ++ .../templates/designsafe/apps/geo/index.html | 4 +-- .../directives/my-data-browser.js | 4 +++ .../html/directives/my-data-browser.html | 6 ++-- 7 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index 430f07114d..b20a7bbfaf 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -121,9 +121,16 @@ exports.default = mod; Object.defineProperty(exports, "__esModule", { value: true }); -// import customOnChange from './custom-on-change'; -var mod = angular.module('ds.geo.services', []); +var _geoStateService = __webpack_require__(11); + +var _geoStateService2 = _interopRequireDefault(_geoStateService); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mod = angular.module('ds.geo.services', []); // import customOnChange from './custom-on-change'; + +mod.service('GeoStateService', _geoStateService2.default); // mod.directive('customOnChange', customOnChange); @@ -660,6 +667,30 @@ mod.config(config); exports.default = mod; +/***/ }), +/* 10 */, +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var GeoStateService = function GeoStateService($scope, $state) { + _classCallCheck(this, GeoStateService); + + this.$scope = $scope; + this.$state = $state; + this.last_db_path = null; +}; + +exports.default = GeoStateService; + /***/ }) /******/ ]); //# sourceMappingURL=bundle.js.map \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 48289d44b5..8d5b3a1e85 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 048044f95176b0262c17","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","DBModalCtrl","$scope","$uibModalInstance","dismiss","$timeout","$window","$uibModal","element","hide","primary_color","secondary_color","streets","L","tileLayer","maxZoom","satellite","control","layers","basemaps","addTo","map","zoomControl","setPosition","invalidateSize","layer_groups","active_layer_group","current_layer","$apply","on","e","object","options","color","fillColor","fillOpacity","feature_group","addLayer","dc","Control","position","draw","circle","edit","featureGroup","remove","lg","push","length","select_active_layer_group","removeLayer","splice","i","show","removeControl","drawControl","add_draw_controls","active","open","templateUrl","controllerAs","$","click","f","Marker","Polygon","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","getBounds","src_lg","getLayers","console","log","file","ev","target","ext","GeoUtils","get_file_extension","reader","FileReader","readAsText","onload","l","omnivore","kml","parse","result","forEach","d","gpx","json","JSON","ds_map","features","geoJSON","bounds","files","readAsArrayBuffer","exif","EXIF","readFromBinaryFile","lat","GPSLatitude","lonRef","GPSLongitudeRef","lon","setStyle","out","map_title","label","blob","Blob","a","document","createElement","href","url","textContent","restrict","scope","handler","link","LayerGroup","show_contents","MapProject","name","fname","split","pop","requires","config","$stateProvider","$uibTooltipProvider","state","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAF,IAAIG,UAAJ,CAAe,gBAAf;;kBAEeH,G;;;;;;;;;;;;;ACNf;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,mBAAf,EAAoC,EAApC,CAAV;;AAGAF,IAAII,SAAJ,CAAc,gBAAd;kBACeJ,G;;;;;;;;;;;;ACNf;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV;;AAEA;;kBAEeF,G;;;;;;;;;;;;;;;;;ICNMK,W;AAEnB,uBAAaC,MAAb,EAAqBC,iBAArB,EAAwC;AACtC;;AADsC;;AAEtC;AACA,SAAKA,gBAAL;AACD;;;;cAEK;AACJ,WAAKA,eAAL;AACD;;;kBAES;AACR,WAAKA,iBAAL,CAAuBC,CAAvB;AACD;;;;;;;;;;;;;;;;;;;;;ACdH;;;;AACA;;;;AACA;;;;AACA;;;;;;;;;;;AAIE,0BAAaF,MAAb,EAAmD;AACjD;;AADiD;;AAAA;;AAEjD,SAAKA,MAA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;AAEK;AAAA;;AACtB,SAAKb,KAAL,GAAaA,KAAb;AACA;AACA,SAAK7D,IAAL,GAAY,IAAZ;AACA,SAAK2E,aAAL,GAAqB,GAArB;AACD;;;;6BAEe;AACd,aAAO,KAAK5F,MAAZ;AACD;;;;;;;;;;;;;;;;;;;;;ICVkB6F,U,GAEnB,oBAAaC,IAAb,EAAmB;AAAA;;AACjB,OAAKA,IAAL,GAAYA,IAAZ;AACA;AACD,C;;;;;;;;;;;;;;QCNahD,K;AAAT,GAAoC;AACzC,SAAOiD,MAAMC,KAAN,CAAY,GAAZ,EAAiBC,GAAjB,EAAP;AACD,C;;;;;;;;;;;;;ACFD;;AACA;;AACA;;AAEA;AACAzI,IAAI0I,QAAJ,CAAavF,IAAb,CAAkB,WAAlB,EAA+B,QAA/B;;AAEA,SAASwF,MAAT,CAAgBC,cAAhB,EAAgCC,OAAqB;AACnD;;AACAD,iBAAeE,KAAf,CAAqB,KAArB,EAA4B;AAC1BjB,SAAK,EADqB;AAAA;AAG1B1H,gBAAY,eAHc;AAI1B4I,YAAS;AACPC,YAAM,gBAAY;AAChB,eAAO,IAAP;AACD;AAHM;AAJiB,GAA5B;;AAWA;AACAH,KAAA;AAED;;AAED7I,IAAI2I,MAAJ,CAAWA,MAAX","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 9);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 048044f95176b0262c17","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\n\nmod.directive('customOnChange', customOnChange);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.services', []);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","export default class DBModalCtrl {\n\n constructor ($scope, $uibModalInstance) {\n 'ngInject';\n this.$scope = $scope;\n this.$uibModalInstance = $uibModalInstance;\n }\n\n ok () {\n this.$uibModalInstance.close();\n };\n\n cancel () {\n this.$uibModalInstance.dismiss('cancel');\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '©
      OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: DBModalCtrl,\n controllerAs: 'vm'\n });\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n console.log(GeoUtils);\n\n let ext = GeoUtils.get_file_extension(file.name);\n console.log(ext);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n if (ext === 'kml') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.kml.parse(e.target.result);\n // debugger\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else if (ext === 'gpx') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.gpx.parse(e.target.result);\n lg.feature_group.addLayer(l);\n\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else {\n let json = JSON.parse(e.target.result);\n\n // we add in a field into the json blob when saved. If it is such,\n // handle potential multiple layers.\n if (json.ds_map) {\n // each feature in the collection represents a layer\n json.features.forEach( (f) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(f).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n else {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json).getLayers().forEach( (l) => {\n this.layer_groups[0].feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n }\n\n };\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n this.active_layer_group.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap e7ba579571c6a1efc632","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js"],"names":["mod","angular","module","controller","directive","service","DBModalCtrl","$scope","$uibModalInstance","dismiss","$timeout","$window","$uibModal","element","hide","primary_color","secondary_color","streets","L","tileLayer","maxZoom","satellite","control","layers","basemaps","addTo","map","zoomControl","setPosition","invalidateSize","layer_groups","active_layer_group","current_layer","$apply","on","e","object","options","color","fillColor","fillOpacity","feature_group","addLayer","dc","Control","position","draw","circle","edit","featureGroup","remove","lg","push","length","select_active_layer_group","removeLayer","splice","i","show","removeControl","drawControl","add_draw_controls","active","open","templateUrl","controllerAs","$","click","f","Marker","Polygon","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","getBounds","src_lg","getLayers","console","log","file","ev","target","ext","GeoUtils","get_file_extension","reader","FileReader","readAsText","onload","l","omnivore","kml","parse","result","forEach","d","gpx","json","JSON","ds_map","features","geoJSON","bounds","files","readAsArrayBuffer","exif","EXIF","readFromBinaryFile","lat","GPSLatitude","lonRef","GPSLongitudeRef","lon","setStyle","out","map_title","label","blob","Blob","a","document","createElement","href","url","textContent","restrict","scope","handler","link","LayerGroup","show_contents","MapProject","name","fname","split","pop","requires","config","$stateProvider","$uibTooltipProvider","state","resolve","auth","$state","GeoStateService"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA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,aAAO,KAAK5F,MAAZ;AACD;;;;;;;;;;;;;;;;;;;;;ICVkB6F,U,GAEnB,oBAAaC,IAAb,EAAmB;AAAA;;AACjB,OAAKA,IAAL,GAAYA,IAAZ;AACA;AACD,C;;;;;;;;;;;;;;QCNahD,K;AAAT,GAAoC;AACzC,SAAOiD,MAAMC,KAAN,CAAY,GAAZ,EAAiBC,GAAjB,EAAP;AACD,C;;;;;;;;;;;;;ACFD;;AACA;;AACA;;AAEA;AACA1I,IAAI2I,QAAJ,CAAavF,IAAb,CAAkB,WAAlB,EAA+B,QAA/B;;AAEA,SAASwF,MAAT,CAAgBC,cAAhB,EAAgCC,OAAqB;AACnD;;AACAD,iBAAeE,KAAf,CAAqB,KAArB,EAA4B;AAC1BjB,SAAK,EADqB;AAAA;AAG1B3H,gBAAY,eAHc;AAI1B6I,YAAS;AACPC,YAAM,gBAAY;AAChB,eAAO,IAAP;AACD;AAHM;AAJiB,GAA5B;;AAWA;AACAH,KAAA;AAED;;AAED9I,IAAI4I,MAAJ,CAAWA,MAAX;;;;;;;;;;;;;;;;;;ACvB+B;AAAA;;AAC3B,OAAKrI,MAAL,GAAcA,MAAd;AACA,OAAK2I,MAAL,GAAcA,MAAd;AACA;AACD,C;;kBANkBC,S","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 9);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e7ba579571c6a1efc632","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\n\nmod.directive('customOnChange', customOnChange);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\nimport GeoStateService from './geo-state-service';\n\n\nlet mod = angular.module('ds.geo.services', []);\nmod.service('GeoStateService', GeoStateService);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","export default class DBModalCtrl {\n\n constructor ($scope, $uibModalInstance) {\n 'ngInject';\n this.$scope = $scope;\n this.$uibModalInstance = $uibModalInstance;\n }\n\n ok () {\n this.$uibModalInstance.close();\n };\n\n cancel () {\n this.$uibModalInstance.dismiss('cancel');\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: DBModalCtrl,\n controllerAs: 'vm'\n });\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n console.log(GeoUtils);\n\n let ext = GeoUtils.get_file_extension(file.name);\n console.log(ext);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n if (ext === 'kml') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.kml.parse(e.target.result);\n // debugger\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else if (ext === 'gpx') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.gpx.parse(e.target.result);\n lg.feature_group.addLayer(l);\n\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else {\n let json = JSON.parse(e.target.result);\n\n // we add in a field into the json blob when saved. If it is such,\n // handle potential multiple layers.\n if (json.ds_map) {\n // each feature in the collection represents a layer\n json.features.forEach( (f) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(f).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n else {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json).getLayers().forEach( (l) => {\n this.layer_groups[0].feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n }\n\n };\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n this.active_layer_group.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","export default class GeoStateService {\n\n constructor ($scope, $state) {\n this.$scope = $scope;\n this.$state = $state;\n this.last_db_path = null;\n }\n\n \n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js new file mode 100644 index 0000000000..06ef4aeb58 --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js @@ -0,0 +1,10 @@ +export default class GeoStateService { + + constructor ($scope, $state) { + this.$scope = $scope; + this.$state = $state; + this.last_db_path = null; + } + + +} diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js index 56ffa33098..1b231dc458 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js @@ -1,6 +1,9 @@ // import customOnChange from './custom-on-change'; +import GeoStateService from './geo-state-service'; + let mod = angular.module('ds.geo.services', []); +mod.service('GeoStateService', GeoStateService); // mod.directive('customOnChange', customOnChange); diff --git a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html index 70f5b18563..bbad75a8b5 100644 --- a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html +++ b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html @@ -12,8 +12,8 @@ {% block content %}
      - - + +
      {% addtoblock "js" %} diff --git a/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js b/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js index 75dfc8080c..49b6be7791 100644 --- a/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js +++ b/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js @@ -1,6 +1,9 @@ angular.module('designsafe').directive('myDataBrowser', function () { return { restrict: 'E', + scope: { + file_only: '@file_only', + }, link: function ($scope, element, attrs) { console.log(element); }, @@ -9,6 +12,7 @@ angular.module('designsafe').directive('myDataBrowser', function () { $scope.loading = true; $scope.data = { busyListingPage: true, + wants: false }; DataBrowserService.browse({system: 'designsafe.storage.default', path: 'jmeiring'}).then(function (resp) { diff --git a/designsafe/static/scripts/ng-designsafe/html/directives/my-data-browser.html b/designsafe/static/scripts/ng-designsafe/html/directives/my-data-browser.html index 6216735f7d..e17accd7d1 100644 --- a/designsafe/static/scripts/ng-designsafe/html/directives/my-data-browser.html +++ b/designsafe/static/scripts/ng-designsafe/html/directives/my-data-browser.html @@ -1,4 +1,3 @@ -

      My Data Browser

      My Data Browser
      Size
      - {{renderName(f)}} + {{ renderName(f) }} {{f.length|bytes:0}}

      Loading files...

      {{data.error}}

      - - Loading... - -
      From 53e05f2e5fad6a3416b7cc89c382e78051890ae8 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Tue, 21 Mar 2017 12:52:55 -0500 Subject: [PATCH 070/520] Adding rabbitmq in celery config --- designsafe/celery_settings.py | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/designsafe/celery_settings.py b/designsafe/celery_settings.py index 6bd2af2442..7ebd0085a9 100644 --- a/designsafe/celery_settings.py +++ b/designsafe/celery_settings.py @@ -1,11 +1,33 @@ -### +""" # Celery settings -# -BROKER_URL = 'redis://redis:6379/0' -#BROKER_URL = 'amqp://designsafe:8WEESynT82y73qhG@rabbitmq:5672//' +""" +import os +#BROKER_URL = 'redis://redis:6379/0' +BROKER_URL_PROTOCOL = os.environ.get('BROKER_URL_PROTOCOL') +BROKER_URL_USERNAME = os.environ.get('BROKER_URL_USERNAME') +BROKER_URL_PWD = os.environ.get('BROKER_URL_PWD') +BROKER_URL_HOST = os.environ.get('BROKER_URL_HOST') +BROKER_URL_PORT = os.environ.get('BROKER_URL_PORT') +BROKER_URL_VHOST = os.environ.get('BROKER_URL_VHOST') +BROKER_URL = ''.join([BROKER_URL_PROTOCOL, BROKER_URL_USERNAME, ':', + BROKER_URL_PWD, '@', BROKER_URL_HOST, ':', + BROKER_URL_PORT, '/', BROKER_URL_VHOST]) +#BROKER_URL = 'amqp://designsafe:pwd@rabbitmq:5672//' +CELERY_RESULT_BACKEND_PROTOCOL = os.environ.get('CELERY_RESULT_BACKEND_PROTOCOL') +CELERY_RESULT_BACKEND_USERNAME = os.environ.get('CELERY_RESULT_BACKEND_USERNAME') +CELERY_RESULT_BACKEND_PWD = os.environ.get('CELERY_RESULT_BACKEND_PWD') +CELERY_RESULT_BACKEND_HOST = os.environ.get('CELERY_RESULT_BACKEND_HOST') +CELERY_RESULT_BACKEND_PORT = os.environ.get('CELERY_RESULT_BACKEND_PORT') +CELERY_RESULT_BACKEND_DB = os.environ.get('CELERY_RESULT_BACKEND_DB') +CELERY_RESULT_BACKEND = ''.join([CELERY_RESULT_BACKEND_PROTOCOL, CELERY_RESULT_BACKEND_USERNAME, + ':', CELERY_RESULT_BACKEND_PWD, '@', + CELERY_RESULT_BACKEND_HOST, ':', CELERY_RESULT_BACKEND_PORT, + '/', CELERY_RESULT_BACKEND_DB]) + CELERY_ACCEPT_CONTENT = ['json'] CELERY_TASK_SERIALIZER = 'json' CELERY_RESULT_SERIALIZER = 'json' CELERYD_HIJACK_ROOT_LOGGER = False -# CELERYD_LOG_FORMAT ='[DJANGO] $(processName)s %(levelname)s %(asctime)s %(module)s %(name)s.%(funcName)s:%(lineno)s: [%(task_name)s(%(task_id)s)]%(message)s' +CELERYD_LOG_FORMAT = '[DJANGO] $(processName)s %(levelname)s %(asctime)s %(module)s '\ + '%(name)s.%(funcName)s:%(lineno)s: [%(task_name)s(%(task_id)s)]%(message)s' #CELERY_ANOTATIONS = {'designsafe.apps.api.tasks.reindex_agave': {'time_limit': 60 * 15}} From b1a3f0a84089d866ff77054d298ff1f732cbe2a2 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Tue, 21 Mar 2017 12:53:34 -0500 Subject: [PATCH 071/520] Adding env sample for celery broker and backend config --- designsafe.env.sample | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/designsafe.env.sample b/designsafe.env.sample index 13f38f29bc..fa05036022 100644 --- a/designsafe.env.sample +++ b/designsafe.env.sample @@ -88,6 +88,8 @@ AGAVE_JWT_USER_CLAIM_FIELD= AGAVE_STORAGE_SYSTEM=designsafe.storage.default +PROJECT_SYSTEM_STORAGE_CREDENTIALS= + BOX_APP_CLIENT_ID= BOX_APP_CLIENT_SECRET= @@ -115,3 +117,22 @@ NEES_DATABASE_PASSWORD= # FOR CMS/RECAPTCHA DJANGOCMS_FORMS_RECAPTCHA_PUBLIC_KEY= DJANGOCMS_FORMS_RECAPTCHA_SECRET_KEY= + +FLOWER_BROKER= +FLOWER_BROKER_API= + +#CELERY config + +BROKER_URL_PROTOCOL=amqp:// +BROKER_URL_USERNAME= +BROKER_URL_PWD= +BROKER_URL_HOST= +BROKER_URL_PORT= +BROKER_URL_VHOST= +#BROKER_URL = 'amqp://designsafe:pwd@rabbitmq:5672//' +CELERY_RESULT_BACKEND_PROTOCOL= +CELERY_RESULT_BACKEND_USERNAME= +CELERY_RESULT_BACKEND_PWD= +CELERY_RESULT_BACKEND_HOST= +CELERY_RESULT_BACKEND_PORT= +CELERY_RESULT_BACKEND_DB= From cb76837c8260465272035de009c7bb2fb82cd5db Mon Sep 17 00:00:00 2001 From: Marjo Poindexter Date: Tue, 21 Mar 2017 13:16:14 -0500 Subject: [PATCH 072/520] move where agave home dir check/creation is done. add acl to new dirs --- designsafe/apps/api/agave/views.py | 3 +++ designsafe/apps/auth/backends.py | 5 ++++- designsafe/apps/auth/signals.py | 3 ++- designsafe/apps/auth/tasks.py | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/designsafe/apps/api/agave/views.py b/designsafe/apps/api/agave/views.py index 040b157cca..e397e507e7 100644 --- a/designsafe/apps/api/agave/views.py +++ b/designsafe/apps/api/agave/views.py @@ -4,6 +4,7 @@ import logging import json import os +import subprocess import re import chardet from django.core.urlresolvers import reverse @@ -308,6 +309,8 @@ def put(self, request, file_mgr_name, system_id, file_path): dir_name = re.sub('[^a-zA-Z\_\- ]', '_', dir_name) dir_name = re.sub('\_+', '_', dir_name) new_dir = fm.mkdir(system_id, file_path, dir_name) + + subprocess.call(['setfacl', '-m', 'd:u:tg458981:rwX,u:' + request.user.username + ':rwX', '/corral-repl/tacc/NHERI/shared' + file_path + '/' + dir_name]) metrics.info('Data Depot', extra = { 'user': request.user.username, diff --git a/designsafe/apps/auth/backends.py b/designsafe/apps/auth/backends.py index a5dbf00ddd..81fcad755d 100644 --- a/designsafe/apps/auth/backends.py +++ b/designsafe/apps/auth/backends.py @@ -7,6 +7,7 @@ from django.dispatch import receiver from designsafe.apps.accounts.models import DesignSafeProfile from pytas.http import TASClient +from .tasks import check_or_create_agave_home_dir import logging import re import requests @@ -84,7 +85,7 @@ def authenticate(self, username=None, password=None, request=None, **kwargs): last_name=tas_user['lastName'], email=tas_user['email'] ) - + check_or_create_agave_home_dir.apply_async(args=(user.username,)) try: profile = DesignSafeProfile.objects.get(user=user) except DesignSafeProfile.DoesNotExist: @@ -138,6 +139,8 @@ def authenticate(self, *args, **kwargs): email=agave_user['email'] ) + check_or_create_agave_home_dir.apply_async(args=(user.username,)) + try: profile = DesignSafeProfile.objects.get(user=user) except DesignSafeProfile.DoesNotExist: diff --git a/designsafe/apps/auth/signals.py b/designsafe/apps/auth/signals.py index 677bd262a4..39336c247c 100644 --- a/designsafe/apps/auth/signals.py +++ b/designsafe/apps/auth/signals.py @@ -5,4 +5,5 @@ @receiver(user_logged_in) def on_user_logged_in(sender, user, request, **kwargs): - check_or_create_agave_home_dir.apply_async(args=(user.username,)) + pass #done in auth/backends.py + # check_or_create_agave_home_dir.apply_async(args=(user.username,)) diff --git a/designsafe/apps/auth/tasks.py b/designsafe/apps/auth/tasks.py index 6a2223f47c..2337249ca3 100644 --- a/designsafe/apps/auth/tasks.py +++ b/designsafe/apps/auth/tasks.py @@ -26,8 +26,8 @@ def check_or_create_agave_home_dir(username): body = {'action': 'mkdir', 'path': username} ag.files.manage(systemId=settings.AGAVE_STORAGE_SYSTEM, filePath='', body=body) - - subprocess.call(["setfacl", "-m", "d:u:tg458981:rwX,u:" + username + ":rwX", "/corral-repl/tacc/NHERI/shared/" + username]) + logger.info("subprocess.call(['setfacl', '-m', 'd:u:tg458981:rwX,u:' + {} + ':rwX', '/corral-repl/tacc/NHERI/shared/' + {}])",username, username) + subprocess.call(['setfacl', '-m', 'd:u:tg458981:rwX,u:' + username + ':rwX', '/corral-repl/tacc/NHERI/shared/' + username]) # add dir to index fm = FileManager(agave_client=ag) From b40c91c12b3d0750ce60f263bc448b94474d43bf Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Tue, 21 Mar 2017 13:32:36 -0500 Subject: [PATCH 073/520] Defaulting to empty strings for config values --- designsafe/celery_settings.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/designsafe/celery_settings.py b/designsafe/celery_settings.py index 7ebd0085a9..bd585e340f 100644 --- a/designsafe/celery_settings.py +++ b/designsafe/celery_settings.py @@ -3,22 +3,22 @@ """ import os #BROKER_URL = 'redis://redis:6379/0' -BROKER_URL_PROTOCOL = os.environ.get('BROKER_URL_PROTOCOL') -BROKER_URL_USERNAME = os.environ.get('BROKER_URL_USERNAME') -BROKER_URL_PWD = os.environ.get('BROKER_URL_PWD') -BROKER_URL_HOST = os.environ.get('BROKER_URL_HOST') -BROKER_URL_PORT = os.environ.get('BROKER_URL_PORT') -BROKER_URL_VHOST = os.environ.get('BROKER_URL_VHOST') +BROKER_URL_PROTOCOL = os.environ.get('BROKER_URL_PROTOCOL', '') +BROKER_URL_USERNAME = os.environ.get('BROKER_URL_USERNAME', '') +BROKER_URL_PWD = os.environ.get('BROKER_URL_PWD', '') +BROKER_URL_HOST = os.environ.get('BROKER_URL_HOST', '') +BROKER_URL_PORT = os.environ.get('BROKER_URL_PORT', '') +BROKER_URL_VHOST = os.environ.get('BROKER_URL_VHOST', '') BROKER_URL = ''.join([BROKER_URL_PROTOCOL, BROKER_URL_USERNAME, ':', BROKER_URL_PWD, '@', BROKER_URL_HOST, ':', BROKER_URL_PORT, '/', BROKER_URL_VHOST]) #BROKER_URL = 'amqp://designsafe:pwd@rabbitmq:5672//' -CELERY_RESULT_BACKEND_PROTOCOL = os.environ.get('CELERY_RESULT_BACKEND_PROTOCOL') -CELERY_RESULT_BACKEND_USERNAME = os.environ.get('CELERY_RESULT_BACKEND_USERNAME') -CELERY_RESULT_BACKEND_PWD = os.environ.get('CELERY_RESULT_BACKEND_PWD') -CELERY_RESULT_BACKEND_HOST = os.environ.get('CELERY_RESULT_BACKEND_HOST') -CELERY_RESULT_BACKEND_PORT = os.environ.get('CELERY_RESULT_BACKEND_PORT') -CELERY_RESULT_BACKEND_DB = os.environ.get('CELERY_RESULT_BACKEND_DB') +CELERY_RESULT_BACKEND_PROTOCOL = os.environ.get('CELERY_RESULT_BACKEND_PROTOCOL', '') +CELERY_RESULT_BACKEND_USERNAME = os.environ.get('CELERY_RESULT_BACKEND_USERNAME', '') +CELERY_RESULT_BACKEND_PWD = os.environ.get('CELERY_RESULT_BACKEND_PWD', '') +CELERY_RESULT_BACKEND_HOST = os.environ.get('CELERY_RESULT_BACKEND_HOST', '') +CELERY_RESULT_BACKEND_PORT = os.environ.get('CELERY_RESULT_BACKEND_PORT', '') +CELERY_RESULT_BACKEND_DB = os.environ.get('CELERY_RESULT_BACKEND_DB', '') CELERY_RESULT_BACKEND = ''.join([CELERY_RESULT_BACKEND_PROTOCOL, CELERY_RESULT_BACKEND_USERNAME, ':', CELERY_RESULT_BACKEND_PWD, '@', CELERY_RESULT_BACKEND_HOST, ':', CELERY_RESULT_BACKEND_PORT, From a0db8be2d28a9ed111d010aa5245d85edf0f5996 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Tue, 21 Mar 2017 13:45:19 -0500 Subject: [PATCH 074/520] Defaulting to bogus config --- designsafe/celery_settings.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/designsafe/celery_settings.py b/designsafe/celery_settings.py index bd585e340f..cc7dc7c338 100644 --- a/designsafe/celery_settings.py +++ b/designsafe/celery_settings.py @@ -3,22 +3,22 @@ """ import os #BROKER_URL = 'redis://redis:6379/0' -BROKER_URL_PROTOCOL = os.environ.get('BROKER_URL_PROTOCOL', '') -BROKER_URL_USERNAME = os.environ.get('BROKER_URL_USERNAME', '') -BROKER_URL_PWD = os.environ.get('BROKER_URL_PWD', '') -BROKER_URL_HOST = os.environ.get('BROKER_URL_HOST', '') -BROKER_URL_PORT = os.environ.get('BROKER_URL_PORT', '') -BROKER_URL_VHOST = os.environ.get('BROKER_URL_VHOST', '') +BROKER_URL_PROTOCOL = os.environ.get('BROKER_URL_PROTOCOL', 'amqp://') +BROKER_URL_USERNAME = os.environ.get('BROKER_URL_USERNAME', 'username') +BROKER_URL_PWD = os.environ.get('BROKER_URL_PWD', 'pwd') +BROKER_URL_HOST = os.environ.get('BROKER_URL_HOST', 'localhost') +BROKER_URL_PORT = os.environ.get('BROKER_URL_PORT', '123') +BROKER_URL_VHOST = os.environ.get('BROKER_URL_VHOST', 'vhost') BROKER_URL = ''.join([BROKER_URL_PROTOCOL, BROKER_URL_USERNAME, ':', BROKER_URL_PWD, '@', BROKER_URL_HOST, ':', BROKER_URL_PORT, '/', BROKER_URL_VHOST]) #BROKER_URL = 'amqp://designsafe:pwd@rabbitmq:5672//' -CELERY_RESULT_BACKEND_PROTOCOL = os.environ.get('CELERY_RESULT_BACKEND_PROTOCOL', '') -CELERY_RESULT_BACKEND_USERNAME = os.environ.get('CELERY_RESULT_BACKEND_USERNAME', '') -CELERY_RESULT_BACKEND_PWD = os.environ.get('CELERY_RESULT_BACKEND_PWD', '') -CELERY_RESULT_BACKEND_HOST = os.environ.get('CELERY_RESULT_BACKEND_HOST', '') -CELERY_RESULT_BACKEND_PORT = os.environ.get('CELERY_RESULT_BACKEND_PORT', '') -CELERY_RESULT_BACKEND_DB = os.environ.get('CELERY_RESULT_BACKEND_DB', '') +CELERY_RESULT_BACKEND_PROTOCOL = os.environ.get('CELERY_RESULT_BACKEND_PROTOCOL', 'redis://') +CELERY_RESULT_BACKEND_USERNAME = os.environ.get('CELERY_RESULT_BACKEND_USERNAME', 'username') +CELERY_RESULT_BACKEND_PWD = os.environ.get('CELERY_RESULT_BACKEND_PWD', 'pwd') +CELERY_RESULT_BACKEND_HOST = os.environ.get('CELERY_RESULT_BACKEND_HOST', 'localhost') +CELERY_RESULT_BACKEND_PORT = os.environ.get('CELERY_RESULT_BACKEND_PORT', '1234') +CELERY_RESULT_BACKEND_DB = os.environ.get('CELERY_RESULT_BACKEND_DB', '0') CELERY_RESULT_BACKEND = ''.join([CELERY_RESULT_BACKEND_PROTOCOL, CELERY_RESULT_BACKEND_USERNAME, ':', CELERY_RESULT_BACKEND_PWD, '@', CELERY_RESULT_BACKEND_HOST, ':', CELERY_RESULT_BACKEND_PORT, From f86e1e79402f04ce96b55395d4cc9ac3d0c7e943 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Tue, 21 Mar 2017 13:53:32 -0500 Subject: [PATCH 075/520] file picker --- .../static/scripts/ng-designsafe/directives/my-data-browser.js | 1 + 1 file changed, 1 insertion(+) diff --git a/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js b/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js index df73013eff..e0e3ba1740 100644 --- a/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js +++ b/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js @@ -4,6 +4,7 @@ function (DataBrowserService, UserService, FileListing, DataService) { restrict: 'E', scope: { filepicker: '@filepicker', + selected: '=selected', }, templateUrl: '/static/scripts/ng-designsafe/html/directives/my-data-browser.html', controller: function ($scope) { From eae810c843334d3d9e80882c1781272e46a1271a Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Tue, 21 Mar 2017 16:58:29 -0500 Subject: [PATCH 076/520] data browser --- .../directives/my-data-browser.js | 23 +++++++++++++++++-- .../html/directives/my-data-browser.html | 2 +- docker-compose-dev.yml | 10 ++++---- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js b/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js index e0e3ba1740..c7a516552a 100644 --- a/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js +++ b/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js @@ -18,7 +18,7 @@ function (DataBrowserService, UserService, FileListing, DataService) { loading: true }; - DataBrowserService.browse({system: 'designsafe.storage.default', path: 'jmeiring'}).then(function (resp) { + DataBrowserService.browse({system: 'designsafe.storage.default'}).then(function (resp) { $scope.data.busyListingPage = false; $scope.data.filesListing = resp; $scope.data.loading = false; @@ -26,9 +26,28 @@ function (DataBrowserService, UserService, FileListing, DataService) { $scope.data.loading = false; }); - + $scope.selectRow = function (file) { + if (file.type !== 'folder' && file.type !== 'dir' && $scope.filepicker) { + $scope.data.filesListing.children.forEach(function (d) { + d.selected = false; + }) + file.selected = true; + } + }; $scope.getFileIcon = DataService.getIcon; + $scope.browseTrail = function($event, index){ + $event.stopPropagation(); + $event.preventDefault(); + if ($scope.data.dirPath.length <= index+1){ + return; + } + $scope.browseFile({type: 'dir', + system: $scope.data.filesListing.system, + resource: $scope.data.filesListing.resource, + path: $scope.data.dirPath.slice(0, index+1).join('/')}); + }; + $scope.browseFile = function(file){ if (file.type !== 'folder' && file.type !== 'dir'){ return; diff --git a/designsafe/static/scripts/ng-designsafe/html/directives/my-data-browser.html b/designsafe/static/scripts/ng-designsafe/html/directives/my-data-browser.html index 48c8a6060c..5aac7a2450 100644 --- a/designsafe/static/scripts/ng-designsafe/html/directives/my-data-browser.html +++ b/designsafe/static/scripts/ng-designsafe/html/directives/my-data-browser.html @@ -22,7 +22,7 @@
    +
    -->
    @@ -58,7 +58,7 @@

    Quick Links

    Account Profile
  • - Data Depot + Data Depot {{storage_count | bytes}} used
  • Workspace diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 78096166c6..7138fdd3a4 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -30,11 +30,11 @@ django: env_file: designsafe.env environment: - DJANGO_SETTINGS_MODULE=designsafe.http_debug_settings - - DATABASE_HOST=mysql - - DATABASE_NAME=DS_DEV - - DATABASE_PORT=3306 - - DATABASE_USER=DS_DEV - - DATABASE_PASSWORD=DS_DEV + # - DATABASE_HOST=mysql + # - DATABASE_NAME=DS_DEV + # - DATABASE_PORT=3306 + # - DATABASE_USER=DS_DEV + # - DATABASE_PASSWORD=DS_DEV - DS_LOCAL_DEV=True links: - redis:redis From 1ea1d3db51fbc0fb0c922e114ae8dc9ff7baf269 Mon Sep 17 00:00:00 2001 From: Marjo Poindexter Date: Wed, 22 Mar 2017 14:29:09 -0500 Subject: [PATCH 078/520] add setfacl when creating directory --- designsafe/apps/api/agave/filemanager/agave.py | 1 + designsafe/apps/api/agave/views.py | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/designsafe/apps/api/agave/filemanager/agave.py b/designsafe/apps/api/agave/filemanager/agave.py index 8bb93faefa..12ff122d9c 100644 --- a/designsafe/apps/api/agave/filemanager/agave.py +++ b/designsafe/apps/api/agave/filemanager/agave.py @@ -106,6 +106,7 @@ def list_permissions(self, system, file_path): def mkdir(self, system, file_path, dir_name): f = BaseFileResource(self._ag, system, file_path) resp = f.mkdir(dir_name) + subprocess.call(['setfacl', '-m', 'd:u:tg458981:rwX,u:' + file_path.split('/')[1] + ':rwX', '/corral-repl/tacc/NHERI/shared' + file_path + '/' + dir_name]) reindex_agave.apply_async(kwargs = {'username': 'ds_admin', 'file_id': '{}/{}'.format(system, file_path)}) return resp diff --git a/designsafe/apps/api/agave/views.py b/designsafe/apps/api/agave/views.py index e397e507e7..62ee441a39 100644 --- a/designsafe/apps/api/agave/views.py +++ b/designsafe/apps/api/agave/views.py @@ -4,7 +4,6 @@ import logging import json import os -import subprocess import re import chardet from django.core.urlresolvers import reverse @@ -310,7 +309,6 @@ def put(self, request, file_mgr_name, system_id, file_path): dir_name = re.sub('\_+', '_', dir_name) new_dir = fm.mkdir(system_id, file_path, dir_name) - subprocess.call(['setfacl', '-m', 'd:u:tg458981:rwX,u:' + request.user.username + ':rwX', '/corral-repl/tacc/NHERI/shared' + file_path + '/' + dir_name]) metrics.info('Data Depot', extra = { 'user': request.user.username, From 521c41ab009e0c3787e4946dd5b71f383b1a3572 Mon Sep 17 00:00:00 2001 From: Marjo Poindexter Date: Wed, 22 Mar 2017 15:13:56 -0500 Subject: [PATCH 079/520] move where setfacl is called duting mkdir --- designsafe/apps/api/agave/filemanager/agave.py | 1 - designsafe/apps/api/agave/views.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/designsafe/apps/api/agave/filemanager/agave.py b/designsafe/apps/api/agave/filemanager/agave.py index 12ff122d9c..8bb93faefa 100644 --- a/designsafe/apps/api/agave/filemanager/agave.py +++ b/designsafe/apps/api/agave/filemanager/agave.py @@ -106,7 +106,6 @@ def list_permissions(self, system, file_path): def mkdir(self, system, file_path, dir_name): f = BaseFileResource(self._ag, system, file_path) resp = f.mkdir(dir_name) - subprocess.call(['setfacl', '-m', 'd:u:tg458981:rwX,u:' + file_path.split('/')[1] + ':rwX', '/corral-repl/tacc/NHERI/shared' + file_path + '/' + dir_name]) reindex_agave.apply_async(kwargs = {'username': 'ds_admin', 'file_id': '{}/{}'.format(system, file_path)}) return resp diff --git a/designsafe/apps/api/agave/views.py b/designsafe/apps/api/agave/views.py index 62ee441a39..263d7ca497 100644 --- a/designsafe/apps/api/agave/views.py +++ b/designsafe/apps/api/agave/views.py @@ -308,7 +308,7 @@ def put(self, request, file_mgr_name, system_id, file_path): dir_name = re.sub('[^a-zA-Z\_\- ]', '_', dir_name) dir_name = re.sub('\_+', '_', dir_name) new_dir = fm.mkdir(system_id, file_path, dir_name) - + subprocess.call(['setfacl', '-m', 'd:u:tg458981:rwX,u:' + request.user.username + ':rwX', '/corral-repl/tacc/NHERI/shared' + file_path + '/' + dir_name]) metrics.info('Data Depot', extra = { 'user': request.user.username, From f38bc9b9e3eae6bd10b573e9f9074f3209a9781d Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 22 Mar 2017 15:27:04 -0500 Subject: [PATCH 080/520] Removing unused redis config when creating conn string --- designsafe/celery_settings.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designsafe/celery_settings.py b/designsafe/celery_settings.py index cc7dc7c338..37aa7b9357 100644 --- a/designsafe/celery_settings.py +++ b/designsafe/celery_settings.py @@ -19,8 +19,7 @@ CELERY_RESULT_BACKEND_HOST = os.environ.get('CELERY_RESULT_BACKEND_HOST', 'localhost') CELERY_RESULT_BACKEND_PORT = os.environ.get('CELERY_RESULT_BACKEND_PORT', '1234') CELERY_RESULT_BACKEND_DB = os.environ.get('CELERY_RESULT_BACKEND_DB', '0') -CELERY_RESULT_BACKEND = ''.join([CELERY_RESULT_BACKEND_PROTOCOL, CELERY_RESULT_BACKEND_USERNAME, - ':', CELERY_RESULT_BACKEND_PWD, '@', +CELERY_RESULT_BACKEND = ''.join([CELERY_RESULT_BACKEND_PROTOCOL, CELERY_RESULT_BACKEND_HOST, ':', CELERY_RESULT_BACKEND_PORT, '/', CELERY_RESULT_BACKEND_DB]) From 243c7df30d36a5d2ba28555c28b077538e9ccc3f Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 22 Mar 2017 15:54:16 -0500 Subject: [PATCH 081/520] Updating celery log string to avoid keyErrors --- designsafe/celery_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designsafe/celery_settings.py b/designsafe/celery_settings.py index 37aa7b9357..6721f5fa3b 100644 --- a/designsafe/celery_settings.py +++ b/designsafe/celery_settings.py @@ -28,5 +28,5 @@ CELERY_RESULT_SERIALIZER = 'json' CELERYD_HIJACK_ROOT_LOGGER = False CELERYD_LOG_FORMAT = '[DJANGO] $(processName)s %(levelname)s %(asctime)s %(module)s '\ - '%(name)s.%(funcName)s:%(lineno)s: [%(task_name)s(%(task_id)s)]%(message)s' + '%(name)s.%(funcName)s:%(lineno)s: %(message)s' #CELERY_ANOTATIONS = {'designsafe.apps.api.tasks.reindex_agave': {'time_limit': 60 * 15}} From 0d1958798fbe1947785d4234efeef2c896ddd956 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Wed, 22 Mar 2017 17:09:26 -0500 Subject: [PATCH 082/520] modal and import from data depot working' --- .../designsafe/apps/geo/html/db-modal.html | 6 +- .../apps/geo/scripts/build/bundle.js | 124 +++++++++++------- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../apps/geo/scripts/controllers/db-modal.js | 3 +- .../apps/geo/scripts/controllers/index.js | 4 +- .../geo/scripts/controllers/map-sidebar.js | 24 +++- .../templates/designsafe/apps/geo/test.html | 17 ++- .../directives/my-data-browser.js | 41 +++--- .../html/directives/my-data-browser.html | 2 +- docker-compose-dev.yml | 10 +- 10 files changed, 148 insertions(+), 85 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/db-modal.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/db-modal.html index 569193581b..9a5460566d 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/db-modal.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/db-modal.html @@ -2,10 +2,10 @@
  • diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index b20a7bbfaf..c9133a54e9 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -63,7 +63,7 @@ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 9); +/******/ return __webpack_require__(__webpack_require__.s = 10); /******/ }) /************************************************************************/ /******/ ([ @@ -81,12 +81,16 @@ var _mapSidebar = __webpack_require__(4); var _mapSidebar2 = _interopRequireDefault(_mapSidebar); +var _dbModal = __webpack_require__(3); + +var _dbModal2 = _interopRequireDefault(_dbModal); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var mod = angular.module('ds.geo.controllers', []); mod.controller('MapSidebarCtrl', _mapSidebar2.default); - +mod.controller('DBModalCtrl', _dbModal2.default); exports.default = mod; /***/ }), @@ -122,7 +126,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _geoStateService = __webpack_require__(11); +var _geoStateService = __webpack_require__(8); var _geoStateService2 = _interopRequireDefault(_geoStateService); @@ -160,12 +164,13 @@ var DBModalCtrl = function () { this.$scope = $scope; this.$uibModalInstance = $uibModalInstance; + this.selected = null; } _createClass(DBModalCtrl, [{ key: 'ok', value: function ok() { - this.$uibModalInstance.close(); + this.$uibModalInstance.close(this.selected); } }, { key: 'cancel', @@ -204,7 +209,7 @@ var _dbModal = __webpack_require__(3); var _dbModal2 = _interopRequireDefault(_dbModal); -var _geoUtils = __webpack_require__(8); +var _geoUtils = __webpack_require__(9); var GeoUtils = _interopRequireWildcard(_geoUtils); @@ -215,8 +220,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var MapSidebarCtrl = function () { - MapSidebarCtrl.$inject = ["$scope", "$window", "$timeout", "$uibModal"]; - function MapSidebarCtrl($scope, $window, $timeout, $uibModal) { + MapSidebarCtrl.$inject = ["$scope", "$window", "$timeout", "$uibModal", "DataService", "$http"]; + function MapSidebarCtrl($scope, $window, $timeout, $uibModal, DataService, $http) { 'ngInject'; var _this = this; @@ -228,6 +233,8 @@ var MapSidebarCtrl = function () { this.$timeout = $timeout; this.$window = $window; this.$uibModal = $uibModal; + this.DataService = DataService; + this.$http = $http; angular.element('header').hide(); angular.element('nav').hide(); angular.element('footer').hide(); @@ -236,6 +243,7 @@ var MapSidebarCtrl = function () { //method binding for callback, sigh... this.local_file_selected = this.local_file_selected.bind(this); + this.open_db_modal = this.open_db_modal.bind(this); var streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' @@ -342,10 +350,14 @@ var MapSidebarCtrl = function () { }, { key: 'open_db_modal', value: function open_db_modal() { - this.$uibModal.open({ + var _this2 = this; + + var modal = this.$uibModal.open({ templateUrl: "/static/designsafe/apps/geo/html/db-modal.html", - controller: _dbModal2.default, - controllerAs: 'vm' + controller: "DBModalCtrl as vm" + }); + modal.result.then(function (f) { + _this2.load_from_data_depot(f); }); } }, { @@ -391,10 +403,25 @@ var MapSidebarCtrl = function () { console.log("drag_feature_success", ev, data, lg); // lg.feature_group.getLayers().splicer(idx, 1); } + }, { + key: 'load_from_data_depot', + value: function load_from_data_depot(f) { + var _this3 = this; + + this.$http.get(f.agaveUrl()).then(function (resp) { + console.log(f, resp.data); + var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); + L.geoJSON(resp.data).getLayers().forEach(function (l) { + lg.feature_group.addLayer(l); + }); + _this3.layer_groups.push(lg); + _this3.map.addLayer(lg.feature_group); + }); + } }, { key: 'local_file_selected', value: function local_file_selected(ev) { - var _this2 = this; + var _this4 = this; var file = ev.target.files[0]; console.log(GeoUtils); @@ -414,8 +441,8 @@ var MapSidebarCtrl = function () { l.getLayers().forEach(function (d) { lg.feature_group.addLayer(d); }); - _this2.layer_groups.push(lg); - _this2.map.addLayer(lg.feature_group); + _this4.layer_groups.push(lg); + _this4.map.addLayer(lg.feature_group); })(); } else if (ext === 'gpx') { var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); @@ -424,8 +451,8 @@ var MapSidebarCtrl = function () { var l = omnivore.gpx.parse(e.target.result); lg.feature_group.addLayer(l); - _this2.layer_groups.push(lg); - _this2.map.addLayer(lg.feature_group); + _this4.layer_groups.push(lg); + _this4.map.addLayer(lg.feature_group); } else { var json = JSON.parse(e.target.result); @@ -438,29 +465,29 @@ var MapSidebarCtrl = function () { L.geoJSON(f).getLayers().forEach(function (l) { lg.feature_group.addLayer(l); }); - _this2.layer_groups.push(lg); - _this2.map.addLayer(lg.feature_group); + _this4.layer_groups.push(lg); + _this4.map.addLayer(lg.feature_group); }); } else { var _lg = new _layer_group2.default("New Group", new L.FeatureGroup()); L.geoJSON(json).getLayers().forEach(function (l) { - _this2.layer_groups[0].feature_group.addLayer(l); + _this4.layer_groups[0].feature_group.addLayer(l); }); - _this2.layer_groups.push(_lg); - _this2.map.addLayer(_lg.feature_group); + _this4.layer_groups.push(_lg); + _this4.map.addLayer(_lg.feature_group); } }; var bounds = []; - _this2.layer_groups.forEach(function (lg) { + _this4.layer_groups.forEach(function (lg) { bounds.push(lg.feature_group.getBounds()); }); - _this2.map.fitBounds(bounds); + _this4.map.fitBounds(bounds); }; } }, { key: 'load_image', value: function load_image(ev) { - var _this3 = this; + var _this5 = this; var files = ev.target.files; for (var i = 0; i < files.length; i++) { @@ -482,7 +509,7 @@ var MapSidebarCtrl = function () { lon = (lon[0] + lon[1] / 60 + lon[2] / 3600) * (lonRef == "W" ? -1 : 1); //Send the coordinates to your map - _this3.active_layer_group.AddMarker(lat, lon); + _this5.active_layer_group.AddMarker(lat, lon); }; } } @@ -616,6 +643,29 @@ exports.default = MapProject; "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var GeoStateService = function GeoStateService($scope, $state) { + _classCallCheck(this, GeoStateService); + + this.$scope = $scope; + this.$state = $state; + this.last_db_path = null; +}; + +exports.default = GeoStateService; + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + Object.defineProperty(exports, "__esModule", { value: true }); @@ -625,7 +675,7 @@ function get_file_extension(fname) { } /***/ }), -/* 9 */ +/* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -667,30 +717,6 @@ mod.config(config); exports.default = mod; -/***/ }), -/* 10 */, -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var GeoStateService = function GeoStateService($scope, $state) { - _classCallCheck(this, GeoStateService); - - this.$scope = $scope; - this.$state = $state; - this.last_db_path = null; -}; - -exports.default = GeoStateService; - /***/ }) /******/ ]); //# sourceMappingURL=bundle.js.map \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 8d5b3a1e85..021002f2df 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap e7ba579571c6a1efc632","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js"],"names":["mod","angular","module","controller","directive","service","DBModalCtrl","$scope","$uibModalInstance","dismiss","$timeout","$window","$uibModal","element","hide","primary_color","secondary_color","streets","L","tileLayer","maxZoom","satellite","control","layers","basemaps","addTo","map","zoomControl","setPosition","invalidateSize","layer_groups","active_layer_group","current_layer","$apply","on","e","object","options","color","fillColor","fillOpacity","feature_group","addLayer","dc","Control","position","draw","circle","edit","featureGroup","remove","lg","push","length","select_active_layer_group","removeLayer","splice","i","show","removeControl","drawControl","add_draw_controls","active","open","templateUrl","controllerAs","$","click","f","Marker","Polygon","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","getBounds","src_lg","getLayers","console","log","file","ev","target","ext","GeoUtils","get_file_extension","reader","FileReader","readAsText","onload","l","omnivore","kml","parse","result","forEach","d","gpx","json","JSON","ds_map","features","geoJSON","bounds","files","readAsArrayBuffer","exif","EXIF","readFromBinaryFile","lat","GPSLatitude","lonRef","GPSLongitudeRef","lon","setStyle","out","map_title","label","blob","Blob","a","document","createElement","href","url","textContent","restrict","scope","handler","link","LayerGroup","show_contents","MapProject","name","fname","split","pop","requires","config","$stateProvider","$uibTooltipProvider","state","resolve","auth","$state","GeoStateService"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAF,IAAIG,UAAJ,CAAe,gBAAf;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EAA4B;AAC1BjB,SAAK,EADqB;AAAA;AAG1B3H,gBAAY,eAHc;AAI1B6I,YAAS;AACPC,YAAM,gBAAY;AAChB,eAAO,IAAP;AACD;AAHM;AAJiB,GAA5B;;AAWA;AACAH,KAAA;AAED;;AAED9I,IAAI4I,MAAJ,CAAWA,MAAX;;;;;;;;;;;;;;;;;;ACvB+B;AAAA;;AAC3B,OAAKrI,MAAL,GAAcA,MAAd;AACA,OAAK2I,MAAL,GAAcA,MAAd;AACA;AACD,C;;kBANkBC,S","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 9);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e7ba579571c6a1efc632","import MapSidebarCtrl from './map-sidebar';\n\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\n\nmod.directive('customOnChange', customOnChange);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\nimport GeoStateService from './geo-state-service';\n\n\nlet mod = angular.module('ds.geo.services', []);\nmod.service('GeoStateService', GeoStateService);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","export default class DBModalCtrl {\n\n constructor ($scope, $uibModalInstance) {\n 'ngInject';\n this.$scope = $scope;\n this.$uibModalInstance = $uibModalInstance;\n }\n\n ok () {\n this.$uibModalInstance.close();\n };\n\n cancel () {\n this.$uibModalInstance.dismiss('cancel');\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: DBModalCtrl,\n controllerAs: 'vm'\n });\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n console.log(GeoUtils);\n\n let ext = GeoUtils.get_file_extension(file.name);\n console.log(ext);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n if (ext === 'kml') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.kml.parse(e.target.result);\n // debugger\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else if (ext === 'gpx') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.gpx.parse(e.target.result);\n lg.feature_group.addLayer(l);\n\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else {\n let json = JSON.parse(e.target.result);\n\n // we add in a field into the json blob when saved. If it is such,\n // handle potential multiple layers.\n if (json.ds_map) {\n // each feature in the collection represents a layer\n json.features.forEach( (f) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(f).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n else {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json).getLayers().forEach( (l) => {\n this.layer_groups[0].feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n }\n\n };\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n this.active_layer_group.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js","export default class GeoStateService {\n\n constructor ($scope, $state) {\n this.$scope = $scope;\n this.$state = $state;\n this.last_db_path = null;\n }\n\n \n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 6fd2e4a7eaa7cc2e13fa","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","service","DBModalCtrl","$scope","$uibModalInstance","selected","dismiss","$timeout","$window","$uibModal","DataService","$http","element","hide","primary_color","secondary_color","open_db_modal","streets","L","tileLayer","maxZoom","satellite","control","layers","basemaps","addTo","map","zoomControl","setPosition","invalidateSize","layer_groups","active_layer_group","current_layer","$apply","on","e","object","options","color","fillColor","fillOpacity","feature_group","addLayer","dc","Control","position","draw","circle","edit","featureGroup","remove","lg","push","length","select_active_layer_group","removeLayer","splice","i","show","removeControl","drawControl","add_draw_controls","active","modal","result","then","f","$","click","Marker","Polygon","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","getBounds","src_lg","getLayers","console","log","get","agaveUrl","geoJSON","resp","data","l","file","ev","target","ext","GeoUtils","get_file_extension","reader","FileReader","readAsText","onload","omnivore","kml","parse","forEach","d","gpx","json","JSON","ds_map","features","bounds","files","readAsArrayBuffer","exif","EXIF","readFromBinaryFile","lat","GPSLatitude","lonRef","GPSLongitudeRef","lon","setStyle","out","map_title","label","blob","Blob","a","document","createElement","href","url","textContent","restrict","scope","handler","link","LayerGroup","show_contents","MapProject","name","GeoStateService","$state","last_db_path","fname","split","pop","requires","config","$stateProvider","$uibTooltipProvider","state","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;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ourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 10);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 6fd2e4a7eaa7cc2e13fa","import MapSidebarCtrl from './map-sidebar';\nimport DBModalCtrl from './db-modal';\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\nmod.controller('DBModalCtrl', DBModalCtrl);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\n\nmod.directive('customOnChange', customOnChange);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\nimport GeoStateService from './geo-state-service';\n\n\nlet mod = angular.module('ds.geo.services', []);\nmod.service('GeoStateService', GeoStateService);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","export default class DBModalCtrl {\n\n constructor ($scope, $uibModalInstance) {\n 'ngInject';\n this.$scope = $scope;\n this.$uibModalInstance = $uibModalInstance;\n this.selected = null;\n }\n\n ok () {\n this.$uibModalInstance.close(this.selected);\n };\n\n cancel () {\n this.$uibModalInstance.dismiss('cancel');\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal, DataService, $http) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n this.DataService = DataService;\n this.$http = $http;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n this.open_db_modal = this.open_db_modal.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n let modal = this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: \"DBModalCtrl as vm\",\n });\n modal.result.then( (f) => {this.load_from_data_depot(f);});\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n load_from_data_depot(f) {\n this.$http.get(f.agaveUrl()).then((resp) => {\n console.log(f, resp.data)\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(resp.data).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n console.log(GeoUtils);\n\n let ext = GeoUtils.get_file_extension(file.name);\n console.log(ext);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n if (ext === 'kml') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.kml.parse(e.target.result);\n // debugger\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else if (ext === 'gpx') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.gpx.parse(e.target.result);\n lg.feature_group.addLayer(l);\n\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else {\n let json = JSON.parse(e.target.result);\n\n // we add in a field into the json blob when saved. If it is such,\n // handle potential multiple layers.\n if (json.ds_map) {\n // each feature in the collection represents a layer\n json.features.forEach( (f) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(f).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n else {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json).getLayers().forEach( (l) => {\n this.layer_groups[0].feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n }\n\n };\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n this.active_layer_group.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","export default class GeoStateService {\n\n constructor ($scope, $state) {\n this.$scope = $scope;\n this.$state = $state;\n this.last_db_path = null;\n }\n\n \n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js index 329059afd4..e4d5bb0ca5 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js @@ -4,10 +4,11 @@ export default class DBModalCtrl { 'ngInject'; this.$scope = $scope; this.$uibModalInstance = $uibModalInstance; + this.selected = null; } ok () { - this.$uibModalInstance.close(); + this.$uibModalInstance.close(this.selected); }; cancel () { diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js index 3c556e0b85..aab9f720da 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js @@ -1,7 +1,7 @@ import MapSidebarCtrl from './map-sidebar'; - +import DBModalCtrl from './db-modal'; let mod = angular.module('ds.geo.controllers', []); mod.controller('MapSidebarCtrl', MapSidebarCtrl); - +mod.controller('DBModalCtrl', DBModalCtrl); export default mod; diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index f337161335..bfc0e1b7df 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -5,13 +5,15 @@ import * as GeoUtils from '../utils/geo-utils'; export default class MapSidebarCtrl { - constructor ($scope, $window, $timeout, $uibModal) { + constructor ($scope, $window, $timeout, $uibModal, DataService, $http) { 'ngInject'; this.$scope = $scope; this.LGeo = $window.LGeo; this.$timeout = $timeout; this.$window = $window; this.$uibModal = $uibModal; + this.DataService = DataService; + this.$http = $http; angular.element('header').hide(); angular.element('nav').hide(); angular.element('footer').hide(); @@ -20,6 +22,7 @@ export default class MapSidebarCtrl { //method binding for callback, sigh... this.local_file_selected = this.local_file_selected.bind(this); + this.open_db_modal = this.open_db_modal.bind(this); let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' @@ -120,11 +123,11 @@ export default class MapSidebarCtrl { } open_db_modal () { - this.$uibModal.open({ + let modal = this.$uibModal.open({ templateUrl: "/static/designsafe/apps/geo/html/db-modal.html", - controller: DBModalCtrl, - controllerAs: 'vm' + controller: "DBModalCtrl as vm", }); + modal.result.then( (f) => {this.load_from_data_depot(f);}); } open_file_dialog () { @@ -158,7 +161,6 @@ export default class MapSidebarCtrl { let feature = src_lg.feature_group.getLayers()[data.idx]; src_lg.feature_group.removeLayer(feature); lg.feature_group.addLayer(feature); - } drop_feature_success (ev, data, lg) { @@ -166,6 +168,18 @@ export default class MapSidebarCtrl { // lg.feature_group.getLayers().splicer(idx, 1); } + load_from_data_depot(f) { + this.$http.get(f.agaveUrl()).then((resp) => { + console.log(f, resp.data) + let lg = new LayerGroup("New Group", new L.FeatureGroup()); + L.geoJSON(resp.data).getLayers().forEach( (l) => { + lg.feature_group.addLayer(l); + }); + this.layer_groups.push(lg); + this.map.addLayer(lg.feature_group); + }); + } + local_file_selected (ev) { let file = ev.target.files[0]; console.log(GeoUtils); diff --git a/designsafe/apps/geo/templates/designsafe/apps/geo/test.html b/designsafe/apps/geo/templates/designsafe/apps/geo/test.html index 405fed3b9c..bada42aa3e 100644 --- a/designsafe/apps/geo/templates/designsafe/apps/geo/test.html +++ b/designsafe/apps/geo/templates/designsafe/apps/geo/test.html @@ -11,14 +11,18 @@ {% block content %} -
    +
    - +
    {#
    #}
    + + + + {% addtoblock "js" %} @@ -38,7 +42,14 @@ - + {% endaddtoblock %} diff --git a/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js b/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js index c7a516552a..6b45a7a50a 100644 --- a/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js +++ b/designsafe/static/scripts/ng-designsafe/directives/my-data-browser.js @@ -3,35 +3,46 @@ function (DataBrowserService, UserService, FileListing, DataService) { return { restrict: 'E', scope: { - filepicker: '@filepicker', - selected: '=selected', + picker: '@picker', + selected: '=selected' }, templateUrl: '/static/scripts/ng-designsafe/html/directives/my-data-browser.html', - controller: function ($scope) { - console.log($scope.filepicker); - }, link: function ($scope, element, attrs) { - console.log($scope.filepicker); + console.log($scope.picker); + $scope.picker = $scope.picker || 'all'; $scope.data = { busyListingPage: true, wants: false, - loading: true + loading: true, + systemsList: [], + system: 'designsafe.storage.default', + dirPath: [], + filePath: '', }; + $scope.selected = null; - DataBrowserService.browse({system: 'designsafe.storage.default'}).then(function (resp) { - $scope.data.busyListingPage = false; + DataBrowserService.browse({system: $scope.data.system}).then(function (resp) { $scope.data.filesListing = resp; $scope.data.loading = false; + $scope.data.filePath = $scope.data.filesListing.path; + $scope.data.dirPath = $scope.data.filePath.split('/'); }, function (err) { $scope.data.loading = false; }); - $scope.selectRow = function (file) { - if (file.type !== 'folder' && file.type !== 'dir' && $scope.filepicker) { - $scope.data.filesListing.children.forEach(function (d) { - d.selected = false; - }) + $scope.selectRow = function (file, idx) { + $scope.data.filesListing.children.forEach(function (d) { + d.selected = false; + }); + if ($scope.picker === 'file' && file.type !== 'folder' && file.type !== 'dir') { + file.selected = true; + $scope.selected = file; + } else if ($scope.picker === 'folder' && (file.type !== 'folder' || file.type !== 'dir')) { + file.selected = true; + $scope.selected = file; + } else if ($scope.picker === 'all') { file.selected = true; + $scope.selected = file; } }; $scope.getFileIcon = DataService.getIcon; @@ -60,7 +71,7 @@ function (DataBrowserService, UserService, FileListing, DataService) { if ($scope.data.filesListing.children.length > 0){ $scope.data.filePath = $scope.data.filesListing.path; $scope.data.dirPath = $scope.data.filePath.split('/'); - $scope.browser.listing = $scope.data.filesListing; + // $scope.browser.listing = $scope.data.filesListing; } $scope.data.loading = false; }, function(err){ diff --git a/designsafe/static/scripts/ng-designsafe/html/directives/my-data-browser.html b/designsafe/static/scripts/ng-designsafe/html/directives/my-data-browser.html index 5aac7a2450..21411be0ad 100644 --- a/designsafe/static/scripts/ng-designsafe/html/directives/my-data-browser.html +++ b/designsafe/static/scripts/ng-designsafe/html/directives/my-data-browser.html @@ -22,7 +22,7 @@ @@ -167,7 +167,7 @@
    - @@ -178,7 +178,7 @@
    - diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css index d1a70e8990..e53892a7d8 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -130,8 +130,8 @@ } #top_toolbar { - height: 2em; - border-bottom: 1px solid #d2d2d2; + /*height: 2em;*/ + /*border-bottom: 1px solid #d2d2d2;*/ background-color: #d2d2d2; } @@ -164,7 +164,7 @@ color: #505050; margin-top: 0px; background-color: #f2f5dc; - padding: 5px; + /*padding: 5px;*/ } .dropdown-menu { From 1c0bff5964e4b9fbfc4dbb76ca2303e3a0560b9e Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Thu, 23 Mar 2017 09:43:55 -0500 Subject: [PATCH 084/520] icons --- .../apps/geo/static/designsafe/apps/geo/html/map.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 262b4a1601..4e0a23ed29 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -1,9 +1,9 @@
    From 367bd5f997ae67fed84e0a2593de38117ac8e6d1 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Thu, 23 Mar 2017 10:42:51 -0500 Subject: [PATCH 085/520] changed some css --- .../apps/dashboard/html/dashboard.html | 23 +++++-------------- .../apps/dashboard/styles/dashboard.css | 10 ++++---- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/html/dashboard.html b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/html/dashboard.html index b98f67280a..9b67f5dedf 100644 --- a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/html/dashboard.html +++ b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/html/dashboard.html @@ -1,6 +1,6 @@ - +
    @@ -58,7 +47,7 @@

    Quick Links

    Account Profile
  • - Data Depot {{storage_count | bytes}} used + Data Depot
  • Workspace diff --git a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/styles/dashboard.css b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/styles/dashboard.css index 0af7c905c8..d3ade2a352 100644 --- a/designsafe/apps/dashboard/static/designsafe/apps/dashboard/styles/dashboard.css +++ b/designsafe/apps/dashboard/static/designsafe/apps/dashboard/styles/dashboard.css @@ -33,7 +33,7 @@ display: block; margin-bottom: 25px; overflow: hidden; - padding: 10px; + /*padding: 10px;*/ } .dashboard-stat .visual { width: 80px; @@ -48,13 +48,13 @@ } .dashboard-stat.blue { - background-color: #3598dc; + background-color: #2f89c7; } .dashboard-stat.red { - background-color: #e7505a; + background-color: #cd4750; } .dashboard-stat.green { - background-color: #2daa70; + background-color: #2daaa4; } .dashboard-stat.purple { background-color: #8E44AD; @@ -67,7 +67,7 @@ color: #FFFFFF; } .dashboard-stat .details .number { - padding-top: 25px; + padding-top: 15px; text-align: right; font-size: 50px; line-height: 45px; From 43915155aa3117eeeccc2308905d03c1aa213146 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 23 Mar 2017 12:12:38 -0500 Subject: [PATCH 086/520] Updating celery log format and WS config to connect to remote redis DB --- designsafe/common_settings.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designsafe/common_settings.py b/designsafe/common_settings.py index 26045fc6fc..74d2f804b7 100644 --- a/designsafe/common_settings.py +++ b/designsafe/common_settings.py @@ -492,7 +492,9 @@ WSGI_APPLICATION = 'ws4redis.django_runserver.application' WEBSOCKET_URL = '/ws/' WS4REDIS_CONNECTION = { - 'host': 'redis', + 'host': os.environ.get('WS_BACKEND_HOST'), + 'port': os.environ.get('WS_BACKEND_PORT'), + 'db': os.environ.get('WS_BACKEND_DB'), } WS4REDIS_EXPIRE = 0 From 6167f02f96eceff5fc9ea47ea75b17af6eed634e Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 23 Mar 2017 15:24:40 -0500 Subject: [PATCH 087/520] Adding tasks to correct queues --- .../apps/api/agave/filemanager/agave.py | 33 ++++++++++++------- designsafe/apps/api/agave/models/files.py | 2 +- designsafe/apps/api/agave/views.py | 3 +- designsafe/apps/api/data/agave/filemanager.py | 12 ++++--- .../apps/api/data/agave/public_filemanager.py | 2 +- designsafe/apps/api/data/box/filemanager.py | 5 +-- .../box/filemanager/manager.py | 3 +- .../dropbox/filemanager/manager.py | 3 +- .../apps/api/external_resources/views.py | 3 +- designsafe/apps/api/projects/views.py | 4 +-- designsafe/apps/api/tasks.py | 7 ++-- designsafe/apps/auth/signals.py | 2 +- designsafe/apps/box_integration/tasks.py | 2 +- designsafe/apps/box_integration/views.py | 2 +- designsafe/apps/workspace/tasks.py | 6 ++-- 15 files changed, 55 insertions(+), 34 deletions(-) diff --git a/designsafe/apps/api/agave/filemanager/agave.py b/designsafe/apps/api/agave/filemanager/agave.py index 8bb93faefa..213359e368 100644 --- a/designsafe/apps/api/agave/filemanager/agave.py +++ b/designsafe/apps/api/agave/filemanager/agave.py @@ -51,7 +51,8 @@ def import_data(self, system, file_path, from_system, from_file_path): res = f.import_data(from_system, from_file_path) file_name = from_file_path.split('/')[-1] reindex_agave.apply_async(kwargs={'username': 'ds_admin', - 'file_id': '{}/{}'.format(system, os.path.join(file_path, file_name))}) + 'file_id': '{}/{}'.format(system, os.path.join(file_path, file_name))}, + queue='indexing') return res def copy(self, system, file_path, dest_path=None, dest_name=None): @@ -73,7 +74,8 @@ def copy(self, system, file_path, dest_path=None, dest_name=None): # schedule celery task to index new copy reindex_agave.apply_async(kwargs = {'username': 'ds_admin', - 'file_id': '{}/{}/{}'.format(system, dest_path.strip('/'), dest_name)}) + 'file_id': '{}/{}/{}'.format(system, dest_path.strip('/'), dest_name)}, + queue='indexing') return copied_file @@ -82,7 +84,8 @@ def delete(self, system, path): parent_path = '/'.join(path.strip('/').split('/')[:-1]) reindex_agave.apply_async(kwargs = {'username': 'ds_admin', 'file_id': '{}/{}'.format(system, parent_path), - 'levels': 1}) + 'levels': 1}, + queue='indexing') return resp def download(self, system, path): @@ -107,7 +110,8 @@ def mkdir(self, system, file_path, dir_name): f = BaseFileResource(self._ag, system, file_path) resp = f.mkdir(dir_name) reindex_agave.apply_async(kwargs = {'username': 'ds_admin', - 'file_id': '{}/{}'.format(system, file_path)}) + 'file_id': '{}/{}'.format(system, file_path)}, + queue='indexing') return resp def move(self, system, file_path, dest_path, dest_name=None): @@ -117,10 +121,12 @@ def move(self, system, file_path, dest_path, dest_name=None): parent_path = parent_path.strip('/') or '/' reindex_agave.apply_async(kwargs = {'username': 'ds_admin', 'file_id': '{}/{}'.format(system, parent_path), - 'levels': 1}) + 'levels': 1}, + queue='indexing') reindex_agave.apply_async(kwargs = {'username': 'ds_admin', 'file_id': '{}/{}'.format(system, os.path.join(dest_path, resp.name)), - 'levels': 1}) + 'levels': 1}, + queue='indexing') return resp def rename(self, system, file_path, rename_to): @@ -129,7 +135,8 @@ def rename(self, system, file_path, rename_to): parent_path = '/'.join(file_path.strip('/').split('/')[:-1]) reindex_agave.apply_async(kwargs = {'username': 'ds_admin', 'file_id': '{}/{}'.format(system, parent_path), - 'levels': 1}) + 'levels': 1}, + queue='indexing') return resp def share(self, system, file_path, username, permission): @@ -140,7 +147,8 @@ def share(self, system, file_path, username, permission): pem.permission_bit = permission resp = pem.save() reindex_agave.apply_async(kwargs = {'username': 'ds_admin', - 'file_id': '{}/{}'.format(system, file_path)}) + 'file_id': '{}/{}'.format(system, file_path)}, + queue='indexing') return resp def trash(self, system, file_path, trash_path): @@ -169,10 +177,12 @@ def trash(self, system, file_path, trash_path): parent_path = parent_path.strip('/') or '/' reindex_agave.apply_async(kwargs = {'username': 'ds_admin', 'file_id': '{}/{}'.format(system, trash_path), - 'levels': 1}) + 'levels': 1}, + queue='indexing') reindex_agave.apply_async(kwargs = {'username': 'ds_admin', 'file_id': '{}/{}'.format(system, parent_path), - 'levels': 1}) + 'levels': 1}, + queue='indexing') return resp def upload(self, system, file_path, upload_file): @@ -180,5 +190,6 @@ def upload(self, system, file_path, upload_file): resp = f.upload(upload_file) reindex_agave.apply_async(kwargs = {'username': 'ds_admin', 'file_id': '{}/{}'.format(system, file_path), - 'levels': 1}) + 'levels': 1}, + queue='indexing') return resp diff --git a/designsafe/apps/api/agave/models/files.py b/designsafe/apps/api/agave/models/files.py index 13766c16fa..147e2058c9 100644 --- a/designsafe/apps/api/agave/models/files.py +++ b/designsafe/apps/api/agave/models/files.py @@ -117,7 +117,7 @@ def save(self): super(BaseFileMetadata, self).save() #self.match_pems_to_project() if self.value.get('projectUUID'): - tasks.check_project_meta_pems.apply_async(args=[self.uuid]) + tasks.check_project_meta_pems.apply_async(args=[self.uuid], queue='api') else: super(BaseFileMetadata, self).save() diff --git a/designsafe/apps/api/agave/views.py b/designsafe/apps/api/agave/views.py index 040b157cca..b0a8aadb47 100644 --- a/designsafe/apps/api/agave/views.py +++ b/designsafe/apps/api/agave/views.py @@ -235,7 +235,8 @@ def put(self, request, file_mgr_name, system_id, file_path): 'dest_resource': external, 'src_file_id': os.path.join(system_id, file_path.strip('/')), 'dest_file_id': body.get('path') - }) + }, + queue='files') event_data[Notification.MESSAGE] = 'Data copy has been scheduled. This will take a few minutes.' event_data[Notification.EXTRA] = { 'resource': external, diff --git a/designsafe/apps/api/data/agave/filemanager.py b/designsafe/apps/api/data/agave/filemanager.py index d72adab2db..7007856bf9 100644 --- a/designsafe/apps/api/data/agave/filemanager.py +++ b/designsafe/apps/api/data/agave/filemanager.py @@ -295,7 +295,8 @@ def listing(self, file_id=None, **kwargs): listing = self._agave_listing(system, file_path, **kwargs) reindex_agave.apply_async(kwargs = {'username': self.username, 'file_id': file_id, - 'levels': 1}) + 'levels': 1}, + queue='indexing') except IndexError: listing = es_listing return listing @@ -724,7 +725,8 @@ def share(self, file_id, permissions, recursive = True, **kwargs): #esf = Object.from_file_path(system, self.username, file_path) #esf.share(self.username, permissions) share_agave.apply_async(args=(self.username, file_id, permissions, - recursive)) + recursive), + queue='indexing') return f.to_dict() def transfer(self, file_id, dest_resource, dest_file_id): @@ -735,7 +737,8 @@ def transfer(self, file_id, dest_resource, dest_file_id): self.resource, file_id, dest_resource, - dest_file_id)) + dest_file_id), + queue='indexing') return {'message': 'The requested transfer has been scheduled'} else: message = 'The requested transfer from %s to %s ' \ @@ -803,7 +806,8 @@ def upload(self, file_id, files, **kwargs): 'file_id': file_id, 'full_indexing': False, 'pems_indexing': True, - 'index_full_path': True}) + 'index_full_path': True}, + queue='indexing') return u_file.to_dict() def from_file_real_path(self, file_real_path): diff --git a/designsafe/apps/api/data/agave/public_filemanager.py b/designsafe/apps/api/data/agave/public_filemanager.py index 0b5fd8e0a4..9f01829cd6 100644 --- a/designsafe/apps/api/data/agave/public_filemanager.py +++ b/designsafe/apps/api/data/agave/public_filemanager.py @@ -273,7 +273,7 @@ def copy(self, file_id, dest_resource, dest_file_id, **kwargs): service = lookup_transfer_service(self.resource, dest_resource) if service: args = (self.username, self.resource, file_id, dest_resource, dest_file_id) - service.apply_async(args=args) + service.apply_async(args=args, queue='files') return {'message': 'The requested transfer has been scheduled'} else: message = 'The requested transfer from %s to %s ' \ diff --git a/designsafe/apps/api/data/box/filemanager.py b/designsafe/apps/api/data/box/filemanager.py index d2e6b1a1dc..f7ee0b5849 100644 --- a/designsafe/apps/api/data/box/filemanager.py +++ b/designsafe/apps/api/data/box/filemanager.py @@ -167,7 +167,7 @@ def copy(self, file_id, dest_resource, dest_file_id, **kwargs): args = (self._user.username, self.resource, file_id, dest_resource, dest_file_id) - service.apply_async(args=args) + service.apply_async(args=args, queue='files') return {'message': 'The requested transfer has been scheduled'} else: message = 'The requested transfer from %s to %s ' \ @@ -201,7 +201,8 @@ def import_file(self, file_id, from_resource, import_file_id, **kwargs): file_id, from_resource, import_file_id), - countdown=10) + countdown=10, + queue='files') return {'message': 'Your file(s) have been scheduled for upload to box.'} diff --git a/designsafe/apps/api/external_resources/box/filemanager/manager.py b/designsafe/apps/api/external_resources/box/filemanager/manager.py index 2349ee9719..4d5f798cf3 100644 --- a/designsafe/apps/api/external_resources/box/filemanager/manager.py +++ b/designsafe/apps/api/external_resources/box/filemanager/manager.py @@ -220,7 +220,8 @@ def copy(self, username, src_file_id, dest_file_id, **kwargs): reindex_agave.apply_async(kwargs={ 'username': user.username, 'file_id': '{}/{}'.format(agave_system_id, agave_file_path) - }) + }, + queue='indexing') except: logger.exception('Unexpected task failure: box_download', extra={ 'username': username, diff --git a/designsafe/apps/api/external_resources/dropbox/filemanager/manager.py b/designsafe/apps/api/external_resources/dropbox/filemanager/manager.py index 7a05d98b97..c85c5d6769 100644 --- a/designsafe/apps/api/external_resources/dropbox/filemanager/manager.py +++ b/designsafe/apps/api/external_resources/dropbox/filemanager/manager.py @@ -202,7 +202,8 @@ def copy(self, username, src_file_id, dest_file_id, **kwargs): reindex_agave.apply_async(kwargs={ 'username': user.username, 'file_id': '{}/{}'.format(agave_system_id, agave_file_path) - }) + }, + queue='indexing') except: logger.exception('Unexpected task failure: dropbox_download', extra={ 'username': username, diff --git a/designsafe/apps/api/external_resources/views.py b/designsafe/apps/api/external_resources/views.py index 9df1d8ab76..86d8491f53 100644 --- a/designsafe/apps/api/external_resources/views.py +++ b/designsafe/apps/api/external_resources/views.py @@ -91,7 +91,8 @@ def put(self, request, file_mgr_name, file_id): 'file_mgr_name': file_mgr_name, 'username': request.user.username, 'src_file_id': file_id, - 'dest_file_id': os.path.join(body['system'], body['path'].strip('/'))}) + 'dest_file_id': os.path.join(body['system'], body['path'].strip('/'))}, + queue='files') return JsonResponse({'status': 200, 'message': 'OK'}) except HTTPError as e: logger.exception('Unable to copy file') diff --git a/designsafe/apps/api/projects/views.py b/designsafe/apps/api/projects/views.py index f5926051cd..2c14df873b 100644 --- a/designsafe/apps/api/projects/views.py +++ b/designsafe/apps/api/projects/views.py @@ -266,7 +266,7 @@ def post(self, request, project_id): _kwargs = {member_type: members_list} project.update(**_kwargs) project.save() - tasks.check_project_files_meta_pems.apply_async(args=[project.uuid ]) + tasks.check_project_files_meta_pems.apply_async(args=[project.uuid ], queue='api') return JsonResponse({'status': 'ok'}) def delete(self, request, project_id): @@ -279,7 +279,7 @@ def delete(self, request, project_id): project = Project.from_uuid(agave_client=ag, uuid=project_id) project.remove_collaborator(post_data.get('username')) - tasks.check_project_files_meta_pems.apply_async(args=[project.uuid]) + tasks.check_project_files_meta_pems.apply_async(args=[project.uuid], queue='api') return JsonResponse({'status': 'ok'}) diff --git a/designsafe/apps/api/tasks.py b/designsafe/apps/api/tasks.py index 08e0936255..0e074fe0ff 100644 --- a/designsafe/apps/api/tasks.py +++ b/designsafe/apps/api/tasks.py @@ -15,10 +15,11 @@ logger = logging.getLogger(__name__) -@shared_task(bind=True) -def reindex_agave(self, username, file_id, full_indexing = True, - levels = 0, pems_indexing = True, index_full_path = True): +@shared_task(bind=True, max_retries=None) +def reindex_agave(self, username, file_id, full_indexing=True, + levels=1, pems_indexing=True, index_full_path=True): user = get_user_model().objects.get(username=username) + levels=1 from designsafe.apps.api.data import AgaveFileManager agave_fm = AgaveFileManager(user) diff --git a/designsafe/apps/auth/signals.py b/designsafe/apps/auth/signals.py index 677bd262a4..a68d850278 100644 --- a/designsafe/apps/auth/signals.py +++ b/designsafe/apps/auth/signals.py @@ -5,4 +5,4 @@ @receiver(user_logged_in) def on_user_logged_in(sender, user, request, **kwargs): - check_or_create_agave_home_dir.apply_async(args=(user.username,)) + check_or_create_agave_home_dir.apply_async(args=(user.username,), queue='files') diff --git a/designsafe/apps/box_integration/tasks.py b/designsafe/apps/box_integration/tasks.py index c47ac42c33..14892d8c8f 100644 --- a/designsafe/apps/box_integration/tasks.py +++ b/designsafe/apps/box_integration/tasks.py @@ -97,7 +97,7 @@ def copy_box_item(self, username, box_item_type, box_item_id, target_system_id, for it in item_collection: args = (username, it.type, it.object_id, target_system_id, f.full_path) - copy_box_item.apply_async(args=args, countdown=offset*2) + copy_box_item.apply_async(args=args, countdown=offset*2, queue='files') if len(item_collection) == limit: offset += limit else: diff --git a/designsafe/apps/box_integration/views.py b/designsafe/apps/box_integration/views.py index 28a86b56eb..189f8d56c9 100644 --- a/designsafe/apps/box_integration/views.py +++ b/designsafe/apps/box_integration/views.py @@ -128,7 +128,7 @@ def put(self, request, item_type, item_id): task_args = (request.user.username, item.type, item.object_id, target_system, target_dir) - task = copy_box_item.apply_async(args=task_args, countdown=10) + task = copy_box_item.apply_async(args=task_args, countdown=10, queue='files') logger.debug('Scheduled Box Copy', extra={ 'username': request.user.username, diff --git a/designsafe/apps/workspace/tasks.py b/designsafe/apps/workspace/tasks.py index 48b0de31aa..410b3c7f41 100644 --- a/designsafe/apps/workspace/tasks.py +++ b/designsafe/apps/workspace/tasks.py @@ -44,7 +44,7 @@ def submit_job(request, username, job_post): logger.debug('Job Submission Response: {}'.format(response)) # watch job status - watch_job_status.apply_async(args=[username, response['id']], countdown=10) + watch_job_status.apply_async(args=[username, response['id']], countdown=10, queue='api') return response except ConnectionError as e: @@ -320,12 +320,12 @@ def watch_job_status(self, username, job_id, current_status=None): # DO NOT notify, but still queue another watch task watch_job_status.apply_async(args=[username, job_id], kwargs={'current_status': job_status}, - countdown=10) + countdown=10, queue='api') else: # queue another watch task watch_job_status.apply_async(args=[username, job_id], kwargs={'current_status': job_status}, - countdown=10) + countdown=10, queue='api') # notify logger.debug('JOB STATUS CHANGE: id=%s status=%s' % (job_id, job_status)) From ac1832539c551b4c5897a72707f037834b3a9f52 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 23 Mar 2017 15:24:50 -0500 Subject: [PATCH 088/520] Creating queues in config --- designsafe/celery_settings.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/designsafe/celery_settings.py b/designsafe/celery_settings.py index 6721f5fa3b..1b4e976f5d 100644 --- a/designsafe/celery_settings.py +++ b/designsafe/celery_settings.py @@ -2,6 +2,7 @@ # Celery settings """ import os +from kombu import Exchange, Queue #BROKER_URL = 'redis://redis:6379/0' BROKER_URL_PROTOCOL = os.environ.get('BROKER_URL_PROTOCOL', 'amqp://') BROKER_URL_USERNAME = os.environ.get('BROKER_URL_USERNAME', 'username') @@ -30,3 +31,18 @@ CELERYD_LOG_FORMAT = '[DJANGO] $(processName)s %(levelname)s %(asctime)s %(module)s '\ '%(name)s.%(funcName)s:%(lineno)s: %(message)s' #CELERY_ANOTATIONS = {'designsafe.apps.api.tasks.reindex_agave': {'time_limit': 60 * 15}} + + +CELERY_DEFAULT_EXCHANGE_TYPE = 'direct' +CELERY_QUEUES = ( + Queue('default', Exchange('default'), routing_key='default'), + #Use to queue indexing tasks + Queue('indexing', Exchange('io'), routing_key='io.indexing'), + #Use to queue tasks which handle files + Queue('files', Exchange('io'), routing_key='io.files'), + #Use to queue tasks which mainly call external APIs + Queue('api', Exchange('api'), routing_key='api.agave'), + ) +CELERY_DEFAULT_QUEUE = 'default' +CELERY_DEFAULT_EXCHANGE = 'default' +CELERY_DEFAULT_ROUTING_KEY = 'default' From 7c26091a4d7f5414fe87e89ea3b5e841e0f9290b Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 23 Mar 2017 15:52:29 -0500 Subject: [PATCH 089/520] Updating how we run celery workers --- bin/run-celery.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/run-celery.sh b/bin/run-celery.sh index c45bedac56..ace4ca0013 100755 --- a/bin/run-celery.sh +++ b/bin/run-celery.sh @@ -2,4 +2,5 @@ # Run Celery as the DesignSafe Community Account su tg458981 -c "celery -A designsafe beat -l info --pidfile= --schedule=/tmp/celerybeat-schedule" & -su tg458981 -c "celery -A designsafe worker -l info --autoscale=10,2" +su tg458981 -c "celery -A designsafe worker -l info --autoscale=6,3 --concurrency=4" +su tg458981 -c "celery -A designsafe worker -l info --autoscale=6,3 --concurrenty=4" From a0ce3c6e4910bd68362cceb51326da0c7f9938af Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Thu, 23 Mar 2017 15:55:42 -0500 Subject: [PATCH 090/520] io stuff refactor --- .../static/designsafe/apps/geo/html/map.html | 1 + .../apps/geo/scripts/build/bundle.js | 455 +++++++++++++----- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 35 +- .../apps/geo/scripts/models/map-project.js | 1 + .../geo/scripts/services/geo-data-service.js | 137 ++++++ .../apps/geo/scripts/services/index.js | 3 +- .../static/designsafe/apps/geo/styles/geo.css | 4 +- .../templates/designsafe/apps/geo/index.html | 7 + docker-compose-dev.yml | 26 +- 10 files changed, 515 insertions(+), 156 deletions(-) create mode 100644 designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index 4e0a23ed29..d50a39bbda 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -4,6 +4,7 @@ +
  • diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index c9133a54e9..9e40877485 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -63,7 +63,7 @@ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 10); +/******/ return __webpack_require__(__webpack_require__.s = 11); /******/ }) /************************************************************************/ /******/ ([ @@ -77,21 +77,38 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _mapSidebar = __webpack_require__(4); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _mapSidebar2 = _interopRequireDefault(_mapSidebar); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var _dbModal = __webpack_require__(3); +var DBModalCtrl = function () { + DBModalCtrl.$inject = ["$scope", "$uibModalInstance"]; + function DBModalCtrl($scope, $uibModalInstance) { + 'ngInject'; -var _dbModal2 = _interopRequireDefault(_dbModal); + _classCallCheck(this, DBModalCtrl); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + this.$scope = $scope; + this.$uibModalInstance = $uibModalInstance; + this.selected = null; + } -var mod = angular.module('ds.geo.controllers', []); + _createClass(DBModalCtrl, [{ + key: 'ok', + value: function ok() { + this.$uibModalInstance.close(this.selected); + } + }, { + key: 'cancel', + value: function cancel() { + this.$uibModalInstance.dismiss('cancel'); + } + }]); -mod.controller('MapSidebarCtrl', _mapSidebar2.default); -mod.controller('DBModalCtrl', _dbModal2.default); -exports.default = mod; + return DBModalCtrl; +}(); + +exports.default = DBModalCtrl; /***/ }), /* 1 */ @@ -104,16 +121,31 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _customOnChange = __webpack_require__(5); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _customOnChange2 = _interopRequireDefault(_customOnChange); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var LayerGroup = function () { + function LayerGroup(label, fg) { + _classCallCheck(this, LayerGroup); -var mod = angular.module('ds.geo.directives', []); + this.label = label; + this.feature_group = fg; + this.show = true; + this.show_contents = true; + } -mod.directive('customOnChange', _customOnChange2.default); -exports.default = mod; + _createClass(LayerGroup, [{ + key: "num_features", + value: function num_features() { + return this.feature_group.getLayers().length; + } + }]); + + return LayerGroup; +}(); + +exports.default = LayerGroup; /***/ }), /* 2 */ @@ -126,22 +158,84 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _geoStateService = __webpack_require__(8); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var _geoStateService2 = _interopRequireDefault(_geoStateService); +var MapProject = function MapProject(name) { + _classCallCheck(this, MapProject); + + this.name = name; + this.layer_groups = []; + this.description = null; +}; + +exports.default = MapProject; + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.get_file_extension = get_file_extension; +function get_file_extension(fname) { + return fname.split('.').pop(); +} + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _mapSidebar = __webpack_require__(7); + +var _mapSidebar2 = _interopRequireDefault(_mapSidebar); + +var _dbModal = __webpack_require__(0); + +var _dbModal2 = _interopRequireDefault(_dbModal); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var mod = angular.module('ds.geo.services', []); // import customOnChange from './custom-on-change'; +var mod = angular.module('ds.geo.controllers', []); -mod.service('GeoStateService', _geoStateService2.default); +mod.controller('MapSidebarCtrl', _mapSidebar2.default); +mod.controller('DBModalCtrl', _dbModal2.default); +exports.default = mod; -// mod.directive('customOnChange', customOnChange); +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var _customOnChange = __webpack_require__(8); + +var _customOnChange2 = _interopRequireDefault(_customOnChange); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mod = angular.module('ds.geo.directives', []); + +mod.directive('customOnChange', _customOnChange2.default); exports.default = mod; /***/ }), -/* 3 */ +/* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -151,41 +245,27 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _geoStateService = __webpack_require__(10); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var _geoStateService2 = _interopRequireDefault(_geoStateService); -var DBModalCtrl = function () { - DBModalCtrl.$inject = ["$scope", "$uibModalInstance"]; - function DBModalCtrl($scope, $uibModalInstance) { - 'ngInject'; +var _geoDataService = __webpack_require__(9); - _classCallCheck(this, DBModalCtrl); +var _geoDataService2 = _interopRequireDefault(_geoDataService); - this.$scope = $scope; - this.$uibModalInstance = $uibModalInstance; - this.selected = null; - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - _createClass(DBModalCtrl, [{ - key: 'ok', - value: function ok() { - this.$uibModalInstance.close(this.selected); - } - }, { - key: 'cancel', - value: function cancel() { - this.$uibModalInstance.dismiss('cancel'); - } - }]); +// import customOnChange from './custom-on-change'; +var mod = angular.module('ds.geo.services', []); +mod.service('GeoStateService', _geoStateService2.default); +mod.service('GeoDataService', _geoDataService2.default); - return DBModalCtrl; -}(); +// mod.directive('customOnChange', customOnChange); -exports.default = DBModalCtrl; +exports.default = mod; /***/ }), -/* 4 */ +/* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -197,19 +277,19 @@ Object.defineProperty(exports, "__esModule", { var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _layer_group = __webpack_require__(6); +var _layer_group = __webpack_require__(1); var _layer_group2 = _interopRequireDefault(_layer_group); -var _mapProject = __webpack_require__(7); +var _mapProject = __webpack_require__(2); var _mapProject2 = _interopRequireDefault(_mapProject); -var _dbModal = __webpack_require__(3); +var _dbModal = __webpack_require__(0); var _dbModal2 = _interopRequireDefault(_dbModal); -var _geoUtils = __webpack_require__(9); +var _geoUtils = __webpack_require__(3); var GeoUtils = _interopRequireWildcard(_geoUtils); @@ -220,8 +300,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var MapSidebarCtrl = function () { - MapSidebarCtrl.$inject = ["$scope", "$window", "$timeout", "$uibModal", "DataService", "$http"]; - function MapSidebarCtrl($scope, $window, $timeout, $uibModal, DataService, $http) { + MapSidebarCtrl.$inject = ["$scope", "$window", "$timeout", "$uibModal", "DataService", "$http", "GeoDataService"]; + function MapSidebarCtrl($scope, $window, $timeout, $uibModal, DataService, $http, GeoDataService) { 'ngInject'; var _this = this; @@ -235,9 +315,8 @@ var MapSidebarCtrl = function () { this.$uibModal = $uibModal; this.DataService = DataService; this.$http = $http; - angular.element('header').hide(); - angular.element('nav').hide(); - angular.element('footer').hide(); + this.GeoDataService = GeoDataService; + this.primary_color = '#ff0000'; this.secondary_color = '#ff0000'; @@ -408,14 +487,11 @@ var MapSidebarCtrl = function () { value: function load_from_data_depot(f) { var _this3 = this; - this.$http.get(f.agaveUrl()).then(function (resp) { - console.log(f, resp.data); - var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); - L.geoJSON(resp.data).getLayers().forEach(function (l) { - lg.feature_group.addLayer(l); - }); + this.loading = true; + this.GeoDataService.load_from_data_depot(f).then(function (lg) { _this3.layer_groups.push(lg); _this3.map.addLayer(lg.feature_group); + _this3.loading = false; }); } }, { @@ -424,14 +500,28 @@ var MapSidebarCtrl = function () { var _this4 = this; var file = ev.target.files[0]; - console.log(GeoUtils); + console.log(ev); var ext = GeoUtils.get_file_extension(file.name); console.log(ext); var reader = new FileReader(); reader.readAsText(file); reader.onload = function (e) { - if (ext === 'kml') { + if (ext === 'kmz') { + var zipper = new JSZip(); + zipper.loadAsync(file).then(function (zip) { + return zip.file('doc.kml').async('text'); + }).then(function (txt) { + var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); + var l = omnivore.kml.parse(txt); + l.getLayers().forEach(function (d) { + lg.feature_group.addLayer(d); + }); + _this4.layer_groups.push(lg); + console.log(lg); + _this4.map.addLayer(lg.feature_group); + }); + } else if (ext === 'kml') { (function () { var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); // let parser = new this.$window.DOMParser(); @@ -551,7 +641,7 @@ var MapSidebarCtrl = function () { exports.default = MapSidebarCtrl; /***/ }), -/* 5 */ +/* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -578,7 +668,7 @@ function customOnChange() { } /***/ }), -/* 6 */ +/* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -590,54 +680,196 @@ Object.defineProperty(exports, "__esModule", { var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var _geoUtils = __webpack_require__(3); -var LayerGroup = function () { - function LayerGroup(label, fg) { - _classCallCheck(this, LayerGroup); +var GeoUtils = _interopRequireWildcard(_geoUtils); - this.label = label; - this.feature_group = fg; - this.show = true; - this.show_contents = true; - } +var _layer_group = __webpack_require__(1); - _createClass(LayerGroup, [{ - key: "num_features", - value: function num_features() { - return this.feature_group.getLayers().length; - } - }]); +var _layer_group2 = _interopRequireDefault(_layer_group); - return LayerGroup; -}(); +var _mapProject = __webpack_require__(2); -exports.default = LayerGroup; +var _mapProject2 = _interopRequireDefault(_mapProject); -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -"use strict"; +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -Object.defineProperty(exports, "__esModule", { - value: true -}); +var GeoDataService = function () { + GeoDataService.$inject = ["$http", "$q"]; + function GeoDataService($http, $q) { + 'ngInject'; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + _classCallCheck(this, GeoDataService); -var MapProject = function MapProject(name) { - _classCallCheck(this, MapProject); + this.$http = $http; + this.$q = $q; + } - this.name = name; - this.layer_groups = []; -}; + _createClass(GeoDataService, [{ + key: '_from_kml', + value: function _from_kml(text_blob) { + return this.$q(function (res, rej) { + console.log(text_blob); + var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); + var l = omnivore.kml.parse(text_blob); + l.getLayers().forEach(function (d) { + lg.feature_group.addLayer(d); + }); + res(lg); + }); + } + }, { + key: '_from_kmz', + value: function _from_kmz(blob) { + var _this = this; + + return this.$q(function (res, rej) { + var zipper = new JSZip(); + zipper.loadAsync(blob).then(function (zip) { + + //loop over all the files in the archive + for (var key in zip.files) { + var ext = key.split('.').pop(); + if (ext === 'kml') { + return zip.files[key].async('text'); + } + } + }).then(function (txt) { + var lg = _this._from_kml(txt); + res(lg); + }); + }); + } + }, { + key: '_from_json', + value: function _from_json(json_blob) { + return this.$q(function (res, rej) { + var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); + L.geoJSON(json_blob).getLayers().forEach(function (l) { + lg.feature_group.addLayer(l); + }); + res(lg); + }); + } + }, { + key: '_from_gpx', + value: function _from_gpx(blob) { + return this.$q(function (res, rej) { + console.log(text_blob); + var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); + var l = omnivore.gpx.parse(text_blob); + l.getLayers().forEach(function (d) { + lg.feature_group.addLayer(d); + }); + res(lg); + }); + } + }, { + key: '_load_dsmap', + value: function _load_dsmap(json_blob) {} + }, { + key: 'load_from_local_file', + value: function load_from_local_file(file) { + var _this2 = this; -exports.default = MapProject; + var ext = GeoUtils.get_file_extension(file.name); + var reader = new FileReader(); + onload = this.$q(function (res, rej) {}); + + reader.onload = function (e) { + var p = null; + switch (ext) { + case 'kml': + p = _this2._from_kml(e.target.result).then(function (lg) { + return lg; + }); + break; + case 'json': + p = _this2._from_json(e.target.result).then(function (lg) { + return lg; + }); + break; + case 'geojson': + p = _this2._from_json(e.target.result).then(function (lg) { + return lg; + }); + break; + case 'kmz': + p = _this2._from_kmz(file).then(function (lg) { + return lg; + }); + break; + default: + p = _this2._from_json(reps.data).then(function (lg) { + return lg; + }); + } + return p; + }; + } + + // + // @param f: a file from DataService + // returns a promise with the LayerGroup + + }, { + key: 'load_from_data_depot', + value: function load_from_data_depot(f) { + var _this3 = this; + + console.log(f); + var ext = GeoUtils.get_file_extension(f.name); + console.log(ext); + var responseType = 'text'; + if (ext === 'kmz') { + responseType = 'arraybuffer'; + } + console.log(responseType); + return this.$http.get(f.agaveUrl(), { 'responseType': responseType }).then(function (resp) { + console.log(resp); + var p = null; + switch (ext) { + case 'kml': + p = _this3._from_kml(resp.data).then(function (lg) { + return lg; + }); + break; + case 'json': + p = _this3._from_json(resp.data).then(function (lg) { + return lg; + }); + break; + case 'geojson': + p = _this3._from_json(resp.data).then(function (lg) { + return lg; + }); + break; + case 'kmz': + p = _this3._from_kmz(resp.data).then(function (lg) { + return lg; + }); + break; + default: + p = _this3._from_json(reps.data).then(function (lg) { + return lg; + }); + } + return p; + }); + } + }]); + + return GeoDataService; +}(); + +exports.default = GeoDataService; /***/ }), -/* 8 */ +/* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -660,22 +892,7 @@ var GeoStateService = function GeoStateService($scope, $state) { exports.default = GeoStateService; /***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.get_file_extension = get_file_extension; -function get_file_extension(fname) { - return fname.split('.').pop(); -} - -/***/ }), -/* 10 */ +/* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -686,11 +903,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _directives = __webpack_require__(1); +var _directives = __webpack_require__(5); -var _controllers = __webpack_require__(0); +var _controllers = __webpack_require__(4); -var _services = __webpack_require__(2); +var _services = __webpack_require__(6); var mod = angular.module('designsafe'); mod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services'); diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 021002f2df..2bcfc8d025 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 6fd2e4a7eaa7cc2e13fa","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["mod","angular","module","controller","directive","service","DBModalCtrl","$scope","$uibModalInstance","selected","dismiss","$timeout","$window","$uibModal","DataService","$http","element","hide","primary_color","secondary_color","open_db_modal","streets","L","tileLayer","maxZoom","satellite","control","layers","basemaps","addTo","map","zoomControl","setPosition","invalidateSize","layer_groups","active_layer_group","current_layer","$apply","on","e","object","options","color","fillColor","fillOpacity","feature_group","addLayer","dc","Control","position","draw","circle","edit","featureGroup","remove","lg","push","length","select_active_layer_group","removeLayer","splice","i","show","removeControl","drawControl","add_draw_controls","active","modal","result","then","f","$","click","Marker","Polygon","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","getBounds","src_lg","getLayers","console","log","get","agaveUrl","geoJSON","resp","data","l","file","ev","target","ext","GeoUtils","get_file_extension","reader","FileReader","readAsText","onload","omnivore","kml","parse","forEach","d","gpx","json","JSON","ds_map","features","bounds","files","readAsArrayBuffer","exif","EXIF","readFromBinaryFile","lat","GPSLatitude","lonRef","GPSLongitudeRef","lon","setStyle","out","map_title","label","blob","Blob","a","document","createElement","href","url","textContent","restrict","scope","handler","link","LayerGroup","show_contents","MapProject","name","GeoStateService","$state","last_db_path","fname","split","pop","requires","config","$stateProvider","$uibTooltipProvider","state","resolve","auth"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AChEA;;;;AACA;;;;;;AACA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,oBAAf,EAAqC,EAArC,CAAV;;AAEAF,IAAIG,UAAJ,CAAe,gBAAf;AACAH,IAAIG,UAAJ,CAAe,aAAf;kBACeH,G;;;;;;;;;;;;;ACNf;;;;;;AAEA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,mBAAf,EAAoC,EAApC,CAAV;;AAGAF,IAAII,SAAJ,CAAc,gBAAd;kBACeJ,G;;;;;;;;;;;;;ACLf;;;;;;AAGA,IAAIA,MAAMC,QAAQC,MAAR,CAAe,iBAAf,EAAkC,EAAlC,CAAV,C,CAJA;;AAKAF,IAAIK,OAAJ,CAAY,iBAAZ;;AAEA;;kBAEeL,G;;;;;;;;;;;;;;;;;ICTMM,W;AAEnB,uBAAaC,MAAb,EAAqBC,iBAArB,EAAwC;AACtC;;AADsC;;AAEtC;AACA,SAAKA,gBAAL;AACA,SAAKC,QAAL,GAAgB,IAAhB;AACD;;;;cAEK;AACJ,WAAKD,eAAL;AACD;;;kBAES;AACR,WAAKA,iBAAL,CAAuBE,CAAvB;AACD;;;;;;;;;;;;;;;;;;;;;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,IAAb,CAAkB,WAAlB,EAA+B,QAA/B;;AAEA,SAAS8F,MAAT,CAAgBC,cAAhB,EAAgCC,OAAqB;AACnD;;AACAD,iBAAeE,KAAf,CAAqB,KAArB,EAA4B;AAC1BpB,SAAK,EADqB;AAAA;AAG1BlI,gBAAY,eAHc;AAI1BuJ,YAAS;AACPC,YAAM,gBAAY;AAChB,eAAO,IAAP;AACD;AAHM;AAJiB,GAA5B;;AAWA;AACAH,KAAA;AAED;;AAEDxJ,IAAIsJ,MAAJ,CAAWA,MAAX","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 10);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 6fd2e4a7eaa7cc2e13fa","import MapSidebarCtrl from './map-sidebar';\nimport DBModalCtrl from './db-modal';\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\nmod.controller('DBModalCtrl', DBModalCtrl);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\n\nmod.directive('customOnChange', customOnChange);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\nimport GeoStateService from './geo-state-service';\n\n\nlet mod = angular.module('ds.geo.services', []);\nmod.service('GeoStateService', GeoStateService);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","export default class DBModalCtrl {\n\n constructor ($scope, $uibModalInstance) {\n 'ngInject';\n this.$scope = $scope;\n this.$uibModalInstance = $uibModalInstance;\n this.selected = null;\n }\n\n ok () {\n this.$uibModalInstance.close(this.selected);\n };\n\n cancel () {\n this.$uibModalInstance.dismiss('cancel');\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal, DataService, $http) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n this.DataService = DataService;\n this.$http = $http;\n angular.element('header').hide();\n angular.element('nav').hide();\n angular.element('footer').hide();\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n this.open_db_modal = this.open_db_modal.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n let modal = this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: \"DBModalCtrl as vm\",\n });\n modal.result.then( (f) => {this.load_from_data_depot(f);});\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n load_from_data_depot(f) {\n this.$http.get(f.agaveUrl()).then((resp) => {\n console.log(f, resp.data)\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(resp.data).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n console.log(GeoUtils);\n\n let ext = GeoUtils.get_file_extension(file.name);\n console.log(ext);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n if (ext === 'kml') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.kml.parse(e.target.result);\n // debugger\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else if (ext === 'gpx') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.gpx.parse(e.target.result);\n lg.feature_group.addLayer(l);\n\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else {\n let json = JSON.parse(e.target.result);\n\n // we add in a field into the json blob when saved. If it is such,\n // handle potential multiple layers.\n if (json.ds_map) {\n // each feature in the collection represents a layer\n json.features.forEach( (f) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(f).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n else {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json).getLayers().forEach( (l) => {\n this.layer_groups[0].feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n }\n\n };\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n this.active_layer_group.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","export default class GeoStateService {\n\n constructor ($scope, $state) {\n this.$scope = $scope;\n this.$state = $state;\n this.last_db_path = null;\n }\n\n \n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 67e80c60945d6ebb87c7","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["DBModalCtrl","$scope","$uibModalInstance","selected","dismiss","label","fg","feature_group","show","show_contents","getLayers","layer_groups","description","get_file_extension","fname","split","pop","mod","controller","angular","module","service","$timeout","$window","$uibModal","DataService","$http","GeoDataService","primary_color","open_db_modal","streets","L","tileLayer","maxZoom","satellite","control","layers","basemaps","addTo","map","zoomControl","setPosition","invalidateSize","active_layer_group","current_layer","$apply","on","e","object","options","color","secondary_color","fillColor","fillOpacity","addLayer","dc","Control","position","draw","circle","edit","featureGroup","remove","lg","push","length","select_active_layer_group","removeLayer","splice","i","removeControl","drawControl","add_draw_controls","active","modal","result","then","f","$","click","Marker","Polygon","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","getBounds","src_lg","console","log","loading","file","ev","target","ext","GeoUtils","reader","FileReader","readAsText","onload","zipper","JSZip","loadAsync","zip","txt","l","omnivore","kml","parse","forEach","d","gpx","json","JSON","ds_map","features","geoJSON","bounds","files","readAsArrayBuffer","exif","EXIF","readFromBinaryFile","lat","GPSLatitude","lonRef","GPSLongitudeRef","lon","setStyle","out","map_title","blob","Blob","a","document","createElement","href","url","textContent","restrict","scope","handler","link","element","$q","res","text_blob","rej","key","async","json_blob","p","responseType","get","agaveUrl","$state","GeoStateService","templateUrl","resolve","auth","$uibTooltipProvider","config"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;IChEqBA,W;AAEnB,uBAAaC,MAAb,EAAqBC,iBAArB,EAAwC;AACtC;;AADsC;;AAEtC;AACA,SAAKA,gBAAL;AACA,SAAKC,QAAL,GAAgB,IAAhB;AACD;;;;cAEK;AACJ,WAAKD,eAAL;AACD;;;kBAES;AACR,WAAKA,iBAAL,CAAuBE,CAAvB;AACD;;;;;;;;;;;;;;;;;;;;;;;;ACbD,sBAAaC,KAAb,EAAoBC,CAAI;AAAA;;AACtB;AACA,SAAKC,aAAL;AACA,SAAKC,IAAL,GAAY,IAAZ;AACA,SAAKC,YAAL;AACD;;;;wBAEe;AACd,aAAO,KAAKF,aAAL,CAAmBG,IAA1B;AACD;;;;;;;;;;;;;;;;;;;;;ACRkB;AAAA;;AACjB;AACA,OAAKC,YAAL;AACA,OAAKC,WAAL,GAAmB,IAAnB;AACD,C;;;;;;;;;;;;;;;ACPI,SAASC,kBAAT,CAA6BC,KAA7B,EAAoC;AACzC,SAAOA,MAAMC,KAAN,CAAY,GAAZ,EAAiBC,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CAAJ;AACA;AACF,eAAK,SAAL;AACEA,eAA6C;AAAC;AAAW,aAArD,CAAJ;AACA;AACF,eAAK,KAAL;AACEA,eAA4C;AAAC;AAAW,aAApD,CAAJ;AACA;AACF;AACEA,eAA6C;AAAC;AAAW,aAArD,CAAJ;AAdJ;AAgBA,eAAOA,CAAP;AACD,OApBM,CAAP;AAqBD;;;;;;kBAjIkB9H,M;;;;;;;;;;;;;;;ACHU;AAAA;;AAC3B,OAAK1B,MAAL,GAAcA,MAAd;AACA,OAAK4J,MAAL,GAAcA,MAAd;AACA;AACD,C;;kBANkBC,S;;;;;;;;;;;;;ACArB;;AACA;;AACA;;AAEA,IAAI7I,MAAME,QAAQC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEqD;AACnD;;AAC4B;AAC1BuH,SAAK,EADqB;AAE1BoB,aAF0B;AAAA;AAI1BC,aAAS;AACPC,YAAkB;AAChB,eAAO,IAAP;AACD;AAHM;AAJiB,GAA5B;;AAWA;AACAC,KAAA;AAED;;AAEDjJ,IAAIkJ,MAAJ,CAAWA,MAAX","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 11);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 67e80c60945d6ebb87c7","export default class DBModalCtrl {\n\n constructor ($scope, $uibModalInstance) {\n 'ngInject';\n this.$scope = $scope;\n this.$uibModalInstance = $uibModalInstance;\n this.selected = null;\n }\n\n ok () {\n this.$uibModalInstance.close(this.selected);\n };\n\n cancel () {\n this.$uibModalInstance.dismiss('cancel');\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n this.description = null;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","import MapSidebarCtrl from './map-sidebar';\nimport DBModalCtrl from './db-modal';\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\nmod.controller('DBModalCtrl', DBModalCtrl);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\n\nmod.directive('customOnChange', customOnChange);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\nimport GeoStateService from './geo-state-service';\nimport GeoDataService from './geo-data-service';\n\nlet mod = angular.module('ds.geo.services', []);\nmod.service('GeoStateService', GeoStateService);\nmod.service('GeoDataService', GeoDataService);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal, DataService, $http, GeoDataService) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n this.DataService = DataService;\n this.$http = $http;\n this.GeoDataService = GeoDataService;\n\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n this.open_db_modal = this.open_db_modal.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n let modal = this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: \"DBModalCtrl as vm\",\n });\n modal.result.then( (f) => {this.load_from_data_depot(f);});\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n load_from_data_depot(f) {\n this.loading = true;\n this.GeoDataService.load_from_data_depot(f).then( (lg) => {\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n this.loading = false;\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n console.log(ev);\n\n let ext = GeoUtils.get_file_extension(file.name);\n console.log(ext);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n if (ext === 'kmz') {\n let zipper = new JSZip();\n zipper.loadAsync(file).then( (zip) => {\n return zip.file('doc.kml').async('text');\n\n }).then( (txt) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let l = omnivore.kml.parse(txt);\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n console.log(lg);\n this.map.addLayer(lg.feature_group);\n });\n } else if (ext === 'kml') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.kml.parse(e.target.result);\n // debugger\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else if (ext === 'gpx') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.gpx.parse(e.target.result);\n lg.feature_group.addLayer(l);\n\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else {\n let json = JSON.parse(e.target.result);\n\n // we add in a field into the json blob when saved. If it is such,\n // handle potential multiple layers.\n if (json.ds_map) {\n // each feature in the collection represents a layer\n json.features.forEach( (f) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(f).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n else {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json).getLayers().forEach( (l) => {\n this.layer_groups[0].feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n }\n\n };\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n this.active_layer_group.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import * as GeoUtils from '../utils/geo-utils';\nimport LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\n\n\nexport default class GeoDataService {\n\n constructor ($http, $q) {\n 'ngInject';\n this.$http = $http;\n this.$q = $q;\n }\n\n _from_kml(text_blob) {\n return this.$q( (res, rej) => {\n console.log(text_blob)\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let l = omnivore.kml.parse(text_blob);\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n res(lg);\n });\n }\n\n _from_kmz (blob) {\n return this.$q( (res, rej) => {\n let zipper = new JSZip();\n zipper.loadAsync(blob).then( (zip) => {\n\n //loop over all the files in the archive\n for (let key in zip.files) {\n let ext = key.split('.').pop();\n if (ext === 'kml') {\n return zip.files[key].async('text');\n }\n }\n }).then( (txt) => {\n let lg = this._from_kml(txt);\n res(lg);\n });\n });\n }\n\n _from_json (json_blob) {\n return this.$q( (res, rej) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json_blob).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n res(lg);\n });\n }\n\n _from_gpx (blob) {\n return this.$q( (res, rej) => {\n console.log(text_blob)\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let l = omnivore.gpx.parse(text_blob);\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n res(lg);\n });\n }\n\n _load_dsmap (json_blob) {\n\n }\n\n\n load_from_local_file (file) {\n\n let ext = GeoUtils.get_file_extension(file.name);\n let reader = new FileReader();\n onload = this.$q( (res, rej) => {\n\n });\n\n reader.onload = (e) => {\n let p = null;\n switch (ext) {\n case 'kml':\n p = this._from_kml(e.target.result).then( (lg) => {return lg;});\n break;\n case 'json':\n p = this._from_json(e.target.result).then( (lg) => {return lg;});\n break;\n case 'geojson':\n p = this._from_json(e.target.result).then( (lg) => {return lg;});\n break;\n case 'kmz':\n p = this._from_kmz(file).then( (lg) => {return lg;});\n break;\n default:\n p = this._from_json(reps.data).then( (lg) => {return lg;});\n }\n return p;\n };\n }\n\n //\n // @param f: a file from DataService\n // returns a promise with the LayerGroup\n load_from_data_depot(f) {\n console.log(f);\n let ext = GeoUtils.get_file_extension(f.name);\n console.log(ext)\n let responseType = 'text';\n if (ext === 'kmz') {\n responseType = 'arraybuffer';\n }\n console.log(responseType)\n return this.$http.get(f.agaveUrl(), {'responseType': responseType}).then((resp) => {\n console.log(resp)\n let p = null;\n switch (ext) {\n case 'kml':\n p = this._from_kml(resp.data).then( (lg) => {return lg;});\n break;\n case 'json':\n p = this._from_json(resp.data).then( (lg) => {return lg;});\n break;\n case 'geojson':\n p = this._from_json(resp.data).then( (lg) => {return lg;});\n break;\n case 'kmz':\n p = this._from_kmz(resp.data).then( (lg) => {return lg;});\n break;\n default:\n p = this._from_json(reps.data).then( (lg) => {return lg;});\n }\n return p;\n });\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js","export default class GeoStateService {\n\n constructor ($scope, $state) {\n this.$scope = $scope;\n this.$state = $state;\n this.last_db_path = null;\n }\n\n \n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index bfc0e1b7df..72b5ab14db 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -5,7 +5,7 @@ import * as GeoUtils from '../utils/geo-utils'; export default class MapSidebarCtrl { - constructor ($scope, $window, $timeout, $uibModal, DataService, $http) { + constructor ($scope, $window, $timeout, $uibModal, DataService, $http, GeoDataService) { 'ngInject'; this.$scope = $scope; this.LGeo = $window.LGeo; @@ -14,9 +14,8 @@ export default class MapSidebarCtrl { this.$uibModal = $uibModal; this.DataService = DataService; this.$http = $http; - angular.element('header').hide(); - angular.element('nav').hide(); - angular.element('footer').hide(); + this.GeoDataService = GeoDataService; + this.primary_color = '#ff0000'; this.secondary_color = '#ff0000'; @@ -169,27 +168,39 @@ export default class MapSidebarCtrl { } load_from_data_depot(f) { - this.$http.get(f.agaveUrl()).then((resp) => { - console.log(f, resp.data) - let lg = new LayerGroup("New Group", new L.FeatureGroup()); - L.geoJSON(resp.data).getLayers().forEach( (l) => { - lg.feature_group.addLayer(l); - }); + this.loading = true; + this.GeoDataService.load_from_data_depot(f).then( (lg) => { this.layer_groups.push(lg); this.map.addLayer(lg.feature_group); + this.loading = false; }); } local_file_selected (ev) { let file = ev.target.files[0]; - console.log(GeoUtils); + console.log(ev); let ext = GeoUtils.get_file_extension(file.name); console.log(ext); let reader = new FileReader(); reader.readAsText(file); reader.onload = (e) => { - if (ext === 'kml') { + if (ext === 'kmz') { + let zipper = new JSZip(); + zipper.loadAsync(file).then( (zip) => { + return zip.file('doc.kml').async('text'); + + }).then( (txt) => { + let lg = new LayerGroup("New Group", new L.FeatureGroup()); + let l = omnivore.kml.parse(txt); + l.getLayers().forEach((d) => { + lg.feature_group.addLayer(d); + }); + this.layer_groups.push(lg); + console.log(lg); + this.map.addLayer(lg.feature_group); + }); + } else if (ext === 'kml') { let lg = new LayerGroup("New Group", new L.FeatureGroup()); // let parser = new this.$window.DOMParser(); // let parsed = parser.parseFromString(e.target.result, 'text/xml'); diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js index 73b10920bb..388f46744b 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js @@ -4,6 +4,7 @@ export default class MapProject { constructor (name) { this.name = name; this.layer_groups = []; + this.description = null; } } diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js new file mode 100644 index 0000000000..5dbffc0e7e --- /dev/null +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js @@ -0,0 +1,137 @@ +import * as GeoUtils from '../utils/geo-utils'; +import LayerGroup from '../models/layer_group'; +import MapProject from '../models/map-project'; + + +export default class GeoDataService { + + constructor ($http, $q) { + 'ngInject'; + this.$http = $http; + this.$q = $q; + } + + _from_kml(text_blob) { + return this.$q( (res, rej) => { + console.log(text_blob) + let lg = new LayerGroup("New Group", new L.FeatureGroup()); + let l = omnivore.kml.parse(text_blob); + l.getLayers().forEach((d) => { + lg.feature_group.addLayer(d); + }); + res(lg); + }); + } + + _from_kmz (blob) { + return this.$q( (res, rej) => { + let zipper = new JSZip(); + zipper.loadAsync(blob).then( (zip) => { + + //loop over all the files in the archive + for (let key in zip.files) { + let ext = key.split('.').pop(); + if (ext === 'kml') { + return zip.files[key].async('text'); + } + } + }).then( (txt) => { + let lg = this._from_kml(txt); + res(lg); + }); + }); + } + + _from_json (json_blob) { + return this.$q( (res, rej) => { + let lg = new LayerGroup("New Group", new L.FeatureGroup()); + L.geoJSON(json_blob).getLayers().forEach( (l) => { + lg.feature_group.addLayer(l); + }); + res(lg); + }); + } + + _from_gpx (blob) { + return this.$q( (res, rej) => { + console.log(text_blob) + let lg = new LayerGroup("New Group", new L.FeatureGroup()); + let l = omnivore.gpx.parse(text_blob); + l.getLayers().forEach((d) => { + lg.feature_group.addLayer(d); + }); + res(lg); + }); + } + + _load_dsmap (json_blob) { + + } + + + load_from_local_file (file) { + + let ext = GeoUtils.get_file_extension(file.name); + let reader = new FileReader(); + onload = this.$q( (res, rej) => { + + }); + + reader.onload = (e) => { + let p = null; + switch (ext) { + case 'kml': + p = this._from_kml(e.target.result).then( (lg) => {return lg;}); + break; + case 'json': + p = this._from_json(e.target.result).then( (lg) => {return lg;}); + break; + case 'geojson': + p = this._from_json(e.target.result).then( (lg) => {return lg;}); + break; + case 'kmz': + p = this._from_kmz(file).then( (lg) => {return lg;}); + break; + default: + p = this._from_json(reps.data).then( (lg) => {return lg;}); + } + return p; + }; + } + + // + // @param f: a file from DataService + // returns a promise with the LayerGroup + load_from_data_depot(f) { + console.log(f); + let ext = GeoUtils.get_file_extension(f.name); + console.log(ext) + let responseType = 'text'; + if (ext === 'kmz') { + responseType = 'arraybuffer'; + } + console.log(responseType) + return this.$http.get(f.agaveUrl(), {'responseType': responseType}).then((resp) => { + console.log(resp) + let p = null; + switch (ext) { + case 'kml': + p = this._from_kml(resp.data).then( (lg) => {return lg;}); + break; + case 'json': + p = this._from_json(resp.data).then( (lg) => {return lg;}); + break; + case 'geojson': + p = this._from_json(resp.data).then( (lg) => {return lg;}); + break; + case 'kmz': + p = this._from_kmz(resp.data).then( (lg) => {return lg;}); + break; + default: + p = this._from_json(reps.data).then( (lg) => {return lg;}); + } + return p; + }); + } + +} diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js index 1b231dc458..b3fcf093b4 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js @@ -1,9 +1,10 @@ // import customOnChange from './custom-on-change'; import GeoStateService from './geo-state-service'; - +import GeoDataService from './geo-data-service'; let mod = angular.module('ds.geo.services', []); mod.service('GeoStateService', GeoStateService); +mod.service('GeoDataService', GeoDataService); // mod.directive('customOnChange', customOnChange); diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css index e53892a7d8..62fcef5462 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -21,7 +21,7 @@ } #navbar .nav-icon.active{ margin-left: 0px; - border-left: 5px solid #805ca2; + border-left: 5px solid #bd4cd9; background-color: #404040; } @@ -82,7 +82,7 @@ } #geo_sidebar .list-group-item.menu.active { - border-left: 5px solid #de5b0f; + border-left: 3px solid #de5b0f; background-color: #444444; } #geo_sidebar .list-group-item.menu.lg-tools { diff --git a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html index 86b151c9d7..d3f037e902 100644 --- a/designsafe/apps/geo/templates/designsafe/apps/geo/index.html +++ b/designsafe/apps/geo/templates/designsafe/apps/geo/index.html @@ -15,6 +15,11 @@
    {% addtoblock "js" %} + @@ -25,6 +30,7 @@ + @@ -35,6 +41,7 @@ + {% endaddtoblock %} {% addtoblock "css" %} diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 81a9952546..78096166c6 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -30,11 +30,11 @@ django: env_file: designsafe.env environment: - DJANGO_SETTINGS_MODULE=designsafe.http_debug_settings - # - DATABASE_HOST=mysql - # - DATABASE_NAME=DS_DEV - # - DATABASE_PORT=3306 - # - DATABASE_USER=DS_DEV - # - DATABASE_PASSWORD=DS_DEV + - DATABASE_HOST=mysql + - DATABASE_NAME=DS_DEV + - DATABASE_PORT=3306 + - DATABASE_USER=DS_DEV + - DATABASE_PASSWORD=DS_DEV - DS_LOCAL_DEV=True links: - redis:redis @@ -70,22 +70,6 @@ nginx: - 80:80 - 443:443 -devnginx: - image: nginx - volumes: - - ./conf/nginx.conf:/etc/nginx/nginx.conf - - ./conf/gzip.conf:/etc/nginx/gzip.conf - - ./conf/dummy.crt:/etc/ssl/dummy.crt - - ./conf/dummy.key:/etc/ssl/dummy.key - - ./conf/dhparam.pem:/etc/ssl/dhparam.pem - volumes_from: - - django - ports: - - 80:80 - - 443:443 - external_links: - - portal_django_run_1:django - worker: build: . env_file: designsafe.env From 71993dbd7ef223f75b57180fc53c9d08da9844ba Mon Sep 17 00:00:00 2001 From: Marjo Poindexter Date: Thu, 23 Mar 2017 16:13:12 -0500 Subject: [PATCH 091/520] add community data --- .../apps/api/agave/filemanager/agave.py | 2 ++ designsafe/apps/api/data/sources.py | 11 ++++++ designsafe/static/scripts/data-depot/app.js | 36 +++++++++++++++++-- .../data-depot/controllers/data-depot-nav.js | 4 +-- 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/designsafe/apps/api/agave/filemanager/agave.py b/designsafe/apps/api/agave/filemanager/agave.py index 8bb93faefa..dcb20ed147 100644 --- a/designsafe/apps/api/agave/filemanager/agave.py +++ b/designsafe/apps/api/agave/filemanager/agave.py @@ -26,6 +26,8 @@ class AgaveFileManager(BaseFileManager): SYSTEM_ID_PATHS = [ {'regex': r'^designsafe.storage.default$', 'path': '/corral-repl/tacc/NHERI/shared'}, + {'regex': r'^designsafe.storage.community$', + 'path': '/corral-repl/tacc/NHERI/community'}, {'regex': r'^project\-', 'path': '/corral-repl/tacc/NHERI/projects'} ] diff --git a/designsafe/apps/api/data/sources.py b/designsafe/apps/api/data/sources.py index 6c74b71477..e742a5a8d6 100644 --- a/designsafe/apps/api/data/sources.py +++ b/designsafe/apps/api/data/sources.py @@ -47,6 +47,17 @@ class SourcesApi(object): "icon": "fa-globe" }, }, + { + "id": "community", + "resource": "agave", + "defaultPath": None, + "name": "Community data", + "_visible": True, + "_indexed": True, + "_extra": { + "icon": "fa-globe" + }, + }, { "id": "box", "resource": "box", diff --git a/designsafe/static/scripts/data-depot/app.js b/designsafe/static/scripts/data-depot/app.js index 2c5872287f..6f7f14924b 100644 --- a/designsafe/static/scripts/data-depot/app.js +++ b/designsafe/static/scripts/data-depot/app.js @@ -312,8 +312,40 @@ } }) .state('communityData', { - url: '/community/', - template: '
    local/communityData.html
    ' + // url: '/community/', + // template: '
    local/communityData.html
    ' + url: '/agave/{systemId}/', + controller: 'MyDataCtrl', + templateUrl: '/static/scripts/data-depot/templates/agave-data-listing.html', + params: { + systemId: 'designsafe.storage.community', + filePath: '/' + }, + resolve: { + 'listing': ['$stateParams', 'DataBrowserService', function($stateParams, DataBrowserService) { + var options = { + system: ($stateParams.systemId || 'designsafe.storage.community'), + path: ($stateParams.filePath || '/') + }; + // if (options.path === '/') { + // options.path = Django.user; + // } + DataBrowserService.apiParams.fileMgr = 'agave'; + DataBrowserService.apiParams.baseUrl = '/api/agave/files'; + DataBrowserService.apiParams.searchState = 'dataSearch'; + return DataBrowserService.browse(options); + }], + 'auth': function($q) { + if (Django.context.authenticated) { + return true; + } else { + return $q.reject({ + type: 'authn', + context: Django.context + }); + } + } + } }) .state('trainingMaterials', { url: '/training/', diff --git a/designsafe/static/scripts/data-depot/controllers/data-depot-nav.js b/designsafe/static/scripts/data-depot/controllers/data-depot-nav.js index 83f8bbaa22..8922b5c445 100644 --- a/designsafe/static/scripts/data-depot/controllers/data-depot-nav.js +++ b/designsafe/static/scripts/data-depot/controllers/data-depot-nav.js @@ -14,12 +14,12 @@ name: 'Published', collapsible: false, state: 'publicData' - }/*, + }, { name: 'Community Data', collapsible: false, state: 'communityData' - }, + }/*, { name: 'Training Materials', collapsible: false, From efe2da13971349228cad40f5f136ab1424711309 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 23 Mar 2017 16:53:13 -0500 Subject: [PATCH 092/520] Fixing old test to account for setting queue --- designsafe/apps/api/data/agave/tests/test_filemanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designsafe/apps/api/data/agave/tests/test_filemanager.py b/designsafe/apps/api/data/agave/tests/test_filemanager.py index eaa705c191..4a29e13cb3 100644 --- a/designsafe/apps/api/data/agave/tests/test_filemanager.py +++ b/designsafe/apps/api/data/agave/tests/test_filemanager.py @@ -713,5 +713,5 @@ def test_rename(self, mock_agave_from_file_path, mock_share_task): self.user.username, path, agave_client=fm.agave_client) mock_share_task.assert_called_with( - args=(self.user.username, file_id, permissions, True)) + args=(self.user.username, file_id, permissions, True), queue='indexing') From e872e494ecdc7dd1a1b9b71b5660c288d0194826 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 23 Mar 2017 16:58:53 -0500 Subject: [PATCH 093/520] Updating autoscaling for workers --- bin/run-celery.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/run-celery.sh b/bin/run-celery.sh index ace4ca0013..d28c81df45 100755 --- a/bin/run-celery.sh +++ b/bin/run-celery.sh @@ -2,5 +2,5 @@ # Run Celery as the DesignSafe Community Account su tg458981 -c "celery -A designsafe beat -l info --pidfile= --schedule=/tmp/celerybeat-schedule" & -su tg458981 -c "celery -A designsafe worker -l info --autoscale=6,3 --concurrency=4" -su tg458981 -c "celery -A designsafe worker -l info --autoscale=6,3 --concurrenty=4" +su tg458981 -c "celery -A designsafe worker -l info --autoscale=15,5 -Q indexing,files" +su tg458981 -c "celery -A designsafe worker -l info --autoscale=10,3 -Q default,api" From 0d3859d82a5075b31024a47cf5b47b694361f129 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Fri, 24 Mar 2017 09:21:45 -0500 Subject: [PATCH 094/520] Typo on run-celery --- bin/run-celery.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/run-celery.sh b/bin/run-celery.sh index d28c81df45..564cd0896f 100755 --- a/bin/run-celery.sh +++ b/bin/run-celery.sh @@ -2,5 +2,5 @@ # Run Celery as the DesignSafe Community Account su tg458981 -c "celery -A designsafe beat -l info --pidfile= --schedule=/tmp/celerybeat-schedule" & -su tg458981 -c "celery -A designsafe worker -l info --autoscale=15,5 -Q indexing,files" +su tg458981 -c "celery -A designsafe worker -l info --autoscale=15,5 -Q indexing,files" & su tg458981 -c "celery -A designsafe worker -l info --autoscale=10,3 -Q default,api" From 34eb947eb91e1ad2a28fcbeaf66fb4295b98b218 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Fri, 24 Mar 2017 10:34:51 -0500 Subject: [PATCH 095/520] Modifying max_retries for watch_job task --- designsafe/apps/workspace/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designsafe/apps/workspace/tasks.py b/designsafe/apps/workspace/tasks.py index 410b3c7f41..bc477977b4 100644 --- a/designsafe/apps/workspace/tasks.py +++ b/designsafe/apps/workspace/tasks.py @@ -70,7 +70,7 @@ def submit_job(request, username, job_post): logger.warning(err_resp) raise JobSubmitError(**err_resp) -@shared_task(bind=True) +@shared_task(bind=True, max_retries=None) def watch_job_status(self, username, job_id, current_status=None): try: user = get_user_model().objects.get(username=username) @@ -166,7 +166,7 @@ def watch_job_status(self, username, job_id, current_status=None): # event_users=[job['owner']]) except Exception as e: logger.exception('Error indexing job output; scheduling retry') - raise self.retry(exc=e, countdown=60, max_retries=3) + raise self.retry(exc=e, countdown=60) elif current_status and current_status == job_status: # DO NOT notify, but still queue another watch task From 0ac2a17856a6f61074d31ee2c192bbe324902b06 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Fri, 24 Mar 2017 14:40:29 -0500 Subject: [PATCH 096/520] It's 2017 and scrollbars are still a pain to style --- .../static/designsafe/apps/geo/html/map.html | 22 +- .../apps/geo/scripts/build/bundle.js | 215 +++++------------- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/controllers/map-sidebar.js | 100 +------- .../geo/scripts/services/geo-data-service.js | 94 +++++--- .../static/designsafe/apps/geo/styles/geo.css | 20 +- 6 files changed, 156 insertions(+), 297 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html index d50a39bbda..103881f4d2 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html +++ b/designsafe/apps/geo/static/designsafe/apps/geo/html/map.html @@ -19,12 +19,9 @@
    + +
    + +
    + + +
    +
    + + +
    +
    +
    diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index 9e40877485..c13d0560cd 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -500,108 +500,16 @@ var MapSidebarCtrl = function () { var _this4 = this; var file = ev.target.files[0]; - console.log(ev); - - var ext = GeoUtils.get_file_extension(file.name); - console.log(ext); - var reader = new FileReader(); - reader.readAsText(file); - reader.onload = function (e) { - if (ext === 'kmz') { - var zipper = new JSZip(); - zipper.loadAsync(file).then(function (zip) { - return zip.file('doc.kml').async('text'); - }).then(function (txt) { - var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); - var l = omnivore.kml.parse(txt); - l.getLayers().forEach(function (d) { - lg.feature_group.addLayer(d); - }); - _this4.layer_groups.push(lg); - console.log(lg); - _this4.map.addLayer(lg.feature_group); - }); - } else if (ext === 'kml') { - (function () { - var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); - // let parser = new this.$window.DOMParser(); - // let parsed = parser.parseFromString(e.target.result, 'text/xml'); - var l = omnivore.kml.parse(e.target.result); - // debugger - l.getLayers().forEach(function (d) { - lg.feature_group.addLayer(d); - }); - _this4.layer_groups.push(lg); - _this4.map.addLayer(lg.feature_group); - })(); - } else if (ext === 'gpx') { - var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); - // let parser = new this.$window.DOMParser(); - // let parsed = parser.parseFromString(e.target.result, 'text/xml'); - var l = omnivore.gpx.parse(e.target.result); - lg.feature_group.addLayer(l); - - _this4.layer_groups.push(lg); - _this4.map.addLayer(lg.feature_group); - } else { - var json = JSON.parse(e.target.result); - - // we add in a field into the json blob when saved. If it is such, - // handle potential multiple layers. - if (json.ds_map) { - // each feature in the collection represents a layer - json.features.forEach(function (f) { - var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); - L.geoJSON(f).getLayers().forEach(function (l) { - lg.feature_group.addLayer(l); - }); - _this4.layer_groups.push(lg); - _this4.map.addLayer(lg.feature_group); - }); - } else { - var _lg = new _layer_group2.default("New Group", new L.FeatureGroup()); - L.geoJSON(json).getLayers().forEach(function (l) { - _this4.layer_groups[0].feature_group.addLayer(l); - }); - _this4.layer_groups.push(_lg); - _this4.map.addLayer(_lg.feature_group); - } - }; + var lf = this.GeoDataService.load_from_local_file(file).then(function (lg) { + console.log(lg); + _this4.layer_groups.push(lg); + _this4.map.addLayer(lg.feature_group); var bounds = []; _this4.layer_groups.forEach(function (lg) { bounds.push(lg.feature_group.getBounds()); }); _this4.map.fitBounds(bounds); - }; - } - }, { - key: 'load_image', - value: function load_image(ev) { - var _this5 = this; - - var files = ev.target.files; - for (var i = 0; i < files.length; i++) { - var file = files[0]; - var reader = new FileReader(); // use HTML5 file reader to get the file - - reader.readAsArrayBuffer(file); - reader.onloadend = function (e) { - // get EXIF data - var exif = EXIF.readFromBinaryFile(e.target.result); - - var lat = exif.GPSLatitude; - var lon = exif.GPSLongitude; - - //Convert coordinates to WGS84 decimal - var latRef = exif.GPSLatitudeRef || "N"; - var lonRef = exif.GPSLongitudeRef || "W"; - lat = (lat[0] + lat[1] / 60 + lat[2] / 3600) * (latRef == "N" ? 1 : -1); - lon = (lon[0] + lon[1] / 60 + lon[2] / 3600) * (lonRef == "W" ? -1 : 1); - - //Send the coordinates to your map - _this5.active_layer_group.AddMarker(lat, lon); - }; - } + }); } }, { key: 'update_layer_style', @@ -759,15 +667,33 @@ var GeoDataService = function () { key: '_from_gpx', value: function _from_gpx(blob) { return this.$q(function (res, rej) { - console.log(text_blob); + // console.log(text_blob) var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); - var l = omnivore.gpx.parse(text_blob); + var l = omnivore.gpx.parse(blob); l.getLayers().forEach(function (d) { lg.feature_group.addLayer(d); }); res(lg); }); } + }, { + key: '_from_image', + value: function _from_image(file) { + return this.$q(function (res, rej) { + var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); + var exif = EXIF.readFromBinaryFile(file); + + var lat = exif.GPSLatitude; + var lon = exif.GPSLongitude; + + //Convert coordinates to WGS84 decimal + var latRef = exif.GPSLatitudeRef || "N"; + var lonRef = exif.GPSLongitudeRef || "W"; + lat = (lat[0] + lat[1] / 60 + lat[2] / 3600) * (latRef == "N" ? 1 : -1); + lon = (lon[0] + lon[1] / 60 + lon[2] / 3600) * (lonRef == "W" ? -1 : 1); + lg.feature_group.addLayer(d); + }); + } }, { key: '_load_dsmap', value: function _load_dsmap(json_blob) {} @@ -776,40 +702,36 @@ var GeoDataService = function () { value: function load_from_local_file(file) { var _this2 = this; - var ext = GeoUtils.get_file_extension(file.name); - var reader = new FileReader(); - onload = this.$q(function (res, rej) {}); - - reader.onload = function (e) { - var p = null; - switch (ext) { - case 'kml': - p = _this2._from_kml(e.target.result).then(function (lg) { - return lg; - }); - break; - case 'json': - p = _this2._from_json(e.target.result).then(function (lg) { - return lg; - }); - break; - case 'geojson': - p = _this2._from_json(e.target.result).then(function (lg) { - return lg; - }); - break; - case 'kmz': - p = _this2._from_kmz(file).then(function (lg) { - return lg; - }); - break; - default: - p = _this2._from_json(reps.data).then(function (lg) { - return lg; - }); - } - return p; - }; + return this.$q(function (res, rej) { + var ext = GeoUtils.get_file_extension(file.name); + var reader = new FileReader(); + reader.readAsText(file); + reader.onload = function (e) { + var p = null; + switch (ext) { + case 'kml': + p = _this2._from_kml(e.target.result); + break; + case 'json': + p = _this2._from_json(e.target.result); + break; + case 'geojson': + p = _this2._from_json(e.target.result); + break; + case 'kmz': + p = _this2._from_kmz(file); + break; + case 'gpx': + p = _this2._from_gpx(e.target.result); + break; + case 'jpeg': + p = _this2._from_image(file); + default: + p = _this2._from_json(reps.data); + } + return res(p); + }; + }); } // @@ -821,42 +743,31 @@ var GeoDataService = function () { value: function load_from_data_depot(f) { var _this3 = this; - console.log(f); var ext = GeoUtils.get_file_extension(f.name); - console.log(ext); var responseType = 'text'; if (ext === 'kmz') { responseType = 'arraybuffer'; } - console.log(responseType); return this.$http.get(f.agaveUrl(), { 'responseType': responseType }).then(function (resp) { - console.log(resp); var p = null; switch (ext) { case 'kml': - p = _this3._from_kml(resp.data).then(function (lg) { - return lg; - }); + p = _this3._from_kml(resp.data); break; case 'json': - p = _this3._from_json(resp.data).then(function (lg) { - return lg; - }); + p = _this3._from_json(resp.data); break; case 'geojson': - p = _this3._from_json(resp.data).then(function (lg) { - return lg; - }); + p = _this3._from_json(resp.data); break; case 'kmz': - p = _this3._from_kmz(resp.data).then(function (lg) { - return lg; - }); + p = _this3._from_kmz(resp.data); + break; + case 'gpx': + p = _this3._from_gpx(resp.data); break; default: - p = _this3._from_json(reps.data).then(function (lg) { - return lg; - }); + p = _this3._from_json(resp.data); } return p; }); diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 2bcfc8d025..4d830b46ef 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 67e80c60945d6ebb87c7","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["DBModalCtrl","$scope","$uibModalInstance","selected","dismiss","label","fg","feature_group","show","show_contents","getLayers","layer_groups","description","get_file_extension","fname","split","pop","mod","controller","angular","module","service","$timeout","$window","$uibModal","DataService","$http","GeoDataService","primary_color","open_db_modal","streets","L","tileLayer","maxZoom","satellite","control","layers","basemaps","addTo","map","zoomControl","setPosition","invalidateSize","active_layer_group","current_layer","$apply","on","e","object","options","color","secondary_color","fillColor","fillOpacity","addLayer","dc","Control","position","draw","circle","edit","featureGroup","remove","lg","push","length","select_active_layer_group","removeLayer","splice","i","removeControl","drawControl","add_draw_controls","active","modal","result","then","f","$","click","Marker","Polygon","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","getBounds","src_lg","console","log","loading","file","ev","target","ext","GeoUtils","reader","FileReader","readAsText","onload","zipper","JSZip","loadAsync","zip","txt","l","omnivore","kml","parse","forEach","d","gpx","json","JSON","ds_map","features","geoJSON","bounds","files","readAsArrayBuffer","exif","EXIF","readFromBinaryFile","lat","GPSLatitude","lonRef","GPSLongitudeRef","lon","setStyle","out","map_title","blob","Blob","a","document","createElement","href","url","textContent","restrict","scope","handler","link","element","$q","res","text_blob","rej","key","async","json_blob","p","responseType","get","agaveUrl","$state","GeoStateService","templateUrl","resolve","auth","$uibTooltipProvider","config"],"mappings":";AAAA;AACA;;AAEA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M;;;;;;;;;;;;;;;ACHU;AAAA;;AAC3B,OAAK1B,MAAL,GAAcA,MAAd;AACA,OAAK4J,MAAL,GAAcA,MAAd;AACA;AACD,C;;kBANkBC,S;;;;;;;;;;;;;ACArB;;AACA;;AACA;;AAEA,IAAI7I,MAAME,QAAQC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEqD;AACnD;;AAC4B;AAC1BuH,SAAK,EADqB;AAE1BoB,aAF0B;AAAA;AAI1BC,aAAS;AACPC,YAAkB;AAChB,eAAO,IAAP;AACD;AAHM;AAJiB,GAA5B;;AAWA;AACAC,KAAA;AAED;;AAEDjJ,IAAIkJ,MAAJ,CAAWA,MAAX","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 11);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 67e80c60945d6ebb87c7","export default class DBModalCtrl {\n\n constructor ($scope, $uibModalInstance) {\n 'ngInject';\n this.$scope = $scope;\n this.$uibModalInstance = $uibModalInstance;\n this.selected = null;\n }\n\n ok () {\n this.$uibModalInstance.close(this.selected);\n };\n\n cancel () {\n this.$uibModalInstance.dismiss('cancel');\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n this.description = null;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","import MapSidebarCtrl from './map-sidebar';\nimport DBModalCtrl from './db-modal';\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\nmod.controller('DBModalCtrl', DBModalCtrl);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\n\nmod.directive('customOnChange', customOnChange);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\nimport GeoStateService from './geo-state-service';\nimport GeoDataService from './geo-data-service';\n\nlet mod = angular.module('ds.geo.services', []);\nmod.service('GeoStateService', GeoStateService);\nmod.service('GeoDataService', GeoDataService);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal, DataService, $http, GeoDataService) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n this.DataService = DataService;\n this.$http = $http;\n this.GeoDataService = GeoDataService;\n\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n this.open_db_modal = this.open_db_modal.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n let modal = this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: \"DBModalCtrl as vm\",\n });\n modal.result.then( (f) => {this.load_from_data_depot(f);});\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n load_from_data_depot(f) {\n this.loading = true;\n this.GeoDataService.load_from_data_depot(f).then( (lg) => {\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n this.loading = false;\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n console.log(ev);\n\n let ext = GeoUtils.get_file_extension(file.name);\n console.log(ext);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n if (ext === 'kmz') {\n let zipper = new JSZip();\n zipper.loadAsync(file).then( (zip) => {\n return zip.file('doc.kml').async('text');\n\n }).then( (txt) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let l = omnivore.kml.parse(txt);\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n console.log(lg);\n this.map.addLayer(lg.feature_group);\n });\n } else if (ext === 'kml') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.kml.parse(e.target.result);\n // debugger\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else if (ext === 'gpx') {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n // let parser = new this.$window.DOMParser();\n // let parsed = parser.parseFromString(e.target.result, 'text/xml');\n let l = omnivore.gpx.parse(e.target.result);\n lg.feature_group.addLayer(l);\n\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n } else {\n let json = JSON.parse(e.target.result);\n\n // we add in a field into the json blob when saved. If it is such,\n // handle potential multiple layers.\n if (json.ds_map) {\n // each feature in the collection represents a layer\n json.features.forEach( (f) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(f).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n });\n }\n else {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json).getLayers().forEach( (l) => {\n this.layer_groups[0].feature_group.addLayer(l);\n });\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n }\n\n };\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n };\n }\n\n load_image (ev) {\n var files = ev.target.files;\n for (let i = 0; i < files.length; i++) {\n let file = files[0];\n let reader = new FileReader; // use HTML5 file reader to get the file\n\n reader.readAsArrayBuffer(file);\n reader.onloadend = (e) => {\n // get EXIF data\n let exif = EXIF.readFromBinaryFile(e.target.result);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n\n //Send the coordinates to your map\n this.active_layer_group.AddMarker(lat,lon);\n };\n }\n }\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import * as GeoUtils from '../utils/geo-utils';\nimport LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\n\n\nexport default class GeoDataService {\n\n constructor ($http, $q) {\n 'ngInject';\n this.$http = $http;\n this.$q = $q;\n }\n\n _from_kml(text_blob) {\n return this.$q( (res, rej) => {\n console.log(text_blob)\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let l = omnivore.kml.parse(text_blob);\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n res(lg);\n });\n }\n\n _from_kmz (blob) {\n return this.$q( (res, rej) => {\n let zipper = new JSZip();\n zipper.loadAsync(blob).then( (zip) => {\n\n //loop over all the files in the archive\n for (let key in zip.files) {\n let ext = key.split('.').pop();\n if (ext === 'kml') {\n return zip.files[key].async('text');\n }\n }\n }).then( (txt) => {\n let lg = this._from_kml(txt);\n res(lg);\n });\n });\n }\n\n _from_json (json_blob) {\n return this.$q( (res, rej) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json_blob).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n res(lg);\n });\n }\n\n _from_gpx (blob) {\n return this.$q( (res, rej) => {\n console.log(text_blob)\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let l = omnivore.gpx.parse(text_blob);\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n res(lg);\n });\n }\n\n _load_dsmap (json_blob) {\n\n }\n\n\n load_from_local_file (file) {\n\n let ext = GeoUtils.get_file_extension(file.name);\n let reader = new FileReader();\n onload = this.$q( (res, rej) => {\n\n });\n\n reader.onload = (e) => {\n let p = null;\n switch (ext) {\n case 'kml':\n p = this._from_kml(e.target.result).then( (lg) => {return lg;});\n break;\n case 'json':\n p = this._from_json(e.target.result).then( (lg) => {return lg;});\n break;\n case 'geojson':\n p = this._from_json(e.target.result).then( (lg) => {return lg;});\n break;\n case 'kmz':\n p = this._from_kmz(file).then( (lg) => {return lg;});\n break;\n default:\n p = this._from_json(reps.data).then( (lg) => {return lg;});\n }\n return p;\n };\n }\n\n //\n // @param f: a file from DataService\n // returns a promise with the LayerGroup\n load_from_data_depot(f) {\n console.log(f);\n let ext = GeoUtils.get_file_extension(f.name);\n console.log(ext)\n let responseType = 'text';\n if (ext === 'kmz') {\n responseType = 'arraybuffer';\n }\n console.log(responseType)\n return this.$http.get(f.agaveUrl(), {'responseType': responseType}).then((resp) => {\n console.log(resp)\n let p = null;\n switch (ext) {\n case 'kml':\n p = this._from_kml(resp.data).then( (lg) => {return lg;});\n break;\n case 'json':\n p = this._from_json(resp.data).then( (lg) => {return lg;});\n break;\n case 'geojson':\n p = this._from_json(resp.data).then( (lg) => {return lg;});\n break;\n case 'kmz':\n p = this._from_kmz(resp.data).then( (lg) => {return lg;});\n break;\n default:\n p = this._from_json(reps.data).then( (lg) => {return lg;});\n }\n return p;\n });\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js","export default class GeoStateService {\n\n constructor ($scope, $state) {\n this.$scope = $scope;\n this.$state = $state;\n this.last_db_path = null;\n }\n\n \n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap 89ed12c05e00eec561c3","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["DBModalCtrl","$scope","$uibModalInstance","selected","dismiss","label","fg","feature_group","show","show_contents","getLayers","layer_groups","description","get_file_extension","fname","split","pop","mod","controller","angular","module","service","$timeout","$window","$uibModal","DataService","$http","GeoDataService","primary_color","open_db_modal","streets","L","tileLayer","maxZoom","satellite","control","layers","basemaps","addTo","map","zoomControl","setPosition","invalidateSize","active_layer_group","current_layer","$apply","on","e","object","options","color","secondary_color","fillColor","fillOpacity","addLayer","dc","Control","position","draw","circle","edit","featureGroup","remove","lg","push","length","select_active_layer_group","removeLayer","splice","i","removeControl","drawControl","add_draw_controls","active","modal","result","then","f","$","click","Marker","Polygon","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","getBounds","src_lg","console","log","loading","file","ev","target","bounds","forEach","setStyle","out","map_title","json","features","blob","Blob","JSON","a","document","createElement","href","url","textContent","restrict","scope","handler","link","element","GeoUtils","$q","res","text_blob","l","omnivore","kml","parse","d","rej","zipper","key","zip","files","ext","async","txt","geoJSON","json_blob","gpx","exif","EXIF","readFromBinaryFile","lat","GPSLatitude","lon","GPSLongitude","latRef","GPSLatitudeRef","reader","readAsText","onload","p","_from_json","_from_kmz","_from_gpx","_from_image","responseType","get","resp","data","$state","GeoStateService","templateUrl","resolve","auth","$uibTooltipProvider","config"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AAC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AED;AACA;AACA;;;;AACwB;AAAA;;AACtB,UAAIY,MAAMd,SAASxG,kBAAT,CAA4BgE,CAAtC;AACA,UAAI6E,cAAJ;AACmB;AACjBA,uBAAe,aAAf;AACD;AACD,aAAO,KAAKhI,KAAL,CAAWiI,EAAiE;AACjF,YAAIN,IAAI,IAAR;AACA;AACE,eAAK,KAAL;AACEA,gBAAK,KAAL;AACA;AACF,eAAK,MAAL;AACEA,gBAAI,OAAKC,UAAL,CAAgBM,KAAKC,IAArB,CAAJ;AACA;AACF,eAAK,OAAL;AACER,gBAAI,OAAKC,UAAL,CAAgBM,KAAKC,IAArB,CAAJ;AACA;AACF,eAAK,KAAL;AACER,gBAAI,OAAKE,SAAL,CAAeK,KAAKC,IAApB,CAAJ;AACA;AACF,eAAK,KAAL;AACER,gBAAI,OAAKG,SAAL,CAAeI,KAAKC,IAApB,CAAJ;AACA;AACF;AACER,gBAAI,OAAKC,UAAL,CAAgBM,KAAKC,IAArB,CAAJ;AAjBJ;AAmBA,eAAOR,CAAP;AACD,OAtBM,CAAP;AAuBD;;;;;;kBArJkB1H,M;;;;;;;;;;;;;;;ACHU;AAAA;;AAC3B,OAAK1B,MAAL,GAAcA,MAAd;AACA,OAAK6J,MAAL,GAAcA,MAAd;AACA;AACD,C;;kBANkBC,S;;;;;;;;;;;;;ACArB;;AACA;;AACA;;AAEA,IAAI9I,MAAME,QAAQC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEqD;AACnD;;AAC4B;AAC1B0F,SAAK,EADqB;AAE1BkD,aAF0B;AAAA;AAI1BC,aAAS;AACPC,YAAkB;AAChB,eAAO,IAAP;AACD;AAHM;AAJiB,GAA5B;;AAWA;AACAC,KAAA;AAED;;AAEDlJ,IAAImJ,MAAJ,CAAWA,MAAX","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 11);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 89ed12c05e00eec561c3","export default class DBModalCtrl {\n\n constructor ($scope, $uibModalInstance) {\n 'ngInject';\n this.$scope = $scope;\n this.$uibModalInstance = $uibModalInstance;\n this.selected = null;\n }\n\n ok () {\n this.$uibModalInstance.close(this.selected);\n };\n\n cancel () {\n this.$uibModalInstance.dismiss('cancel');\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n this.description = null;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","import MapSidebarCtrl from './map-sidebar';\nimport DBModalCtrl from './db-modal';\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\nmod.controller('DBModalCtrl', DBModalCtrl);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\n\nmod.directive('customOnChange', customOnChange);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\nimport GeoStateService from './geo-state-service';\nimport GeoDataService from './geo-data-service';\n\nlet mod = angular.module('ds.geo.services', []);\nmod.service('GeoStateService', GeoStateService);\nmod.service('GeoDataService', GeoDataService);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal, DataService, $http, GeoDataService) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n this.DataService = DataService;\n this.$http = $http;\n this.GeoDataService = GeoDataService;\n\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n this.open_db_modal = this.open_db_modal.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n let modal = this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: \"DBModalCtrl as vm\",\n });\n modal.result.then( (f) => {this.load_from_data_depot(f);});\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n load_from_data_depot(f) {\n this.loading = true;\n this.GeoDataService.load_from_data_depot(f).then( (lg) => {\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n this.loading = false;\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let lf = this.GeoDataService.load_from_local_file(file).then( (lg) => {\n console.log(lg);\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n });\n\n }\n\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import * as GeoUtils from '../utils/geo-utils';\nimport LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\n\n\nexport default class GeoDataService {\n\n constructor ($http, $q) {\n 'ngInject';\n this.$http = $http;\n this.$q = $q;\n }\n\n _from_kml(text_blob) {\n return this.$q( (res, rej) => {\n console.log(text_blob)\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let l = omnivore.kml.parse(text_blob);\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n res(lg);\n });\n }\n\n _from_kmz (blob) {\n return this.$q( (res, rej) => {\n let zipper = new JSZip();\n zipper.loadAsync(blob).then( (zip) => {\n\n //loop over all the files in the archive\n for (let key in zip.files) {\n let ext = key.split('.').pop();\n if (ext === 'kml') {\n return zip.files[key].async('text');\n }\n }\n }).then( (txt) => {\n let lg = this._from_kml(txt);\n res(lg);\n });\n });\n }\n\n _from_json (json_blob) {\n return this.$q( (res, rej) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json_blob).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n res(lg);\n });\n }\n\n _from_gpx (blob) {\n return this.$q( (res, rej) => {\n // console.log(text_blob)\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let l = omnivore.gpx.parse(blob);\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n res(lg);\n });\n }\n\n _from_image (file) {\n return this.$q( (res, rej) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let exif = EXIF.readFromBinaryFile(file);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n lg.feature_group.addLayer(d);\n });\n }\n\n\n _load_dsmap (json_blob) {\n\n }\n\n\n load_from_local_file (file) {\n return this.$q( (res, rej) => {\n let ext = GeoUtils.get_file_extension(file.name);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let p = null;\n switch (ext) {\n case 'kml':\n p = this._from_kml(e.target.result);\n break;\n case 'json':\n p = this._from_json(e.target.result);\n break;\n case 'geojson':\n p = this._from_json(e.target.result);\n break;\n case 'kmz':\n p = this._from_kmz(file);\n break;\n case 'gpx':\n p = this._from_gpx(e.target.result);\n break;\n case 'jpeg':\n p = this._from_image(file);\n default:\n p = this._from_json(reps.data);\n }\n return res(p);\n };\n });\n }\n\n //\n // @param f: a file from DataService\n // returns a promise with the LayerGroup\n load_from_data_depot(f) {\n let ext = GeoUtils.get_file_extension(f.name);\n let responseType = 'text';\n if (ext === 'kmz') {\n responseType = 'arraybuffer';\n }\n return this.$http.get(f.agaveUrl(), {'responseType': responseType}).then((resp) => {\n let p = null;\n switch (ext) {\n case 'kml':\n p = this._from_kml(resp.data);\n break;\n case 'json':\n p = this._from_json(resp.data);\n break;\n case 'geojson':\n p = this._from_json(resp.data);\n break;\n case 'kmz':\n p = this._from_kmz(resp.data);\n break;\n case 'gpx':\n p = this._from_gpx(resp.data);\n break;\n default:\n p = this._from_json(resp.data);\n }\n return p;\n });\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js","export default class GeoStateService {\n\n constructor ($scope, $state) {\n this.$scope = $scope;\n this.$state = $state;\n this.last_db_path = null;\n }\n\n \n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js index 72b5ab14db..23ae4b5428 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js @@ -178,108 +178,20 @@ export default class MapSidebarCtrl { local_file_selected (ev) { let file = ev.target.files[0]; - console.log(ev); - - let ext = GeoUtils.get_file_extension(file.name); - console.log(ext); - let reader = new FileReader(); - reader.readAsText(file); - reader.onload = (e) => { - if (ext === 'kmz') { - let zipper = new JSZip(); - zipper.loadAsync(file).then( (zip) => { - return zip.file('doc.kml').async('text'); - - }).then( (txt) => { - let lg = new LayerGroup("New Group", new L.FeatureGroup()); - let l = omnivore.kml.parse(txt); - l.getLayers().forEach((d) => { - lg.feature_group.addLayer(d); - }); - this.layer_groups.push(lg); - console.log(lg); - this.map.addLayer(lg.feature_group); - }); - } else if (ext === 'kml') { - let lg = new LayerGroup("New Group", new L.FeatureGroup()); - // let parser = new this.$window.DOMParser(); - // let parsed = parser.parseFromString(e.target.result, 'text/xml'); - let l = omnivore.kml.parse(e.target.result); - // debugger - l.getLayers().forEach((d) => { - lg.feature_group.addLayer(d); - }); - this.layer_groups.push(lg); - this.map.addLayer(lg.feature_group); - } else if (ext === 'gpx') { - let lg = new LayerGroup("New Group", new L.FeatureGroup()); - // let parser = new this.$window.DOMParser(); - // let parsed = parser.parseFromString(e.target.result, 'text/xml'); - let l = omnivore.gpx.parse(e.target.result); - lg.feature_group.addLayer(l); - - this.layer_groups.push(lg); - this.map.addLayer(lg.feature_group); - } else { - let json = JSON.parse(e.target.result); - - // we add in a field into the json blob when saved. If it is such, - // handle potential multiple layers. - if (json.ds_map) { - // each feature in the collection represents a layer - json.features.forEach( (f) => { - let lg = new LayerGroup("New Group", new L.FeatureGroup()); - L.geoJSON(f).getLayers().forEach( (l) => { - lg.feature_group.addLayer(l); - }); - this.layer_groups.push(lg); - this.map.addLayer(lg.feature_group); - }); - } - else { - let lg = new LayerGroup("New Group", new L.FeatureGroup()); - L.geoJSON(json).getLayers().forEach( (l) => { - this.layer_groups[0].feature_group.addLayer(l); - }); - this.layer_groups.push(lg); - this.map.addLayer(lg.feature_group); - } - - }; + let lf = this.GeoDataService.load_from_local_file(file).then( (lg) => { + console.log(lg); + this.layer_groups.push(lg); + this.map.addLayer(lg.feature_group); let bounds = []; this.layer_groups.forEach((lg) => { bounds.push(lg.feature_group.getBounds()); }); this.map.fitBounds(bounds); - }; - } + }); - load_image (ev) { - var files = ev.target.files; - for (let i = 0; i < files.length; i++) { - let file = files[0]; - let reader = new FileReader; // use HTML5 file reader to get the file - - reader.readAsArrayBuffer(file); - reader.onloadend = (e) => { - // get EXIF data - let exif = EXIF.readFromBinaryFile(e.target.result); - - let lat = exif.GPSLatitude; - let lon = exif.GPSLongitude; - - //Convert coordinates to WGS84 decimal - let latRef = exif.GPSLatitudeRef || "N"; - let lonRef = exif.GPSLongitudeRef || "W"; - lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == "N" ? 1 : -1); - lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == "W" ? -1 : 1); - - //Send the coordinates to your map - this.active_layer_group.AddMarker(lat,lon); - }; - } } + update_layer_style (prop) { this.current_layer.setStyle({prop: this.current_layer.options[prop]}); } diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js index 5dbffc0e7e..e3a9fb923c 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js @@ -54,9 +54,9 @@ export default class GeoDataService { _from_gpx (blob) { return this.$q( (res, rej) => { - console.log(text_blob) + // console.log(text_blob) let lg = new LayerGroup("New Group", new L.FeatureGroup()); - let l = omnivore.gpx.parse(text_blob); + let l = omnivore.gpx.parse(blob); l.getLayers().forEach((d) => { lg.feature_group.addLayer(d); }); @@ -64,71 +64,91 @@ export default class GeoDataService { }); } - _load_dsmap (json_blob) { + _from_image (file) { + return this.$q( (res, rej) => { + let lg = new LayerGroup("New Group", new L.FeatureGroup()); + let exif = EXIF.readFromBinaryFile(file); + let lat = exif.GPSLatitude; + let lon = exif.GPSLongitude; + + //Convert coordinates to WGS84 decimal + let latRef = exif.GPSLatitudeRef || "N"; + let lonRef = exif.GPSLongitudeRef || "W"; + lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == "N" ? 1 : -1); + lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == "W" ? -1 : 1); + lg.feature_group.addLayer(d); + }); } - load_from_local_file (file) { + _load_dsmap (json_blob) { - let ext = GeoUtils.get_file_extension(file.name); - let reader = new FileReader(); - onload = this.$q( (res, rej) => { + } - }); - reader.onload = (e) => { - let p = null; - switch (ext) { - case 'kml': - p = this._from_kml(e.target.result).then( (lg) => {return lg;}); - break; - case 'json': - p = this._from_json(e.target.result).then( (lg) => {return lg;}); - break; - case 'geojson': - p = this._from_json(e.target.result).then( (lg) => {return lg;}); - break; - case 'kmz': - p = this._from_kmz(file).then( (lg) => {return lg;}); - break; - default: - p = this._from_json(reps.data).then( (lg) => {return lg;}); - } - return p; - }; + load_from_local_file (file) { + return this.$q( (res, rej) => { + let ext = GeoUtils.get_file_extension(file.name); + let reader = new FileReader(); + reader.readAsText(file); + reader.onload = (e) => { + let p = null; + switch (ext) { + case 'kml': + p = this._from_kml(e.target.result); + break; + case 'json': + p = this._from_json(e.target.result); + break; + case 'geojson': + p = this._from_json(e.target.result); + break; + case 'kmz': + p = this._from_kmz(file); + break; + case 'gpx': + p = this._from_gpx(e.target.result); + break; + case 'jpeg': + p = this._from_image(file); + default: + p = this._from_json(reps.data); + } + return res(p); + }; + }); } // // @param f: a file from DataService // returns a promise with the LayerGroup load_from_data_depot(f) { - console.log(f); let ext = GeoUtils.get_file_extension(f.name); - console.log(ext) let responseType = 'text'; if (ext === 'kmz') { responseType = 'arraybuffer'; } - console.log(responseType) return this.$http.get(f.agaveUrl(), {'responseType': responseType}).then((resp) => { - console.log(resp) let p = null; switch (ext) { case 'kml': - p = this._from_kml(resp.data).then( (lg) => {return lg;}); + p = this._from_kml(resp.data); break; case 'json': - p = this._from_json(resp.data).then( (lg) => {return lg;}); + p = this._from_json(resp.data); break; case 'geojson': - p = this._from_json(resp.data).then( (lg) => {return lg;}); + p = this._from_json(resp.data); break; case 'kmz': - p = this._from_kmz(resp.data).then( (lg) => {return lg;}); + p = this._from_kmz(resp.data); + break; + case 'gpx': + p = this._from_gpx(resp.data); break; default: - p = this._from_json(reps.data).then( (lg) => {return lg;}); + p = this._from_json(resp.data); } return p; }); diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css index 62fcef5462..f966612454 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css +++ b/designsafe/apps/geo/static/designsafe/apps/geo/styles/geo.css @@ -27,23 +27,29 @@ -#geo_sidebar, #current_layer_details{ +#geo_sidebar, #current_layer_details, #map_project_details { /*padding-top: 10px;*/ width: 20%; font-size: 11px; letter-spacing: 0px; float: left; flex: 0 0 230px; + height: 100vh; background: #313131; border-right: 1px solid #6e6e6e; flex-direction: column; - display: flex; - /*overflow-y: scroll;*/ + overflow-y: scroll; } +#map_project_details { + padding: 5px; +} - - +#map_project_details input, +#map_project_details textarea { + color: #fff; + background-color: #545454; +} .strong { @@ -62,8 +68,8 @@ } #geo_sidebar .list-group-item input[type=text] { - color: #000; - background-color: #c4c4c4; + color: #FFF; + background-color: #545454; width: 70%; } From 630bb1c6ca2ba454962a0cb4f7b7fdaffce0168e Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Mon, 27 Mar 2017 10:59:40 -0500 Subject: [PATCH 097/520] parsing service --- .../apps/geo/scripts/build/bundle.js | 23 ++++++++++++++----- .../apps/geo/scripts/build/bundle.js.map | 2 +- .../geo/scripts/services/geo-data-service.js | 23 ++++++++++++++----- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js index c13d0560cd..37f98b63c7 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js @@ -621,7 +621,6 @@ var GeoDataService = function () { key: '_from_kml', value: function _from_kml(text_blob) { return this.$q(function (res, rej) { - console.log(text_blob); var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); var l = omnivore.kml.parse(text_blob); l.getLayers().forEach(function (d) { @@ -682,7 +681,7 @@ var GeoDataService = function () { return this.$q(function (res, rej) { var lg = new _layer_group2.default("New Group", new L.FeatureGroup()); var exif = EXIF.readFromBinaryFile(file); - + console.log(exif); var lat = exif.GPSLatitude; var lon = exif.GPSLongitude; @@ -705,7 +704,8 @@ var GeoDataService = function () { return this.$q(function (res, rej) { var ext = GeoUtils.get_file_extension(file.name); var reader = new FileReader(); - reader.readAsText(file); + // reader.readAsText(file); + reader.readAsArrayBuffer(file); reader.onload = function (e) { var p = null; switch (ext) { @@ -725,9 +725,14 @@ var GeoDataService = function () { p = _this2._from_gpx(e.target.result); break; case 'jpeg': - p = _this2._from_image(file); + console.log(e.target); + p = _this2._from_image(e.target.result); + break; + case 'jpg': + p = _this2._from_image(e.target.result); + break; default: - p = _this2._from_json(reps.data); + p = _this2._from_json(e.target.result); } return res(p); }; @@ -745,7 +750,7 @@ var GeoDataService = function () { var ext = GeoUtils.get_file_extension(f.name); var responseType = 'text'; - if (ext === 'kmz') { + if (ext === 'kmz' || ext === 'jpeg' || ext === 'jpeg') { responseType = 'arraybuffer'; } return this.$http.get(f.agaveUrl(), { 'responseType': responseType }).then(function (resp) { @@ -766,6 +771,12 @@ var GeoDataService = function () { case 'gpx': p = _this3._from_gpx(resp.data); break; + case 'jpeg': + p = _this3._from_image(resp.data); + break; + case 'jpg': + p = _this3._from_image(resp.data); + break; default: p = _this3._from_json(resp.data); } diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map index 4d830b46ef..e65c2d0233 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 89ed12c05e00eec561c3","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["DBModalCtrl","$scope","$uibModalInstance","selected","dismiss","label","fg","feature_group","show","show_contents","getLayers","layer_groups","description","get_file_extension","fname","split","pop","mod","controller","angular","module","service","$timeout","$window","$uibModal","DataService","$http","GeoDataService","primary_color","open_db_modal","streets","L","tileLayer","maxZoom","satellite","control","layers","basemaps","addTo","map","zoomControl","setPosition","invalidateSize","active_layer_group","current_layer","$apply","on","e","object","options","color","secondary_color","fillColor","fillOpacity","addLayer","dc","Control","position","draw","circle","edit","featureGroup","remove","lg","push","length","select_active_layer_group","removeLayer","splice","i","removeControl","drawControl","add_draw_controls","active","modal","result","then","f","$","click","Marker","Polygon","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","getBounds","src_lg","console","log","loading","file","ev","target","bounds","forEach","setStyle","out","map_title","json","features","blob","Blob","JSON","a","document","createElement","href","url","textContent","restrict","scope","handler","link","element","GeoUtils","$q","res","text_blob","l","omnivore","kml","parse","d","rej","zipper","key","zip","files","ext","async","txt","geoJSON","json_blob","gpx","exif","EXIF","readFromBinaryFile","lat","GPSLatitude","lon","GPSLongitude","latRef","GPSLatitudeRef","reader","readAsText","onload","p","_from_json","_from_kmz","_from_gpx","_from_image","responseType","get","resp","data","$state","GeoStateService","templateUrl","resolve","auth","$uibTooltipProvider","config"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+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F,eAAK,MAAL;AACEA,gBAAI,OAAKC,UAAL,CAAgBM,KAAKC,IAArB,CAAJ;AACA;AACF,eAAK,OAAL;AACER,gBAAI,OAAKC,UAAL,CAAgBM,KAAKC,IAArB,CAAJ;AACA;AACF,eAAK,KAAL;AACER,gBAAI,OAAKE,SAAL,CAAeK,KAAKC,IAApB,CAAJ;AACA;AACF,eAAK,KAAL;AACER,gBAAI,OAAKG,SAAL,CAAeI,KAAKC,IAApB,CAAJ;AACA;AACF;AACER,gBAAI,OAAKC,UAAL,CAAgBM,KAAKC,IAArB,CAAJ;AAjBJ;AAmBA,eAAOR,CAAP;AACD,OAtBM,CAAP;AAuBD;;;;;;kBArJkB1H,M;;;;;;;;;;;;;;;ACHU;AAAA;;AAC3B,OAAK1B,MAAL,GAAcA,MAAd;AACA,OAAK6J,MAAL,GAAcA,MAAd;AACA;AACD,C;;kBANkBC,S;;;;;;;;;;;;;ACArB;;AACA;;AACA;;AAEA,IAAI9I,MAAME,QAAQC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEqD;AACnD;;AAC4B;AAC1B0F,SAAK,EADqB;AAE1BkD,aAF0B;AAAA;AAI1BC,aAAS;AACPC,YAAkB;AAChB,eAAO,IAAP;AACD;AAHM;AAJiB,GAA5B;;AAWA;AACAC,KAAA;AAED;;AAEDlJ,IAAImJ,MAAJ,CAAWA,MAAX","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 11);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 89ed12c05e00eec561c3","export default class DBModalCtrl {\n\n constructor ($scope, $uibModalInstance) {\n 'ngInject';\n this.$scope = $scope;\n this.$uibModalInstance = $uibModalInstance;\n this.selected = null;\n }\n\n ok () {\n this.$uibModalInstance.close(this.selected);\n };\n\n cancel () {\n this.$uibModalInstance.dismiss('cancel');\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n this.description = null;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","import MapSidebarCtrl from './map-sidebar';\nimport DBModalCtrl from './db-modal';\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\nmod.controller('DBModalCtrl', DBModalCtrl);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\n\nmod.directive('customOnChange', customOnChange);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\nimport GeoStateService from './geo-state-service';\nimport GeoDataService from './geo-data-service';\n\nlet mod = angular.module('ds.geo.services', []);\nmod.service('GeoStateService', GeoStateService);\nmod.service('GeoDataService', GeoDataService);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal, DataService, $http, GeoDataService) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n this.DataService = DataService;\n this.$http = $http;\n this.GeoDataService = GeoDataService;\n\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n this.open_db_modal = this.open_db_modal.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n let modal = this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: \"DBModalCtrl as vm\",\n });\n modal.result.then( (f) => {this.load_from_data_depot(f);});\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n load_from_data_depot(f) {\n this.loading = true;\n this.GeoDataService.load_from_data_depot(f).then( (lg) => {\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n this.loading = false;\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let lf = this.GeoDataService.load_from_local_file(file).then( (lg) => {\n console.log(lg);\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n });\n\n }\n\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import * as GeoUtils from '../utils/geo-utils';\nimport LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\n\n\nexport default class GeoDataService {\n\n constructor ($http, $q) {\n 'ngInject';\n this.$http = $http;\n this.$q = $q;\n }\n\n _from_kml(text_blob) {\n return this.$q( (res, rej) => {\n console.log(text_blob)\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let l = omnivore.kml.parse(text_blob);\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n res(lg);\n });\n }\n\n _from_kmz (blob) {\n return this.$q( (res, rej) => {\n let zipper = new JSZip();\n zipper.loadAsync(blob).then( (zip) => {\n\n //loop over all the files in the archive\n for (let key in zip.files) {\n let ext = key.split('.').pop();\n if (ext === 'kml') {\n return zip.files[key].async('text');\n }\n }\n }).then( (txt) => {\n let lg = this._from_kml(txt);\n res(lg);\n });\n });\n }\n\n _from_json (json_blob) {\n return this.$q( (res, rej) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json_blob).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n res(lg);\n });\n }\n\n _from_gpx (blob) {\n return this.$q( (res, rej) => {\n // console.log(text_blob)\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let l = omnivore.gpx.parse(blob);\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n res(lg);\n });\n }\n\n _from_image (file) {\n return this.$q( (res, rej) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let exif = EXIF.readFromBinaryFile(file);\n\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n lg.feature_group.addLayer(d);\n });\n }\n\n\n _load_dsmap (json_blob) {\n\n }\n\n\n load_from_local_file (file) {\n return this.$q( (res, rej) => {\n let ext = GeoUtils.get_file_extension(file.name);\n let reader = new FileReader();\n reader.readAsText(file);\n reader.onload = (e) => {\n let p = null;\n switch (ext) {\n case 'kml':\n p = this._from_kml(e.target.result);\n break;\n case 'json':\n p = this._from_json(e.target.result);\n break;\n case 'geojson':\n p = this._from_json(e.target.result);\n break;\n case 'kmz':\n p = this._from_kmz(file);\n break;\n case 'gpx':\n p = this._from_gpx(e.target.result);\n break;\n case 'jpeg':\n p = this._from_image(file);\n default:\n p = this._from_json(reps.data);\n }\n return res(p);\n };\n });\n }\n\n //\n // @param f: a file from DataService\n // returns a promise with the LayerGroup\n load_from_data_depot(f) {\n let ext = GeoUtils.get_file_extension(f.name);\n let responseType = 'text';\n if (ext === 'kmz') {\n responseType = 'arraybuffer';\n }\n return this.$http.get(f.agaveUrl(), {'responseType': responseType}).then((resp) => {\n let p = null;\n switch (ext) {\n case 'kml':\n p = this._from_kml(resp.data);\n break;\n case 'json':\n p = this._from_json(resp.data);\n break;\n case 'geojson':\n p = this._from_json(resp.data);\n break;\n case 'kmz':\n p = this._from_kmz(resp.data);\n break;\n case 'gpx':\n p = this._from_gpx(resp.data);\n break;\n default:\n p = this._from_json(resp.data);\n }\n return p;\n });\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js","export default class GeoStateService {\n\n constructor ($scope, $state) {\n this.$scope = $scope;\n this.$state = $state;\n this.last_db_path = null;\n }\n\n \n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap cde80508724c996208b7","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js","webpack:///./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"names":["DBModalCtrl","$scope","$uibModalInstance","selected","dismiss","label","fg","feature_group","show","show_contents","getLayers","layer_groups","description","get_file_extension","fname","split","pop","mod","controller","angular","module","service","$timeout","$window","$uibModal","DataService","$http","GeoDataService","primary_color","open_db_modal","streets","L","tileLayer","maxZoom","satellite","control","layers","basemaps","addTo","map","zoomControl","setPosition","invalidateSize","active_layer_group","current_layer","$apply","on","e","object","options","color","secondary_color","fillColor","fillOpacity","addLayer","dc","Control","position","draw","circle","edit","featureGroup","remove","lg","push","length","select_active_layer_group","removeLayer","splice","i","removeControl","drawControl","add_draw_controls","active","modal","result","then","f","$","click","Marker","Polygon","feature","latLngs","getLatLng","markerBounds","latLngBounds","fitBounds","getBounds","src_lg","console","log","loading","file","ev","target","bounds","forEach","setStyle","out","map_title","json","features","blob","Blob","JSON","a","document","createElement","href","url","textContent","restrict","scope","handler","link","element","GeoUtils","$q","res","l","omnivore","kml","parse","text_blob","d","rej","zipper","key","zip","files","ext","async","txt","geoJSON","json_blob","gpx","exif","EXIF","readFromBinaryFile","lat","GPSLatitude","lon","GPSLongitude","latRef","GPSLatitudeRef","reader","readAsArrayBuffer","onload","p","_from_json","_from_kmz","_from_gpx","_from_image","responseType","get","agaveUrl","resp","data","$state","GeoStateService","templateUrl","resolve","auth","$uibTooltipProvider","config"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;IChEqBA,W;AAEnB,uBAAaC,MAAb,EAAqBC,iBAArB,EAAwC;AACtC;;AADsC;;AAEtC;AACA,SAAKA,gBAAL;AACA,SAAKC,QAAL,GAAgB,IAAhB;AACD;;;;cAEK;AACJ,WAAKD,eAAL;AACD;;;kBAES;AACR,WAAKA,iBAAL,CAAuBE,CAAvB;AACD;;;;;;;;;;;;;;;;;;;;;;;;ACbD,sBAAaC,KAAb,EAAoBC,CAAI;AAAA;;AACtB;AACA,SAAKC,aAAL;AACA,SAAKC,IAAL,GAAY,IAAZ;AACA,SAAKC,YAAL;AACD;;;;wBAEe;AACd,aAAO,KAAKF,aAAL,CAAmBG,IAA1B;AACD;;;;;;;;;;;;;;;;;;;;;ACRkB;AAAA;;AACjB;AACA,OAAKC,YAAL;AACA,OAAKC,WAAL,GAAmB,IAAnB;AACD,C;;;;;;;;;;;;;;;ACPI,SAASC,kBAAT,CAA6BC,KAA7B,EAAoC;AACzC,SAAOA,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OAAKI,WAAL,CAAiBI,KAAKC,IAAtB,CAAJ;AACA;AACF;AACET,gBAAI,OAAKC,UAAL,CAAgBO,KAAKC,IAArB,CAAJ;AAvBJ;AAyBA,eAAOT,CAAP;AACD,OA5BM,CAAP;AA6BD;;;;;;kBAhKkB1H,M;;;;;;;;;;;;;;;ACHU;AAAA;;AAC3B,OAAK1B,MAAL,GAAcA,MAAd;AACA,OAAK8J,MAAL,GAAcA,MAAd;AACA;AACD,C;;kBANkBC,S;;;;;;;;;;;;;ACArB;;AACA;;AACA;;AAEA,IAAI/I,MAAME,QAAQC,MAAR,CAAe,YAAf,CAAV;AACA;;AAEqD;AACnD;;AAC4B;AAC1B0F,SAAK,EADqB;AAE1BmD,aAF0B;AAAA;AAI1BC,aAAS;AACPC,YAAkB;AAChB,eAAO,IAAP;AACD;AAHM;AAJiB,GAA5B;;AAWA;AACAC,KAAA;AAED;;AAEDnJ,IAAIoJ,MAAJ,CAAWA,MAAX","file":"./designsafe/apps/geo/static/designsafe/apps/geo/scripts/build/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 11);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap cde80508724c996208b7","export default class DBModalCtrl {\n\n constructor ($scope, $uibModalInstance) {\n 'ngInject';\n this.$scope = $scope;\n this.$uibModalInstance = $uibModalInstance;\n this.selected = null;\n }\n\n ok () {\n this.$uibModalInstance.close(this.selected);\n };\n\n cancel () {\n this.$uibModalInstance.dismiss('cancel');\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/db-modal.js","export default class LayerGroup {\n\n constructor (label, fg) {\n this.label = label;\n this.feature_group = fg;\n this.show = true;\n this.show_contents = true;\n }\n\n num_features () {\n return this.feature_group.getLayers().length;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/layer_group.js","\nexport default class MapProject {\n\n constructor (name) {\n this.name = name;\n this.layer_groups = [];\n this.description = null;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/models/map-project.js","export function get_file_extension (fname) {\n return fname.split('.').pop();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/utils/geo-utils.js","import MapSidebarCtrl from './map-sidebar';\nimport DBModalCtrl from './db-modal';\nlet mod = angular.module('ds.geo.controllers', []);\n\nmod.controller('MapSidebarCtrl', MapSidebarCtrl);\nmod.controller('DBModalCtrl', DBModalCtrl);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/index.js","import customOnChange from './custom-on-change';\n\nlet mod = angular.module('ds.geo.directives', []);\n\n\nmod.directive('customOnChange', customOnChange);\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/index.js","// import customOnChange from './custom-on-change';\nimport GeoStateService from './geo-state-service';\nimport GeoDataService from './geo-data-service';\n\nlet mod = angular.module('ds.geo.services', []);\nmod.service('GeoStateService', GeoStateService);\nmod.service('GeoDataService', GeoDataService);\n\n// mod.directive('customOnChange', customOnChange);\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/index.js","import LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\nimport DBModalCtrl from './db-modal';\nimport * as GeoUtils from '../utils/geo-utils';\n\nexport default class MapSidebarCtrl {\n\n constructor ($scope, $window, $timeout, $uibModal, DataService, $http, GeoDataService) {\n 'ngInject';\n this.$scope = $scope;\n this.LGeo = $window.LGeo;\n this.$timeout = $timeout;\n this.$window = $window;\n this.$uibModal = $uibModal;\n this.DataService = DataService;\n this.$http = $http;\n this.GeoDataService = GeoDataService;\n\n this.primary_color = '#ff0000';\n this.secondary_color = '#ff0000';\n\n //method binding for callback, sigh...\n this.local_file_selected = this.local_file_selected.bind(this);\n this.open_db_modal = this.open_db_modal.bind(this);\n\n let streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '© OpenStreetMap contributors'\n });\n\n let satellite = L.tileLayer(\n 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: '©',\n maxZoom: 18,\n });\n\n let basemaps = {\n 'Street': streets,\n 'Satellite': satellite\n };\n\n this.map = L.map('geo_map', {layers: [streets, satellite]}).setView([0, 0], 3);\n this.map_title = 'New Map';\n L.control.layers(basemaps).addTo(this.map);\n this.map.zoomControl.setPosition('bottomleft');\n\n // trick to fix the tiles that sometimes don't load for some reason...\n $timeout( () => {this.map.invalidateSize();}, 10);\n\n this.layer_groups = [new LayerGroup('New Group', new L.FeatureGroup())];\n this.map.addLayer(this.layer_groups[0].feature_group);\n this.active_layer_group = this.layer_groups[0];\n\n // update the current layer to show the details tab\n this.active_layer_group.feature_group.on('click', (e) => {\n this.current_layer ? this.current_layer = null : this.current_layer = e.layer;\n this.$scope.$apply();\n });\n\n this.add_draw_controls(this.active_layer_group.feature_group);\n\n this.map.on('draw:created', (e) => {\n let object = e.layer;\n object.options.color = this.secondary_color;\n object.options.fillColor = this.primary_color;\n object.options.fillOpacity = 0.8;\n this.active_layer_group.feature_group.addLayer(object);\n this.$scope.$apply();\n });\n\n this.map.on('mousemove', (e) => {\n this.current_mouse_coordinates = e.latlng;\n this.$scope.$apply();\n });\n\n\n } // end constructor\n\n add_draw_controls (fg) {\n let dc = new L.Control.Draw({\n position: 'topright',\n draw: {\n circle: false,\n },\n edit: {\n featureGroup: fg,\n remove: true\n }\n });\n this.map.addControl(dc);\n this.drawControl = dc;\n }\n\n\n create_layer_group () {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n this.layer_groups.push(lg);\n this.active_layer_group = this.layer_groups[this.layer_groups.length -1];\n this.map.addLayer(lg.feature_group);\n this.select_active_layer_group(this.active_layer_group);\n }\n\n delete_layer_group (lg, i) {\n this.map.removeLayer(lg.feature_group);\n this.layer_groups.splice(i, 1);\n }\n\n delete_feature (f) {\n this.map.removeLayer(f);\n this.active_layer_group.feature_group.removeLayer(f);\n }\n\n show_hide_layer_group (lg) {\n lg.show ? this.map.addLayer(lg.feature_group) : this.map.removeLayer(lg.feature_group);\n }\n\n select_active_layer_group(lg) {\n this.map.removeControl(this.drawControl);\n this.add_draw_controls(lg.feature_group);\n this.active_layer_group = lg;\n lg.active = true;\n lg.show = true;\n }\n\n open_db_modal () {\n let modal = this.$uibModal.open({\n templateUrl: \"/static/designsafe/apps/geo/html/db-modal.html\",\n controller: \"DBModalCtrl as vm\",\n });\n modal.result.then( (f) => {this.load_from_data_depot(f);});\n }\n\n open_file_dialog () {\n this.$timeout(() => {\n $('#file_picker').click();\n }, 0);\n }\n\n get_feature_type (f) {\n if (f instanceof L.Marker) {\n return 'Point';\n } else if (f instanceof L.Polygon) {\n return 'Polygon';\n } else {\n return 'Path';\n }\n }\n\n zoom_to(feature) {\n if (feature instanceof L.Marker) {\n let latLngs = [ feature.getLatLng() ];\n let markerBounds = L.latLngBounds(latLngs);\n this.map.fitBounds(markerBounds);\n } else {\n this.map.fitBounds(feature.getBounds());\n };\n }\n\n on_drop (ev, data, lg) {\n let src_lg = this.layer_groups[data.pidx];\n let feature = src_lg.feature_group.getLayers()[data.idx];\n src_lg.feature_group.removeLayer(feature);\n lg.feature_group.addLayer(feature);\n }\n\n drop_feature_success (ev, data, lg) {\n console.log(\"drag_feature_success\", ev, data, lg)\n // lg.feature_group.getLayers().splicer(idx, 1);\n }\n\n load_from_data_depot(f) {\n this.loading = true;\n this.GeoDataService.load_from_data_depot(f).then( (lg) => {\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n this.loading = false;\n });\n }\n\n local_file_selected (ev) {\n let file = ev.target.files[0];\n let lf = this.GeoDataService.load_from_local_file(file).then( (lg) => {\n console.log(lg);\n this.layer_groups.push(lg);\n this.map.addLayer(lg.feature_group);\n let bounds = [];\n this.layer_groups.forEach((lg) => {\n bounds.push(lg.feature_group.getBounds());\n });\n this.map.fitBounds(bounds);\n });\n\n }\n\n\n update_layer_style (prop) {\n this.current_layer.setStyle({prop: this.current_layer.options[prop]});\n }\n\n\n save_project () {\n let out = {\n \"type\": \"FeatureCollection\",\n \"features\": [],\n \"ds_map\": true,\n \"name\": this.map_title\n };\n this.layer_groups.forEach( (lg) => {\n let json = lg.feature_group.toGeoJSON();\n //add in any options\n json.label = lg.label;\n\n out.features.push(json);\n });\n let blob = new Blob([JSON.stringify(out)], {type: \"application/json\"});\n let url = URL.createObjectURL(blob);\n\n let a = document.createElement('a');\n a.download = this.map_title + \".json\";\n a.href = url;\n a.textContent = \"Download\";\n a.click();\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/controllers/map-sidebar.js","export default function customOnChange() {\n return {\n restrict: 'A',\n scope: {\n handler: '&'\n },\n link: function (scope, element, attrs) {\n element.on('change', function (ev) {\n scope.$apply(function(){\n scope.handler({ev:ev});\n });\n });\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/directives/custom-on-change.js","import * as GeoUtils from '../utils/geo-utils';\nimport LayerGroup from '../models/layer_group';\nimport MapProject from '../models/map-project';\n\n\nexport default class GeoDataService {\n\n constructor ($http, $q) {\n 'ngInject';\n this.$http = $http;\n this.$q = $q;\n }\n\n _from_kml(text_blob) {\n return this.$q( (res, rej) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let l = omnivore.kml.parse(text_blob);\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n res(lg);\n });\n }\n\n _from_kmz (blob) {\n return this.$q( (res, rej) => {\n let zipper = new JSZip();\n zipper.loadAsync(blob).then( (zip) => {\n\n //loop over all the files in the archive\n for (let key in zip.files) {\n let ext = key.split('.').pop();\n if (ext === 'kml') {\n return zip.files[key].async('text');\n }\n }\n }).then( (txt) => {\n let lg = this._from_kml(txt);\n res(lg);\n });\n });\n }\n\n _from_json (json_blob) {\n return this.$q( (res, rej) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n L.geoJSON(json_blob).getLayers().forEach( (l) => {\n lg.feature_group.addLayer(l);\n });\n res(lg);\n });\n }\n\n _from_gpx (blob) {\n return this.$q( (res, rej) => {\n // console.log(text_blob)\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let l = omnivore.gpx.parse(blob);\n l.getLayers().forEach((d) => {\n lg.feature_group.addLayer(d);\n });\n res(lg);\n });\n }\n\n _from_image (file) {\n return this.$q( (res, rej) => {\n let lg = new LayerGroup(\"New Group\", new L.FeatureGroup());\n let exif = EXIF.readFromBinaryFile(file);\n console.log(exif)\n let lat = exif.GPSLatitude;\n let lon = exif.GPSLongitude;\n\n //Convert coordinates to WGS84 decimal\n let latRef = exif.GPSLatitudeRef || \"N\";\n let lonRef = exif.GPSLongitudeRef || \"W\";\n lat = (lat[0] + lat[1]/60 + lat[2]/3600) * (latRef == \"N\" ? 1 : -1);\n lon = (lon[0] + lon[1]/60 + lon[2]/3600) * (lonRef == \"W\" ? -1 : 1);\n lg.feature_group.addLayer(d);\n });\n }\n\n\n _load_dsmap (json_blob) {\n\n }\n\n\n load_from_local_file (file) {\n return this.$q( (res, rej) => {\n let ext = GeoUtils.get_file_extension(file.name);\n let reader = new FileReader();\n // reader.readAsText(file);\n reader.readAsArrayBuffer(file);\n reader.onload = (e) => {\n let p = null;\n switch (ext) {\n case 'kml':\n p = this._from_kml(e.target.result);\n break;\n case 'json':\n p = this._from_json(e.target.result);\n break;\n case 'geojson':\n p = this._from_json(e.target.result);\n break;\n case 'kmz':\n p = this._from_kmz(file);\n break;\n case 'gpx':\n p = this._from_gpx(e.target.result);\n break;\n case 'jpeg':\n console.log(e.target)\n p = this._from_image(e.target.result);\n break;\n case 'jpg':\n p = this._from_image(e.target.result);\n break;\n default:\n p = this._from_json(e.target.result);\n }\n return res(p);\n };\n });\n }\n\n //\n // @param f: a file from DataService\n // returns a promise with the LayerGroup\n load_from_data_depot(f) {\n let ext = GeoUtils.get_file_extension(f.name);\n let responseType = 'text';\n if ((ext === 'kmz') || (ext === 'jpeg') || (ext === 'jpeg')) {\n responseType = 'arraybuffer';\n }\n return this.$http.get(f.agaveUrl(), {'responseType': responseType}).then((resp) => {\n let p = null;\n switch (ext) {\n case 'kml':\n p = this._from_kml(resp.data);\n break;\n case 'json':\n p = this._from_json(resp.data);\n break;\n case 'geojson':\n p = this._from_json(resp.data);\n break;\n case 'kmz':\n p = this._from_kmz(resp.data);\n break;\n case 'gpx':\n p = this._from_gpx(resp.data);\n break;\n case 'jpeg':\n p = this._from_image(resp.data);\n break;\n case 'jpg':\n p = this._from_image(resp.data);\n break;\n default:\n p = this._from_json(resp.data);\n }\n return p;\n });\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js","export default class GeoStateService {\n\n constructor ($scope, $state) {\n this.$scope = $scope;\n this.$state = $state;\n this.last_db_path = null;\n }\n\n \n}\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-state-service.js","import {mod as geo_directives} from './directives';\nimport {mod as geo_controllers} from './controllers';\nimport {mod as geo_services} from './services';\n\nlet mod = angular.module('designsafe');\nmod.requires.push('ui.router', 'ang-drag-drop', 'ds.geo.directives', 'ds.geo.controllers', 'ds.geo.services');\n\nfunction config($stateProvider, $uibTooltipProvider) {\n 'ngInject';\n $stateProvider.state('geo', {\n url: '',\n templateUrl: '/static/designsafe/apps/geo/html/map.html',\n controller: 'MapSidebarCtrl as vm',\n resolve: {\n auth: function () {\n return true;\n }\n }\n });\n\n //config popups etc\n $uibTooltipProvider.options({popupDelay:1000});\n\n}\n\nmod.config(config);\n\n\n\nexport default mod;\n\n\n\n// WEBPACK FOOTER //\n// ./designsafe/apps/geo/static/designsafe/apps/geo/scripts/index.js"],"sourceRoot":""} \ No newline at end of file diff --git a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js index e3a9fb923c..e16170b363 100644 --- a/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js +++ b/designsafe/apps/geo/static/designsafe/apps/geo/scripts/services/geo-data-service.js @@ -13,7 +13,6 @@ export default class GeoDataService { _from_kml(text_blob) { return this.$q( (res, rej) => { - console.log(text_blob) let lg = new LayerGroup("New Group", new L.FeatureGroup()); let l = omnivore.kml.parse(text_blob); l.getLayers().forEach((d) => { @@ -68,7 +67,7 @@ export default class GeoDataService { return this.$q( (res, rej) => { let lg = new LayerGroup("New Group", new L.FeatureGroup()); let exif = EXIF.readFromBinaryFile(file); - + console.log(exif) let lat = exif.GPSLatitude; let lon = exif.GPSLongitude; @@ -91,7 +90,8 @@ export default class GeoDataService { return this.$q( (res, rej) => { let ext = GeoUtils.get_file_extension(file.name); let reader = new FileReader(); - reader.readAsText(file); + // reader.readAsText(file); + reader.readAsArrayBuffer(file); reader.onload = (e) => { let p = null; switch (ext) { @@ -111,9 +111,14 @@ export default class GeoDataService { p = this._from_gpx(e.target.result); break; case 'jpeg': - p = this._from_image(file); + console.log(e.target) + p = this._from_image(e.target.result); + break; + case 'jpg': + p = this._from_image(e.target.result); + break; default: - p = this._from_json(reps.data); + p = this._from_json(e.target.result); } return res(p); }; @@ -126,7 +131,7 @@ export default class GeoDataService { load_from_data_depot(f) { let ext = GeoUtils.get_file_extension(f.name); let responseType = 'text'; - if (ext === 'kmz') { + if ((ext === 'kmz') || (ext === 'jpeg') || (ext === 'jpeg')) { responseType = 'arraybuffer'; } return this.$http.get(f.agaveUrl(), {'responseType': responseType}).then((resp) => { @@ -147,6 +152,12 @@ export default class GeoDataService { case 'gpx': p = this._from_gpx(resp.data); break; + case 'jpeg': + p = this._from_image(resp.data); + break; + case 'jpg': + p = this._from_image(resp.data); + break; default: p = this._from_json(resp.data); } From d06ee1362754af4c1adbe6e16a471cd7d6f17aa7 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Mon, 27 Mar 2017 11:48:16 -0500 Subject: [PATCH 098/520] sitewide search added button for IE11 fix --- designsafe/static/styles/main.css | 2 +- designsafe/templates/includes/navigation.html | 8 ++-- docker-compose-dev.yml | 38 +++++++++---------- 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/designsafe/static/styles/main.css b/designsafe/static/styles/main.css index b95497a319..2fb46f1ae1 100644 --- a/designsafe/static/styles/main.css +++ b/designsafe/static/styles/main.css @@ -9,7 +9,7 @@ body.navbar-fixed { } #sitewide_search { - margin-top: 0.75em; + /*margin-top: 0.75em;*/ } .cms-toolbar-expanded .navbar-ds.navbar-fixed-top { diff --git a/designsafe/templates/includes/navigation.html b/designsafe/templates/includes/navigation.html index b773863659..39cbf8542a 100644 --- a/designsafe/templates/includes/navigation.html +++ b/designsafe/templates/includes/navigation.html @@ -34,14 +34,14 @@ - +
    diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 81a9952546..8c6665aa63 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -3,6 +3,9 @@ redis: image: redis +rabbitmq: + image: rabbitmq + elasticsearch: image: elasticsearch:2.3.2 volumes: @@ -30,12 +33,15 @@ django: env_file: designsafe.env environment: - DJANGO_SETTINGS_MODULE=designsafe.http_debug_settings - # - DATABASE_HOST=mysql - # - DATABASE_NAME=DS_DEV - # - DATABASE_PORT=3306 - # - DATABASE_USER=DS_DEV - # - DATABASE_PASSWORD=DS_DEV + - DATABASE_HOST=mysql + - DATABASE_NAME=DS_DEV + - DATABASE_PORT=3306 + - DATABASE_USER=DS_DEV + - DATABASE_PASSWORD=DS_DEV - DS_LOCAL_DEV=True + - WS_BACKEND_HOST=redis + - WS_BACKEND_DB=0 + - WS_BACKEND_PORT=6379 links: - redis:redis - memcached:memcached @@ -70,22 +76,6 @@ nginx: - 80:80 - 443:443 -devnginx: - image: nginx - volumes: - - ./conf/nginx.conf:/etc/nginx/nginx.conf - - ./conf/gzip.conf:/etc/nginx/gzip.conf - - ./conf/dummy.crt:/etc/ssl/dummy.crt - - ./conf/dummy.key:/etc/ssl/dummy.key - - ./conf/dhparam.pem:/etc/ssl/dhparam.pem - volumes_from: - - django - ports: - - 80:80 - - 443:443 - external_links: - - portal_django_run_1:django - worker: build: . env_file: designsafe.env @@ -97,11 +87,17 @@ worker: - DATABASE_USER=DS_DEV - DATABASE_PASSWORD=DS_DEV - DS_LOCAL_DEV=True + - BROKER_URL_HOST=rabbitmq + - BROKER_URL_PORT=5672 + - BROKER_URL_VHOST= + - BROKER_URL_USERNAME=guest + - BROKER_URL_PWD=guest links: - redis:redis - memcached:memcached - elasticsearch:elasticsearch - mysql:mysql + - rabbitmq:rabbitmq volumes: - .:/portal - /corral-repl/tacc/NHERI:/corral-repl/tacc/NHERI From 71023eac0d24f8536b734c3448b2ced03c97d042 Mon Sep 17 00:00:00 2001 From: Joe Meiring Date: Mon, 27 Mar 2017 14:37:15 -0500 Subject: [PATCH 099/520] search form for internet explorer fix --- designsafe/templates/includes/navigation.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designsafe/templates/includes/navigation.html b/designsafe/templates/includes/navigation.html index 39cbf8542a..82817c1b0c 100644 --- a/designsafe/templates/includes/navigation.html +++ b/designsafe/templates/includes/navigation.html @@ -34,9 +34,9 @@ - + From 9d79c4b7da643f934679baa1ab4db689abdeec8a Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 13 Feb 2017 11:54:21 -0600 Subject: [PATCH 127/520] Updating metadata model base 'list' method --- designsafe/apps/api/agave/models/base.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/designsafe/apps/api/agave/models/base.py b/designsafe/apps/api/agave/models/base.py index 502d787f06..cef214969d 100644 --- a/designsafe/apps/api/agave/models/base.py +++ b/designsafe/apps/api/agave/models/base.py @@ -86,12 +86,12 @@ def get(self, agave_client, uuid): meta = agave_client.getMetadata(uuid=uuid) return self.model_cls(**meta) - def list(self, agave_client, name, project_uuid=None): - if project_uuid is None: - metas = agave_client.meta.listMetadata(q=json.dumps({'name': name})) + def list(self, agave_client, association_id=None): + if association_id is None: + metas = agave_client.meta.listMetadata(q=json.dumps({'name': self.model_cls.model_name})) else: - metas = agave_client.meta.listMetadata(q=json.dumps({'name': name, - 'associationIds': [project_uuid]})) + metas = agave_client.meta.listMetadata(q=json.dumps({'name': self.model_cls.model_name, + 'associationIds': association_id})) for meta in metas: yield self.model_cls(**meta) @@ -276,7 +276,6 @@ def to_body_dict(self): value = getattr(self, field.attname) attrname = spinal_to_camelcase(field.attname) if isinstance(value, RelatedQuery): - value() dict_obj['value'][attrname] = value.uuids elif isinstance(value, Model): dict_obj['value'][attrname] = value.to_body_dict() From def08727fa01597d6c11d29aa150bda65ae277c8 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 13 Feb 2017 11:55:25 -0600 Subject: [PATCH 128/520] Updating project uuid attribute key --- designsafe/apps/api/agave/models/files.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designsafe/apps/api/agave/models/files.py b/designsafe/apps/api/agave/models/files.py index 81cebc0a12..b1e809d7ef 100644 --- a/designsafe/apps/api/agave/models/files.py +++ b/designsafe/apps/api/agave/models/files.py @@ -98,7 +98,7 @@ def _update_pems_with_system_roles(self, system_roles, meta_pems): return meta_pems_users def match_pems_to_project(self, project_uuid = None): - project_uuid = project_uuid or self.value.get('projectUUID') + project_uuid = project_uuid or self.value.get('projectUUID', self.value.get('projectUuid')) logger.debug('matchins pems to project: %s', project_uuid) if not project_uuid: return self From fe24d8091f87b70ffed5756d0ac5b7394ef2e74f Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 13 Feb 2017 11:57:49 -0600 Subject: [PATCH 129/520] Updating url to update metadata object --- designsafe/apps/api/projects/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designsafe/apps/api/projects/urls.py b/designsafe/apps/api/projects/urls.py index 7845d11ea2..e09e8fae2d 100644 --- a/designsafe/apps/api/projects/urls.py +++ b/designsafe/apps/api/projects/urls.py @@ -32,5 +32,5 @@ url(r'^(?P[a-z0-9\-]+)/meta/list/((?P.*))?/?$', ProjectMetaListView.as_view(), name='project_meta'), url(r'^(?P[a-z0-9\-]+)/meta/(?P[a-zA-Z0-9\.\-_])/?$', ProjectMetaView.as_view(), name='project_meta'), - url(r'^(?P[a-z0-9\-]+)/meta/(?P[a-zA-Z0-9\.\-_])/((?P[^ \/]))?/?$', ProjectMetaView.as_view(), name='project_meta'), + url(r'^meta/(?P[a-zA-Z0-9\.\-_])/(?P[^ \/])/?$', ProjectMetaView.as_view(), name='project_meta'), ] From 3685a39d53631dcc58777dce20970c7fa7914531 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 13 Feb 2017 11:58:10 -0600 Subject: [PATCH 130/520] Updating project views, adding put/post methods --- designsafe/apps/api/projects/views.py | 60 +++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/designsafe/apps/api/projects/views.py b/designsafe/apps/api/projects/views.py index 507fc0b507..88a99e12fc 100644 --- a/designsafe/apps/api/projects/views.py +++ b/designsafe/apps/api/projects/views.py @@ -9,6 +9,7 @@ from designsafe.apps.api.mixins import SecureMixin from designsafe.apps.api.projects.models import Project from designsafe.apps.api.agave import get_service_account_client +from designsafe.apps.api.agave.models.metadata import BaseMetadataPermissionResource from designsafe.apps.api.agave.models.files import BaseFileResource from designsafe.apps.api.agave.models.util import AgaveJSONEncoder from designsafe.apps.accounts.models import DesignSafeProfile @@ -338,18 +339,22 @@ def get(self, request, project_id, name): class ProjectMetaView(BaseApiView, SecureMixin, ProjectMetaLookupMixin): - def get(self, request, project_id, name, uuid): + def get(self, request, name, project_id=None, uuid=None): """ :return: :rtype: JsonResponse """ + ag = request.user.agave_oauth.client try: model = self._lookup_model(name) - resp = model._meta.model_manager.get(ag, uuid) + if project_id is not None: + resp = model._meta.model_manager.list(ag, project_id) + elif uuid is None: + resp = model._meta.model_manager.get(ag, uuid) except ValueError: return HttpResponseBadRequest('Entity not valid.') - return JsonResponse(resp.to_boy_dict(), safe=False) + return JsonResponse(resp.to_body_dict(), safe=False) def post(self, request, project_id, name): """ @@ -366,8 +371,55 @@ def post(self, request, project_id, name): try: model_cls = self._lookup_model(name) - model = model_cls(**post_data) + model = model_cls(value=post_data) + file_uuids = [] + if 'filePaths' in post_data: + file_paths = post_data.get('filePaths', []) + project_system = ''.join(['project-', project_id]) + user_ag = request.user.agave_oauth.client + for file_path in file_paths: + file_obj = BaseFileResource.listing(user_ag, + project_system, + file_path) + + file_uuids.append(file_obj.uuid) + for file_uuid in file_uuids: + model.files.add(file_uuid) model.project.add(project_id) + saved = model.save(ag) + resp = model_cls(**saved) + #TODO: This should happen in a celery task and implemented in a manager + #Get project's metadata permissions + pems = BaseMetadataPermissionResource.list_permissions(project_id, ag) + #Loop permissions and set them in whatever metadata object we're saving + for pem in pems: + _pem = BaseMetadataPermissionResource(resp._meta.uuid, ag) + _pem.username = pems['username'] + _pem.read = pems['permission']['read'] + _pem.write = pems['permission']['write'] + _pem.read = pems['permission']['execute'] + _pem.save() + + except ValueError: + return HttpResponseBadRequest('Entity not valid.') + + return JsonResponse(resp.to_body_dict(), safe=False) + + def put(self, request, name, uuid): + """ + + :param request: + :return: + """ + ag = get_service_account_client() + + if request.is_ajax(): + post_data = json.loads(request.body) + else: + post_data = request.POST.copy() + try: + model_cls = self._lookup_model(name) + model = model_cls(uuid=uuid, value=post_data) saved = model.save() resp = model_cls(**saved) except ValueError: From 804c47d4b74a4e8325293eb235f7440e26c8e0e5 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 13 Feb 2017 11:59:56 -0600 Subject: [PATCH 131/520] Showing correct Loading... legend in data depot --- .../scripts/data-depot/controllers/projects.js | 9 ++++++--- .../scripts/data-depot/templates/project-list.html | 14 ++++++++++++-- .../html/directives/dd-box-listing.html | 13 ++++++++----- .../ng-designsafe/html/directives/dd-listing.html | 13 ++++++++----- .../html/directives/dd-public-listing.html | 13 ++++++++----- .../html/directives/dd-public-search-listing.html | 13 ++++++++----- .../html/directives/dd-search-listing.html | 13 ++++++++----- .../html/directives/dd-shared-listing.html | 13 ++++++++----- 8 files changed, 66 insertions(+), 35 deletions(-) diff --git a/designsafe/static/scripts/data-depot/controllers/projects.js b/designsafe/static/scripts/data-depot/controllers/projects.js index bf150a7cea..768c187af6 100644 --- a/designsafe/static/scripts/data-depot/controllers/projects.js +++ b/designsafe/static/scripts/data-depot/controllers/projects.js @@ -9,7 +9,8 @@ DataBrowserService.apiParams.searchState = undefined; $scope.data = { - navItems: [] + navItems: [], + projects: [] }; $scope.$on('$stateChangeSuccess', function($event, toState, toStateParams) { @@ -50,9 +51,11 @@ }]); app.controller('ProjectListingCtrl', ['$scope', '$state', 'Django', 'ProjectService', function ($scope, $state, Django, ProjectService) { - + $scope.ui = {}; + $scope.ui.busy = true; + $scope.data.projects = []; ProjectService.list().then(function(projects) { - + $scope.ui.busy = false; $scope.data.projects = _.map(projects, function(p) { p.href = $state.href('projects.view', {projectId: p.uuid}); return p; }); }); diff --git a/designsafe/static/scripts/data-depot/templates/project-list.html b/designsafe/static/scripts/data-depot/templates/project-list.html index 51698604b7..5f0a01ff62 100644 --- a/designsafe/static/scripts/data-depot/templates/project-list.html +++ b/designsafe/static/scripts/data-depot/templates/project-list.html @@ -1,4 +1,4 @@ -
    +
    @@ -8,7 +8,8 @@ - + +
    @@ -25,6 +26,15 @@
    +
    + + Loading... + +
    +
    diff --git a/designsafe/static/scripts/ng-designsafe/html/directives/dd-box-listing.html b/designsafe/static/scripts/ng-designsafe/html/directives/dd-box-listing.html index 604bed4314..b1ddf7e3d2 100644 --- a/designsafe/static/scripts/ng-designsafe/html/directives/dd-box-listing.html +++ b/designsafe/static/scripts/ng-designsafe/html/directives/dd-box-listing.html @@ -7,8 +7,9 @@ Details - - + @@ -33,10 +34,12 @@ - + -
    - +
    + Loading...
    diff --git a/designsafe/static/scripts/ng-designsafe/html/directives/dd-listing.html b/designsafe/static/scripts/ng-designsafe/html/directives/dd-listing.html index 07ed43fa40..692d373a0c 100644 --- a/designsafe/static/scripts/ng-designsafe/html/directives/dd-listing.html +++ b/designsafe/static/scripts/ng-designsafe/html/directives/dd-listing.html @@ -11,8 +11,9 @@ Details - - + @@ -38,10 +39,12 @@ - + -
    - +
    + Loading...
    diff --git a/designsafe/static/scripts/ng-designsafe/html/directives/dd-public-listing.html b/designsafe/static/scripts/ng-designsafe/html/directives/dd-public-listing.html index 28c459b6bd..48575fa2e5 100644 --- a/designsafe/static/scripts/ng-designsafe/html/directives/dd-public-listing.html +++ b/designsafe/static/scripts/ng-designsafe/html/directives/dd-public-listing.html @@ -10,8 +10,9 @@ Details - - + @@ -36,10 +37,12 @@ - + -
    - +
    + Loading...
    diff --git a/designsafe/static/scripts/ng-designsafe/html/directives/dd-public-search-listing.html b/designsafe/static/scripts/ng-designsafe/html/directives/dd-public-search-listing.html index 8042626781..0f5dab0de8 100644 --- a/designsafe/static/scripts/ng-designsafe/html/directives/dd-public-search-listing.html +++ b/designsafe/static/scripts/ng-designsafe/html/directives/dd-public-search-listing.html @@ -8,8 +8,9 @@ Details - - + @@ -35,10 +36,12 @@ - + -
    - +
    + Loading...
    diff --git a/designsafe/static/scripts/ng-designsafe/html/directives/dd-search-listing.html b/designsafe/static/scripts/ng-designsafe/html/directives/dd-search-listing.html index 7e21de2117..72c7fa3313 100644 --- a/designsafe/static/scripts/ng-designsafe/html/directives/dd-search-listing.html +++ b/designsafe/static/scripts/ng-designsafe/html/directives/dd-search-listing.html @@ -8,8 +8,9 @@ Details - - + @@ -35,10 +36,12 @@ - + -
    - +
    + Loading...
    diff --git a/designsafe/static/scripts/ng-designsafe/html/directives/dd-shared-listing.html b/designsafe/static/scripts/ng-designsafe/html/directives/dd-shared-listing.html index 93335d56b0..77a4753c8f 100644 --- a/designsafe/static/scripts/ng-designsafe/html/directives/dd-shared-listing.html +++ b/designsafe/static/scripts/ng-designsafe/html/directives/dd-shared-listing.html @@ -8,8 +8,9 @@ Details - - + @@ -33,10 +34,12 @@ - + -
    - +
    + Loading...
    From 8d5e86f393b0dbabd6493d624233dd700b5b3c9e Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Tue, 14 Feb 2017 09:33:20 -0600 Subject: [PATCH 132/520] Fixing typos in models base --- designsafe/apps/api/agave/models/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designsafe/apps/api/agave/models/base.py b/designsafe/apps/api/agave/models/base.py index cef214969d..ba2e193f98 100644 --- a/designsafe/apps/api/agave/models/base.py +++ b/designsafe/apps/api/agave/models/base.py @@ -21,7 +21,7 @@ def __init__(self, uuid=None, uuids=None, related_obj_name=None, rel_cls=None): def __call__(self, agave_client): if self.uuid: - self.query['associationIds'] = [self.uuid] + self.query['associationIds'] = self.uuid elif self.uuids is not None: if isinstance(self.uuids, basestring): self.uuids = [self.uuids] @@ -83,7 +83,7 @@ def set_client(self, agave_client): setattr(self.model_cls._meta, 'agave_client', agave_client) def get(self, agave_client, uuid): - meta = agave_client.getMetadata(uuid=uuid) + meta = agave_client.meta.getMetadata(uuid=uuid) return self.model_cls(**meta) def list(self, agave_client, association_id=None): From da27424678ab36649daf42f619a76ead243ebad1 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Tue, 14 Feb 2017 09:34:09 -0600 Subject: [PATCH 133/520] Adding related fields when serializing Experimental PRojects --- designsafe/apps/api/projects/models.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/designsafe/apps/api/projects/models.py b/designsafe/apps/api/projects/models.py index 813b484eff..a0983374ef 100644 --- a/designsafe/apps/api/projects/models.py +++ b/designsafe/apps/api/projects/models.py @@ -185,7 +185,7 @@ def project_data_listing(self, path='/'): class ExperimentalProject(MetadataModel): model_name = 'designsafe.project' - team_member = fields.ListField('Team Members') + team_members = fields.ListField('Team Members') project_type = fields.CharField('Project Type', max_length=255, default='other') description = fields.CharField('Description', max_length=1024, default='') title = fields.CharField('Title', max_length=255, default='') @@ -194,6 +194,18 @@ class ExperimentalProject(MetadataModel): associated_projects = fields.ListField('Associated Project') ef = fields.CharField('Experimental Facility', max_length=512) + def to_body_dict(self): + body_dict = super(ExperimentalProject, self).to_body_dict() + body_dict['_related'] = {} + for attrname, field in six.iteritems(self._meta._related_fields): + body_dict['_related'][attrname] = field.rel_cls.model_name + + for attrname in self._meta._reverse_fields: + field = getattr(self, attrname) + body_dict['_related'][attrname] = field.related_obj_name + + return body_dict + class FileModel(MetadataModel): model_name = 'designsafe.file' keywords = fields.ListField('Keywords') From 5594a09296c7f68487e639eaa0a89da55aece475 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 29 Mar 2017 13:08:51 -0500 Subject: [PATCH 134/520] Updating project's urls --- designsafe/apps/api/projects/urls.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/designsafe/apps/api/projects/urls.py b/designsafe/apps/api/projects/urls.py index e09e8fae2d..8b45ff4d05 100644 --- a/designsafe/apps/api/projects/urls.py +++ b/designsafe/apps/api/projects/urls.py @@ -16,21 +16,27 @@ ProjectDataView, ProjectCollaboratorsView, ProjectInstanceView, - ProjectMetaListView, ProjectMetaView) urlpatterns = [ url(r'^$', ProjectCollectionView.as_view(), name='index'), url(r'^listing/(?P[a-zA-Z0-9\-_\.]+)/?$', ProjectListingView.as_view(), name='listing'), - url(r'^(?P[a-z0-9\-]+)/$', ProjectInstanceView.as_view(), name='project'), + + url(r'^meta/(?P[^ \/]+)/?$', + ProjectMetaView.as_view(), name='project_meta'), + + url(r'^(?P[a-z0-9\-]+)/meta/(?P[a-zA-Z0-9\.\-_]+)/?$', + ProjectMetaView.as_view(), name='project_meta'), + + url(r'^(?P[a-z0-9\-]+)/$', + ProjectInstanceView.as_view(), name='project'), + url(r'^(?P[a-z0-9\-]+)/collaborators/$', ProjectCollaboratorsView.as_view(), name='project_collaborators'), + url(r'^(?P[a-z0-9\-]+)/data/$', ProjectDataView.as_view(), name='project_data'), + url(r'^(?P[a-z0-9\-]+)/data/(?P.*)/$', ProjectDataView.as_view(), name='project_data'), - url(r'^(?P[a-z0-9\-]+)/meta/list/((?P.*))?/?$', ProjectMetaListView.as_view(), name='project_meta'), - - url(r'^(?P[a-z0-9\-]+)/meta/(?P[a-zA-Z0-9\.\-_])/?$', ProjectMetaView.as_view(), name='project_meta'), - url(r'^meta/(?P[a-zA-Z0-9\.\-_])/(?P[^ \/])/?$', ProjectMetaView.as_view(), name='project_meta'), ] From d7abfa2755786772d82bcd94a17f4c654425221b Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 29 Mar 2017 13:10:15 -0500 Subject: [PATCH 135/520] Updating project's views --- designsafe/apps/api/projects/views.py | 79 ++++++++++++--------------- 1 file changed, 34 insertions(+), 45 deletions(-) diff --git a/designsafe/apps/api/projects/views.py b/designsafe/apps/api/projects/views.py index 88a99e12fc..fb0e2cc029 100644 --- a/designsafe/apps/api/projects/views.py +++ b/designsafe/apps/api/projects/views.py @@ -179,8 +179,24 @@ def post(self, request): return JsonResponse(p, encoder=AgaveJSONEncoder, safe=False) +class ProjectMetaLookupMixin(object): + def _lookup_model(self, name): + if name == 'designsafe.project': + return ExperimentalProject + elif name == 'designsafe.project.experiment': + return Experiment + elif name == 'designsafe.project.event': + return Event + elif name == 'designsafe.project.analysis': + return Analysis + elif name == 'designsafe.project.sensor_list': + return SensorList + elif name == 'designsafe.project.model_config': + return ModelConfiguration + else: + raise ValueError('No module found with that name.') -class ProjectInstanceView(SecureMixin, BaseApiView): +class ProjectInstanceView(SecureMixin, BaseApiView, ProjectMetaLookupMixin): def get(self, request, project_id): """ @@ -189,8 +205,11 @@ def get(self, request, project_id): :rtype: JsonResponse """ ag = request.user.agave_oauth.client - project = Project.from_uuid(agave_client=ag, uuid=project_id) - return JsonResponse(project, encoder=AgaveJSONEncoder, safe=False) + #project = Project.from_uuid(agave_client=ag, uuid=project_id) + meta_obj = ag.meta.getMetadata(uuid=project_id) + model_cls = self._lookup_model(meta_obj['name']) + project = model_cls(**meta_obj) + return JsonResponse(project.to_body_dict(), safe=False) def post(self, request, project_id): """ @@ -212,6 +231,7 @@ def post(self, request, project_id): project_type = post_data.get('projectType', 'other') associated_projects = post_data.get('associatedProjects', {}) description = post_data.get('description', '') + team_members = post_data.get('teamMembers', []) new_pi = post_data.get('pi') if p.pi != new_pi: p.pi = new_pi @@ -220,7 +240,8 @@ def post(self, request, project_id): award_number=award_number, project_type=project_type, associated_projects=associated_projects, - description=description) + description=description, + team_members=team_members) p.save() return JsonResponse(p, encoder=AgaveJSONEncoder, safe=False) @@ -302,44 +323,9 @@ def get(self, request, project_id, file_path=''): return JsonResponse(listing, encoder=AgaveJSONEncoder, safe=False) -class ProjectMetaLookupMixin(object): - def _lookup_model(self, name): - if name == 'designsafe.project': - return ExperimentalProject - elif name == 'designsafe.project.experiment': - return Experiment - elif name == 'designsafe.project.event': - return Event - elif name == 'designsafe.project.analysis': - return Analysis - elif name == 'designsafe.project.sensor_list': - return SensorList - elif name == 'designsafe.project.model_config': - return ModelConfiguration - else: - raise ValueError('No module found with that name.') - -class ProjectMetaListView(BaseApiView, SecureMixin, ProjectMetaLookupMixin): - - def get(self, request, project_id, name): - """ - - :return: - :rtype: JsonResponse - """ - ag = request.user.agave_oauth.client - name = name.strip('/') - try: - model = self._lookup_model(name) - resp = model._meta.model_manager.list(ag, name, project_id) - except ValueError: - return HttpResponseBadRequest('Entity not valid.') - - return JsonResponse([o.to_body_dict() for o in resp], safe=False) - class ProjectMetaView(BaseApiView, SecureMixin, ProjectMetaLookupMixin): - def get(self, request, name, project_id=None, uuid=None): + def get(self, request, project_id=None, name=None, uuid=None): """ :return: @@ -347,14 +333,17 @@ def get(self, request, name, project_id=None, uuid=None): """ ag = request.user.agave_oauth.client try: - model = self._lookup_model(name) - if project_id is not None: + if name is not None: + model = self._lookup_model(name) resp = model._meta.model_manager.list(ag, project_id) - elif uuid is None: - resp = model._meta.model_manager.get(ag, uuid) + return JsonResponse([r.to_body_dict() for r in resp], safe=False) + elif uuid is not None: + meta = ag.meta.getMetadata(uuid=uuid) + model = self._lookup_model(meta['name']) + resp = model(**meta) + return JsonResponse(resp.to_body_dict(), safe=False) except ValueError: return HttpResponseBadRequest('Entity not valid.') - return JsonResponse(resp.to_body_dict(), safe=False) def post(self, request, project_id, name): """ From 9f1647fa4c6c641a8a3d7c8228b7cc9217593bdc Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Tue, 14 Feb 2017 09:35:23 -0600 Subject: [PATCH 136/520] Adding services to get project's related entities --- .../ng-designsafe/services/project-service.js | 68 +++++++------------ 1 file changed, 25 insertions(+), 43 deletions(-) diff --git a/designsafe/static/scripts/ng-designsafe/services/project-service.js b/designsafe/static/scripts/ng-designsafe/services/project-service.js index 186a50f49c..c7720052fc 100644 --- a/designsafe/static/scripts/ng-designsafe/services/project-service.js +++ b/designsafe/static/scripts/ng-designsafe/services/project-service.js @@ -18,6 +18,17 @@ return val; }; + self.getRelatedAttrName = function(name){ + var attrname = ''; + for (var relName in self._related){ + if (self._related[relName] === name){ + attrname = relName; + break; + } + } + return attrname; + }; + return self; } @@ -33,6 +44,17 @@ var projectResource = httpi.resource('/api/projects/:uuid/').setKeepTrailingSlash(true); var collabResource = httpi.resource('/api/projects/:uuid/collaborators/').setKeepTrailingSlash(true); var dataResource = httpi.resource('/api/projects/:uuid/data/:fileId').setKeepTrailingSlash(true); + var entitiesResource = httpi.resource('/api/projects/:uuid/meta/:name/').setKeepTrailingSlash(true); + + /** + * + * Get list of entities related to a project + */ + service.listEntities = function(options){ + return entitiesResource.get({params: options}).then(function(resp){ + return resp.data; + }); + }; /** * Get a list of Projects for the current user @@ -128,50 +150,10 @@ busy: true }; $scope.form = { - curUsers: [], - addUsers: [{}], - curCoPis: [], - addCoPis: [{}] - }; - var loads = [ - projectResource.get({params: angular.copy(options)}), - collabResource.get({params: angular.copy(options)}) - ]; - $q.all(loads).then(function (results) { - $scope.data.busy = false; - $scope.data.project = results[0].data; - - $scope.form.curUsers = _.map(results[1].data.teamMembers, function (collab) { - return { - user: {username: collab}, - remove: false - }; - }); - $scope.form.curCoPis = _.map(results[1].data.coPis, function (collab) { - return { - user: {username: collab}, - remove: false - }; - }); - }, function (error) { - $scope.data.busy = false; - $scope.data.error = error.data.message || error.data; - }); - - $scope.canManage = function (user) { - var noManage = $scope.data.project.value.pi === user || - Django.user === user || - user === 'ds_admin'; - return ! noManage; - }; - - $scope.formatSelection = function() { - if (this.add.user) { - return this.add.user.first_name + - ' ' + this.add.user.last_name + - ' (' + this.add.user.username + ')'; - } + curExperiments: [], + addExperiments: [{}] }; + $scope.formcurExperiments = options.experiments; $scope.addAnother = function () { $scope.form.addUsers.push({}); From 12bb847c158125d5af4568794fdbda7416ccc431 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Tue, 14 Feb 2017 09:35:54 -0600 Subject: [PATCH 137/520] Adding functions to get project's entities --- .../data-depot/controllers/projects.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/designsafe/static/scripts/data-depot/controllers/projects.js b/designsafe/static/scripts/data-depot/controllers/projects.js index 768c187af6..6723ab62ca 100644 --- a/designsafe/static/scripts/data-depot/controllers/projects.js +++ b/designsafe/static/scripts/data-depot/controllers/projects.js @@ -72,8 +72,24 @@ $scope.data = {}; + var setEntity = function(resp){ + if (!resp.length){ + return; + } + var attribute = $scope.data.project.getRelatedAttrName(resp[0].name); + $scope.data.project[attribute] = resp; + }; + ProjectService.get({uuid: projectId}).then(function (project) { $scope.data.project = project; + var _related = project._related; + for (var attrname in _related){ + var name = _related[attrname]; + ProjectService.listEntities({uuid: projectId, name: name}) + .then( + setEntity + ); + } }); $scope.editProject = function($event) { @@ -93,7 +109,8 @@ $scope.manageExperiments = function($event) { $event.preventDefault(); - ProjectService.manageExperiments({uuid: projectId}).then(function (experiments) { + var experiments = $scope.data.project[$scope.data.project.getRelatedAttrName('designsafe.project.experiment')]; + ProjectService.manageExperiments({'experiments': experiments}).then(function (experiments) { $scope.data.experiments = experiments; }); }; From 8cbba2ed02f586b301950bc76834210e48c054f3 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Tue, 14 Feb 2017 09:36:03 -0600 Subject: [PATCH 138/520] Metadata example --- .../modals/data-browser-service-metadata.html | 83 ++++++++++++++++++- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html b/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html index 321297cab1..373f9b7b57 100644 --- a/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html +++ b/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html @@ -2,10 +2,88 @@
    From 9eae7ba6d9a422e759aa1004852f259df3ed19a5 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 15 Feb 2017 14:59:06 -0600 Subject: [PATCH 139/520] Moving schema vars to class __init__ --- designsafe/apps/api/agave/models/base.py | 67 +++++++++++++++--------- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/designsafe/apps/api/agave/models/base.py b/designsafe/apps/api/agave/models/base.py index ba2e193f98..35429a6a4e 100644 --- a/designsafe/apps/api/agave/models/base.py +++ b/designsafe/apps/api/agave/models/base.py @@ -103,6 +103,10 @@ def __init__(self, values): class Options(object): """Options class to store model's _meta data """ + _model = None + _schema_fields = ['uuid', 'schema_id', 'internal_username', + 'association_ids', 'last_updated', 'created', + 'owner', 'name', '_links'] def __init__(self, model_name): self._nested_fields = {} @@ -110,17 +114,8 @@ def __init__(self, model_name): self._reverse_fields = [] self._fields_map = {} self._fields = [] - self._model = None self.name = model_name self.model_name = model_name - self.uuid = None - self.schema_id = None - self.internal_username = None - self.association_ids = [] - self.last_updated = None - self.created = None - self.owner = None - self._links = None self.model_manager = None def add_field(self, field): @@ -136,12 +131,7 @@ def contribute_to_class(self, cls, name): cls._meta = self self._model = cls - def _set_values(self, values): - links = values.pop('_links') - self._links = Links(links) - for attrname, val in six.iteritems(values): - attrname = camelcase_to_spinal(attrname) - setattr(self, attrname, val) + class BaseModel(type): """ @@ -206,6 +196,15 @@ class Model(object): __metaclass__ = BaseModel def __init__(self, **kwargs): + self.uuid = None + self.schema_id = None + self.internal_username = None + self.association_ids = [] + self.last_updated = None + self.created = None + self.owner = None + self.__links = None + self.name = None #logger.debug('kwargs: %s', json.dumps(kwargs, indent=4)) cls = self.__class__ opts = self._meta @@ -215,7 +214,11 @@ def __init__(self, **kwargs): obj_value = kwargs else: obj_value = kwargs.pop('value', {}) - opts._set_values(kwargs) + links = kwargs.pop('_links', {}) + self._links = Links(links) + for attrname, val in six.iteritems(kwargs): + attrname = camelcase_to_spinal(attrname) + setattr(self, attrname, val) for attrname, field in six.iteritems(opts._fields_map): _setattr(self, attrname, self._get_init_value(field, obj_value, attrname)) @@ -236,7 +239,10 @@ def __init__(self, **kwargs): for attrname in opts._reverse_fields: field = getattr(self, attrname) - field.uuid = self._meta.uuid + field.uuid = self.uuid + + if self.name is None: + self.name = self._meta.model_name super(Model, self).__init__() @@ -263,12 +269,13 @@ def to_dict(self): def to_body_dict(self): dict_obj = {} - for attrname, value in six.iteritems(self._meta.__dict__): - if not attrname.startswith('_'): + for attrname in self._meta._schema_fields: + value = getattr(self, attrname, None) + if not inspect.isclass(value): dict_obj[spinal_to_camelcase(attrname)] = value dict_obj['_links'] = {} - for attrname, value in six.iteritems(self._meta._links.__dict__): + for attrname, value in six.iteritems(self._links.__dict__): dict_obj['_links'][spinal_to_camelcase(attrname)] = value dict_obj['value'] = {} @@ -287,15 +294,25 @@ def to_body_dict(self): return dict_obj def save(self, agave_client): - body = self.to_boy_dict() - if self._meta.uuid is None: - logger.debug('Adding Metadata: %s, with: %s', self._meta.name, body) + body = self.to_body_dict() + if self.uuid is None: + logger.debug('Adding Metadata: %s, with: %s', self.name, body) ret = agave_client.meta.addMetadata(body=body) else: - logger.debug('Updating Metadata: %s, with: %s', self._meta.uuid, body) - ret = agave_client.meta.updateMetadata(uuid=self._meta.uuid, body=body) + logger.debug('Updating Metadata: %s, with: %s', self.uuid, body) + ret = agave_client.meta.updateMetadata(uuid=self.uuid, body=body) return ret + def associate(self, value): + _aids = self.association_ids[:] + if isinstance(value, basestring): + _aids.append(value) + else: + _aids += value + + self.association_ids = list(set(_aids)) + return self.association_ids + @property def manager(self): return self._meta.model_manager From 5cabbec4597c252ae91d92208916fe352e615673 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 15 Feb 2017 14:59:24 -0600 Subject: [PATCH 140/520] Adding experimental facility --- designsafe/apps/api/projects/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/designsafe/apps/api/projects/models.py b/designsafe/apps/api/projects/models.py index a0983374ef..52f9c9d693 100644 --- a/designsafe/apps/api/projects/models.py +++ b/designsafe/apps/api/projects/models.py @@ -216,6 +216,7 @@ class Experiment(MetadataModel): experiment_type = fields.CharField('Experiment Type', max_length=255, default='other') description = fields.CharField('Description', max_length=1024, default='') title = fields.CharField('Title', max_length=1024) + experimental_facility = fields.CharField('Experimental Facility', max_length=1024) project = fields.RelatedObjectField(ExperimentalProject) class Event(MetadataModel): From a397e7eadcbd62076ab7cdb797032dbcaf92dd2a Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 15 Feb 2017 14:59:56 -0600 Subject: [PATCH 141/520] Adding delete, correct association and permission setting --- designsafe/apps/api/projects/views.py | 30 +++++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/designsafe/apps/api/projects/views.py b/designsafe/apps/api/projects/views.py index fb0e2cc029..040532327e 100644 --- a/designsafe/apps/api/projects/views.py +++ b/designsafe/apps/api/projects/views.py @@ -345,6 +345,16 @@ def get(self, request, project_id=None, name=None, uuid=None): except ValueError: return HttpResponseBadRequest('Entity not valid.') + def delete(self, request, uuid): + """ + + :return: + :rtype: JsonResponse + """ + ag = get_service_account_client() + ag.meta.deleteMetadata(uuid=uuid) + return JsonResponse({'message':'OK'}, safe=False) + def post(self, request, project_id, name): """ @@ -357,13 +367,15 @@ def post(self, request, project_id, name): post_data = json.loads(request.body) else: post_data = request.POST.copy() - + entity = post_data.get('entity') try: model_cls = self._lookup_model(name) - model = model_cls(value=post_data) + logger.debug('entity: %s', entity) + model = model_cls(value=entity) + logger.debug('model uuid: %s', model.uuid) file_uuids = [] - if 'filePaths' in post_data: - file_paths = post_data.get('filePaths', []) + if 'filePaths' in entity: + file_paths = experiment.get('filePaths', []) project_system = ''.join(['project-', project_id]) user_ag = request.user.agave_oauth.client for file_path in file_paths: @@ -375,6 +387,7 @@ def post(self, request, project_id, name): for file_uuid in file_uuids: model.files.add(file_uuid) model.project.add(project_id) + model.associate(project_id) saved = model.save(ag) resp = model_cls(**saved) #TODO: This should happen in a celery task and implemented in a manager @@ -382,11 +395,10 @@ def post(self, request, project_id, name): pems = BaseMetadataPermissionResource.list_permissions(project_id, ag) #Loop permissions and set them in whatever metadata object we're saving for pem in pems: - _pem = BaseMetadataPermissionResource(resp._meta.uuid, ag) - _pem.username = pems['username'] - _pem.read = pems['permission']['read'] - _pem.write = pems['permission']['write'] - _pem.read = pems['permission']['execute'] + _pem = BaseMetadataPermissionResource(resp.uuid, ag) + _pem.username = pem.username + _pem.read = pem.read + _pem.write = pem.write _pem.save() except ValueError: From 8e59cfc4922a740e775194f3fbff67e18e775d9a Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 16 Feb 2017 02:01:46 -0600 Subject: [PATCH 142/520] Adding missing related fields --- designsafe/apps/api/projects/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designsafe/apps/api/projects/models.py b/designsafe/apps/api/projects/models.py index 52f9c9d693..7f4bc42ec4 100644 --- a/designsafe/apps/api/projects/models.py +++ b/designsafe/apps/api/projects/models.py @@ -224,6 +224,7 @@ class Event(MetadataModel): event_type = fields.CharField('Event Type', max_length=255, default='other') title = fields.CharField('Title', max_length=1024) description = fields.CharField('Description', max_length=1024, default='') + files = fields.RelatedObjectField(FileModel, multiple=True) project = fields.RelatedObjectField(ExperimentalProject) experiments = fields.RelatedObjectField(Experiment) @@ -232,6 +233,7 @@ class Analysis(MetadataModel): analysis_type = fields.CharField('Analysis Type', max_length=255, default='other') title = fields.CharField('Title', max_length=1024) description = fields.CharField('Description', max_length=1024, default='') + files = fields.RelatedObjectField(FileModel, multiple=True) project = fields.RelatedObjectField(ExperimentalProject) experiments = fields.RelatedObjectField(Experiment) @@ -240,6 +242,8 @@ class SensorList(MetadataModel): sensor_list_type = fields.CharField('Sensor List Type', max_length=255, default='other') title = fields.CharField('Title', max_length=1024) description = fields.CharField('Description', max_length=1024, default='') + events = fields.RelatedObjectField(Event) + files = fields.RelatedObjectField(FileModel, multiple=True) project = fields.RelatedObjectField(ExperimentalProject) experiments = fields.RelatedObjectField(Experiment) @@ -248,6 +252,7 @@ class ModelConfiguration(MetadataModel): title = fields.CharField('Title', max_length=512) description = fields.CharField('Description', max_length=1024, default='') coverage = fields.CharField('Coverage', max_length=512) + events = fields.RelatedObjectField(Event) files = fields.RelatedObjectField(FileModel, multiple=True) project = fields.RelatedObjectField(ExperimentalProject) experiments = fields.RelatedObjectField(Experiment) From 530176fb7f87924d2f363ff7adb27a9d0dfe34a5 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 16 Feb 2017 02:02:22 -0600 Subject: [PATCH 143/520] Fixing adding associated files and update view --- designsafe/apps/api/projects/views.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/designsafe/apps/api/projects/views.py b/designsafe/apps/api/projects/views.py index 040532327e..5ca03e857c 100644 --- a/designsafe/apps/api/projects/views.py +++ b/designsafe/apps/api/projects/views.py @@ -375,7 +375,7 @@ def post(self, request, project_id, name): logger.debug('model uuid: %s', model.uuid) file_uuids = [] if 'filePaths' in entity: - file_paths = experiment.get('filePaths', []) + file_paths = entity.get('filePaths', []) project_system = ''.join(['project-', project_id]) user_ag = request.user.agave_oauth.client for file_path in file_paths: @@ -386,6 +386,7 @@ def post(self, request, project_id, name): file_uuids.append(file_obj.uuid) for file_uuid in file_uuids: model.files.add(file_uuid) + model.associate(file_uuids) model.project.add(project_id) model.associate(project_id) saved = model.save(ag) @@ -406,7 +407,7 @@ def post(self, request, project_id, name): return JsonResponse(resp.to_body_dict(), safe=False) - def put(self, request, name, uuid): + def put(self, request, uuid): """ :param request: @@ -419,9 +420,10 @@ def put(self, request, name, uuid): else: post_data = request.POST.copy() try: - model_cls = self._lookup_model(name) - model = model_cls(uuid=uuid, value=post_data) - saved = model.save() + entity = post_data.get('entity') + model_cls = self._lookup_model(entity['name']) + model = model_cls(**entity) + saved = model.save(ag) resp = model_cls(**saved) except ValueError: return HttpResponseBadRequest('Entity not valid.') From 083a142fa7e47f72fdecb9004558fc5b4a87ef8c Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 16 Feb 2017 02:02:41 -0600 Subject: [PATCH 144/520] Letting label be shown always --- .../static/scripts/data-depot/controllers/data-depot-toolbar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designsafe/static/scripts/data-depot/controllers/data-depot-toolbar.js b/designsafe/static/scripts/data-depot/controllers/data-depot-toolbar.js index 741a2366ad..8e9e6065b9 100644 --- a/designsafe/static/scripts/data-depot/controllers/data-depot-toolbar.js +++ b/designsafe/static/scripts/data-depot/controllers/data-depot-toolbar.js @@ -45,7 +45,7 @@ DataBrowserService.previewImages($scope.browser.listing); }, viewMetadata: function () { - DataBrowserService.viewMetadata($scope.browser.selected[0], $scope.browser.listing); + DataBrowserService.viewMetadata($scope.browser.selected, $scope.browser.listing); }, share: function () { DataBrowserService.share($scope.browser.selected[0]); From 0f74f797532ee6f0726f9c5f4211ed971ebc3f59 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 16 Feb 2017 02:02:53 -0600 Subject: [PATCH 145/520] Adding projects logic --- .../data-depot/controllers/projects.js | 72 +++++++++++++++++-- 1 file changed, 66 insertions(+), 6 deletions(-) diff --git a/designsafe/static/scripts/data-depot/controllers/projects.js b/designsafe/static/scripts/data-depot/controllers/projects.js index 6723ab62ca..73b98b967c 100644 --- a/designsafe/static/scripts/data-depot/controllers/projects.js +++ b/designsafe/static/scripts/data-depot/controllers/projects.js @@ -68,7 +68,7 @@ }]); - app.controller('ProjectViewCtrl', ['$scope', '$state', 'Django', 'ProjectService', 'DataBrowserService', 'projectId', function ($scope, $state, Django, ProjectService, DataBrowserService, projectId) { + app.controller('ProjectViewCtrl', ['$scope', '$state', 'Django', 'ProjectService', 'DataBrowserService', 'projectId', '$q', function ($scope, $state, Django, ProjectService, DataBrowserService, projectId, $q) { $scope.data = {}; @@ -82,16 +82,29 @@ ProjectService.get({uuid: projectId}).then(function (project) { $scope.data.project = project; + DataBrowserService.state().project = project; + DataBrowserService.state().loadingEntities = true; var _related = project._related; + var tasks = []; for (var attrname in _related){ var name = _related[attrname]; - ProjectService.listEntities({uuid: projectId, name: name}) - .then( - setEntity - ); + if (name != 'designsafe.file'){ + tasks.push(ProjectService.listEntities( + {uuid: projectId, name: name}) + .then( + setEntity + )); + } } + $q.all(tasks).then( + function(resp){ + DataBrowserService.state().loadingEntities = false; + }, function(err){ + DataBrowserService.state().loadingEntities = false; + }); }); + $scope.editProject = function($event) { $event.preventDefault(); ProjectService.editProject($scope.data.project) @@ -110,7 +123,8 @@ $scope.manageExperiments = function($event) { $event.preventDefault(); var experiments = $scope.data.project[$scope.data.project.getRelatedAttrName('designsafe.project.experiment')]; - ProjectService.manageExperiments({'experiments': experiments}).then(function (experiments) { + ProjectService.manageExperiments({'experiments': experiments, + 'project': $scope.data.project}).then(function (experiments) { $scope.data.experiments = experiments; }); }; @@ -125,6 +139,42 @@ if (typeof $scope.browser !== 'undefined'){ $scope.browser.busy = true; } + var setFileEntities = function(){ + var entities = [].concat($scope.browser.project.experiment_set, + $scope.browser.project.event_set, + $scope.browser.project.analysis_set, + $scope.browser.project.sensorlist_set, + $scope.browser.project.modelconfig_set); + var entitiesFiles = []; + var sp = 'files/v2/media/system/project-' + $scope.browser.project.uuid; + _.each($scope.browser.listing.children, function(child){ + if (typeof child._entities === 'undefined'){ + child._entities = []; + var path = child.path; + _.each(entities, function(entity){ + if (typeof entity !== 'undefined' && + typeof entity._links !== 'undefined' && + typeof entity._links.associationIds !== 'undefined'){ + _.each(entity._links.associationIds, function(asc){ + if (asc.title === 'file'){ + var s = asc.href.split(sp)[1]; + if (path == s){ + var _name = entity.name.split('.'); + var _name = _name[_name.length-1]; + var camelCased = _name.replace(/_([a-z])/g, + function (g) { return g[1].toUpperCase(); }); + camelCased = camelCased.charAt(0).toUpperCase() + camelCased.slice(1); + entity._displayName = camelCased; + child._entities.push(entity); + } + } + }); + } + }); + } + }); + }; + DataBrowserService.browse({system: 'project-' + projectId, path: filePath}) .then(function () { $scope.browser = DataBrowserService.state(); @@ -140,6 +190,16 @@ projectTitle: projectTitle }); }); + if (typeof $scope.browser.loadingEntities !== 'undefined' && + !$scope.browser.loadingEntities){ + setFileEntities(); + } else { + $scope.$watch('browser.loadingEntities', function(newVal, oldVal){ + if (!newVal){ + setFileEntities(); + } + }); + } }); $scope.onBrowseData = function onBrowseData($event, file) { From 9e68703aaca30ca0ba0716bbbbb7b53ac3a67c40 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 16 Feb 2017 02:03:20 -0600 Subject: [PATCH 146/520] Updating template --- .../static/scripts/data-depot/templates/data-depot-toolbar.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designsafe/static/scripts/data-depot/templates/data-depot-toolbar.html b/designsafe/static/scripts/data-depot/templates/data-depot-toolbar.html index bb086c0138..f3d82967bd 100644 --- a/designsafe/static/scripts/data-depot/templates/data-depot-toolbar.html +++ b/designsafe/static/scripts/data-depot/templates/data-depot-toolbar.html @@ -19,7 +19,7 @@ -
    From 863029be7d11dd5ea79a6d44f97e6ec2d3c15812 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 16 Feb 2017 02:03:34 -0600 Subject: [PATCH 147/520] Adding correct listing --- .../ng-designsafe/html/directives/dd-listing.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/designsafe/static/scripts/ng-designsafe/html/directives/dd-listing.html b/designsafe/static/scripts/ng-designsafe/html/directives/dd-listing.html index 692d373a0c..f83c4e37a0 100644 --- a/designsafe/static/scripts/ng-designsafe/html/directives/dd-listing.html +++ b/designsafe/static/scripts/ng-designsafe/html/directives/dd-listing.html @@ -22,6 +22,15 @@
    {{ item.name }} +
    + + Loading + + {{ entity._displayName }} + {{entity.value.title}} +
    {{ item.length|bytes }} {{ item.lastModified|date:"short" }} From 66727c439350a078846fb44f6425c9f79d12bede Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 16 Feb 2017 02:04:04 -0600 Subject: [PATCH 148/520] Showing correct entities in metadata model --- .../modals/data-browser-service-metadata.html | 165 ++++++++++-------- 1 file changed, 95 insertions(+), 70 deletions(-) diff --git a/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html b/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html index 373f9b7b57..352cff97fe 100644 --- a/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html +++ b/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html @@ -1,96 +1,77 @@
    - +
    From 81846779fac7d190b00a0c0412a213ea9dd3eb06 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 23 Feb 2017 02:23:45 -0600 Subject: [PATCH 172/520] Improving getAllRelatedObject on project model --- .../static/scripts/ng-designsafe/models/project.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/designsafe/static/scripts/ng-designsafe/models/project.js b/designsafe/static/scripts/ng-designsafe/models/project.js index 12239a8fcf..7c0601775b 100644 --- a/designsafe/static/scripts/ng-designsafe/models/project.js +++ b/designsafe/static/scripts/ng-designsafe/models/project.js @@ -65,6 +65,7 @@ self[attr].push(entity); } } + self._allRelatedObjects = undefined; }; /*** @@ -129,11 +130,14 @@ */ Project.prototype.getAllRelatedObjects = function(){ var self = this; - var ret = []; - _.each(self._related, function(name, attr){ - ret = ret.concat(self[attr]); - }); - return ret; + if (typeof self._allRelatedObjects === 'undefined'){ + var ret = []; + _.each(self._related, function(name, attr){ + ret = ret.concat(self[attr]); + }); + self._allRelatedObjects = _.compact(ret); + } + return self._allRelatedObjects; }; return Project; From 17926a64a37f4493096127ca2387b0093b211c78 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 23 Feb 2017 02:24:15 -0600 Subject: [PATCH 173/520] Adding logic to show Tag modal after upload --- .../services/data-browser-service.js | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/designsafe/static/scripts/ng-designsafe/services/data-browser-service.js b/designsafe/static/scripts/ng-designsafe/services/data-browser-service.js index e1b5beb592..d7635ceadd 100644 --- a/designsafe/static/scripts/ng-designsafe/services/data-browser-service.js +++ b/designsafe/static/scripts/ng-designsafe/services/data-browser-service.js @@ -40,7 +40,8 @@ reachedEnd: false, page: 0, showMainListing: true, - showPreviewListing: false + showPreviewListing: false, + ui: {} }; var apiParams = { @@ -1130,7 +1131,8 @@ uploading: false, retry: false, directoryUpload: directoryUpload, - directoryUploadSupported: Modernizr.fileinputdirectory + directoryUploadSupported: Modernizr.fileinputdirectory, + ui: {tagFiles: false} }; $scope.$watch('data.selectedFiles', function(newValue) { @@ -1145,6 +1147,24 @@ // reset file control since we want to allow multiple selection events $('#id-choose-files').val(null); }); + + $scope.tagFiles = function(){ + $uibModalInstance.close(); + var files = _.filter(currentState.listing.children, function(child){ + if(_.find($scope.data.uploads, function(upload){ + return upload.file.name === child.name; + })){ + return true; + }else{ + return false; + } + }); + if (files.length){ + viewMetadata(files); + } else { + viewMetadata(); + } + }; $scope.upload = function() { $scope.state.uploading = true; @@ -1175,6 +1195,10 @@ currentState.busy = true; currentState.listing.fetch().then(function () { currentState.busy = false; + if(currentState.project){ + currentState.ui.tagFiles = true; + $scope.state.ui.tagFiles = true; + } }); var errors = _.filter(results, function (result) { @@ -1186,7 +1210,9 @@ $scope.state.retry = true; } else { // it's all good; close the modal - $uibModalInstance.close(); + if (!currentState.project){ + $uibModalInstance.close(); + } } }); }; From cb036589e3ab42b7e9b520096ad099684c187477 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 23 Feb 2017 02:24:38 -0600 Subject: [PATCH 174/520] Adding text rules for entity colors --- designsafe/static/styles/ng-designsafe.css | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/designsafe/static/styles/ng-designsafe.css b/designsafe/static/styles/ng-designsafe.css index 0e7bc6a19f..00b1454897 100644 --- a/designsafe/static/styles/ng-designsafe.css +++ b/designsafe/static/styles/ng-designsafe.css @@ -388,6 +388,22 @@ tr.experiment-deleted { text-decoration: line-through; } +.ds-text-light-blue { + color: #5BC0DE; +} + +.ds-text-blue { + color: #0567CC; +} + +.ds-text-green { + color: #2EA89A; +} + +.ds-text-red { + color: #D04348; +} + span.label.tag-light-blue { border: 2px solid #5BC0DE; color: black; From 13488628df45940e7824934dca6263ce075270b7 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Thu, 23 Feb 2017 09:21:53 -0600 Subject: [PATCH 175/520] Removing tag attribute --- .../html/modals/data-browser-service-metadata.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html b/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html index af997bf8e3..72b2737e6a 100644 --- a/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html +++ b/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html @@ -113,18 +113,20 @@

    Manage Tags

    Create new tag

    - + From b18e7b6979e66afa15d6dac91fe608904fc69dc3 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 27 Feb 2017 10:07:39 -0600 Subject: [PATCH 176/520] Adding optional values to data models --- designsafe/apps/api/projects/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designsafe/apps/api/projects/models.py b/designsafe/apps/api/projects/models.py index 4edbf4ed90..d2047017a4 100644 --- a/designsafe/apps/api/projects/models.py +++ b/designsafe/apps/api/projects/models.py @@ -241,6 +241,8 @@ class Analysis(RelatedEntity): analysis_type = fields.CharField('Analysis Type', max_length=255, default='other') title = fields.CharField('Title', max_length=1024) description = fields.CharField('Description', max_length=1024, default='') + analysis_data = fields.CharField('Analysis Data', max_length=1024, default='') + application = fields.CharField('Analysis Data', max_length=1024, default='') project = fields.RelatedObjectField(ExperimentalProject) experiments = fields.RelatedObjectField(Experiment) events = fields.RelatedObjectField(Event) @@ -251,6 +253,9 @@ class ModelConfiguration(RelatedEntity): title = fields.CharField('Title', max_length=512) description = fields.CharField('Description', max_length=1024, default='') coverage = fields.CharField('Coverage', max_length=512) + spatial = fields.CharField('Spatial', max_length=1024) + lat = fields.CharField('Lat', max_length=1024) + lon = fields.CharField('Lon', max_length=1024) project = fields.RelatedObjectField(ExperimentalProject) experiments = fields.RelatedObjectField(Experiment) events = fields.RelatedObjectField(Event) From aa4f978b26dd5480988bf4bbea4d8cc9c3a5e3ca Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 27 Feb 2017 10:07:54 -0600 Subject: [PATCH 177/520] Updating toolbar label --- .../scripts/data-depot/templates/data-depot-toolbar.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designsafe/static/scripts/data-depot/templates/data-depot-toolbar.html b/designsafe/static/scripts/data-depot/templates/data-depot-toolbar.html index 7ee3a38a81..072c7049db 100644 --- a/designsafe/static/scripts/data-depot/templates/data-depot-toolbar.html +++ b/designsafe/static/scripts/data-depot/templates/data-depot-toolbar.html @@ -19,8 +19,8 @@ -
    From 8827699f43f7b7bca240e260d729a778bd93e003 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 27 Feb 2017 10:08:29 -0600 Subject: [PATCH 178/520] Updating metadata UI - Now categories (/metadata???) --- .../modals/data-browser-service-metadata.html | 233 +++++++++++++----- 1 file changed, 175 insertions(+), 58 deletions(-) diff --git a/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html b/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html index 72b2737e6a..31fa88e4da 100644 --- a/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html +++ b/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html @@ -1,5 +1,5 @@ From 6c85c83117d5e33ee6a51280e51188236c564082 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Wed, 29 Mar 2017 13:19:41 -0500 Subject: [PATCH 179/520] Adding experimental data to edit project, commented out just in case. Updating manage experiments to add experimental facilities. Updating services to add experimental facilities and sub tags. --- .../modals/project-service-edit-project.html | 11 ++++ .../project-service-manage-experiments.html | 14 +++-- .../scripts/ng-designsafe/models/project.js | 23 +++++++ .../services/data-browser-service.js | 48 +++++++++++++- .../ng-designsafe/services/project-service.js | 63 ++++++++++++++++++- 5 files changed, 150 insertions(+), 9 deletions(-) diff --git a/designsafe/static/scripts/ng-designsafe/html/modals/project-service-edit-project.html b/designsafe/static/scripts/ng-designsafe/html/modals/project-service-edit-project.html index 90cc52a9a8..ca61e17d03 100644 --- a/designsafe/static/scripts/ng-designsafe/html/modals/project-service-edit-project.html +++ b/designsafe/static/scripts/ng-designsafe/html/modals/project-service-edit-project.html @@ -49,6 +49,17 @@
    +

    Your project is tailored based on Project Type choice.

    diff --git a/designsafe/static/scripts/ng-designsafe/html/modals/project-service-manage-experiments.html b/designsafe/static/scripts/ng-designsafe/html/modals/project-service-manage-experiments.html index 8b0c260134..e422c37aa0 100644 --- a/designsafe/static/scripts/ng-designsafe/html/modals/project-service-manage-experiments.html +++ b/designsafe/static/scripts/ng-designsafe/html/modals/project-service-manage-experiments.html @@ -67,12 +67,18 @@
    -
    -

    Assign {{ui.parentEntities[0]._displayName}} tag to file(s) or folder(s)

    +
    +

    Assign + {{ entity._displayName }} + {{entity.value.title}} tag to file(s) or folder(s)

    @@ -100,8 +103,9 @@

    Assign {{ui.parentEntities[0]._displayName}} tag to file(s) or folder(s)

    @@ -250,9 +254,15 @@

    Location

    @@ -271,8 +281,8 @@

    Custom Tags

    --> -
    - +
    +
    diff --git a/designsafe/static/scripts/ng-designsafe/services/data-browser-service.js b/designsafe/static/scripts/ng-designsafe/services/data-browser-service.js index 9d09852f4f..46c78f4fe5 100644 --- a/designsafe/static/scripts/ng-designsafe/services/data-browser-service.js +++ b/designsafe/static/scripts/ng-designsafe/services/data-browser-service.js @@ -1371,6 +1371,24 @@ } }); + $scope.saveFileTags = function(){ + for (var euuid in $scope.data.fileSubTags){ + var sts = $scope.data.fileSubTags[euuid] || []; + var entity = currentState.project.getRelatedByUuid(euuid); + for (var fuuid in sts){ + if (sts[fuuid] == 'none'){ + continue; + } + if (typeof entity[sts[fuuid]] === 'undefined' || + !_.isArray(entity[sts[fuuid]])){ + entity[sts[fuuid]] = []; + } + entity[sts[fuuid]].push(fuuid); + ProjectEntitiesService.update({data: {uuid: entity.uuid, entity:entity}}); + } + } + }; + $scope.ui.parentEntities = currentState.project.getParentEntity($scope.data.files); $scope.doSaveMetadata = function($event) { @@ -1514,6 +1532,7 @@ return file.path; }); } + $scope.ui.addingTag = true; ProjectEntitiesService.create({data: { uuid: currentState.project.uuid, name: newTag.tagType, @@ -1521,6 +1540,8 @@ }}) .then( function(resp){ + $scope.data.form.projectTagToAdd = {optional:{}}; + currentState.project.addEntity(resp); $scope.ui.error = false; $scope.ui.addingTag = false; }, From bb275f57a096ad88fddd5fdc0786072c9e724692 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 27 Feb 2017 11:53:42 -0600 Subject: [PATCH 183/520] Checking if there's a list of related objects before pushing --- designsafe/static/scripts/ng-designsafe/models/project.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designsafe/static/scripts/ng-designsafe/models/project.js b/designsafe/static/scripts/ng-designsafe/models/project.js index dd57050e8b..9d71bd5a89 100644 --- a/designsafe/static/scripts/ng-designsafe/models/project.js +++ b/designsafe/static/scripts/ng-designsafe/models/project.js @@ -62,6 +62,9 @@ var self = this; for (var attr in self._related){ if (self._related[attr] === entity.name){ + if ( typeof self[attr] === 'undefined'){ + self[attr] = []; + } self[attr].push(entity); } } From d4dff232b13e5666b1dae2ead14382bc8aa365c2 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 27 Feb 2017 14:55:53 -0600 Subject: [PATCH 184/520] Loading entities on every browse --- designsafe/static/scripts/data-depot/controllers/projects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designsafe/static/scripts/data-depot/controllers/projects.js b/designsafe/static/scripts/data-depot/controllers/projects.js index 41e667cd3c..d0f4863d68 100644 --- a/designsafe/static/scripts/data-depot/controllers/projects.js +++ b/designsafe/static/scripts/data-depot/controllers/projects.js @@ -180,7 +180,7 @@ !$scope.browser.loadingEntities){ var entities = $scope.browser.project.getAllRelatedObjects(); _.each($scope.browser.listing.children, function(child){ - child.setEntities($scope.brwoser.project.uuid, entities); + child.setEntities(DataBrowserService.state().project.uuid, entities); }); } else { $scope.$watch('browser.loadingEntities', function(newVal, oldVal){ From fae54bd5987c9afd5b32b1e95e740bbc56b22d95 Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 27 Feb 2017 14:58:30 -0600 Subject: [PATCH 185/520] Showing correct data for experiments --- .../services/data-browser-service.js | 77 +++++++++++++++---- .../ng-designsafe/services/project-service.js | 25 +++++- 2 files changed, 87 insertions(+), 15 deletions(-) diff --git a/designsafe/static/scripts/ng-designsafe/services/data-browser-service.js b/designsafe/static/scripts/ng-designsafe/services/data-browser-service.js index 46c78f4fe5..9317c5d6d8 100644 --- a/designsafe/static/scripts/ng-designsafe/services/data-browser-service.js +++ b/designsafe/static/scripts/ng-designsafe/services/data-browser-service.js @@ -1361,17 +1361,53 @@ $scope.error = err; }); } - _.each($scope.data.files, function(file){ - if ($scope.data.fileProjectTags.length === 0){ - $scope.data.fileProjectTags = file._entities; + var _setFileEntities = function(){ + var entities = currentState.project.getAllRelatedObjects(); + _.each($scope.data.files, function(child){ + child.setEntities(currentState.project.uuid, entities); + }); + }; + var _setEntities = function(){ + _.each($scope.data.files, function(file){ + if ($scope.data.fileProjectTags.length === 0){ + $scope.data.fileProjectTags = file._entities; + } + var diff = _.difference($scope.data.fileProjectTags, file._entities); + if (diff.length > 0){ + $scope.data.fileProjectTags = []; + } + }); + }; + _setEntities(); + + $scope.isFileTagged = function(file, entity){ + if (entity.name === 'designsafe.project.event'){ + return _.contains(entity.value.load || [], file.uuid()); + }else if(entity.name === 'designsafe.project.model_config'){ + return _.contains(entity.value.modelDrawing || [], file.uuid()); + }else if(entity.anem === 'designsafe.project.sensor_list'){ + return _.contains(entity.value.sensorDrawing || [], file.uuid()); + }else if(entity.name === 'designsafe.project.analysis'){ + return _.contains(entity.value.script || [], file.uuid()); } - var diff = _.difference($scope.data.fileProjectTags, file._entities); - if (diff.length > 0){ - $scope.data.fileProjectTags = []; + return false; + }; + + $scope.getFileSubTag = function(file, entity){ + if (entity.name === 'designsafe.project.event'){ + return 'Load'; + }else if(entity.name === 'designsafe.project.model_config'){ + return 'Model Drawing'; + }else if(entity.anem === 'designsafe.project.sensor_list'){ + return 'Sensor Drawing'; + }else if(entity.name === 'designsafe.project.analysis'){ + return 'Script'; } - }); + return '-'; + }; $scope.saveFileTags = function(){ + var sttasks = []; for (var euuid in $scope.data.fileSubTags){ var sts = $scope.data.fileSubTags[euuid] || []; var entity = currentState.project.getRelatedByUuid(euuid); @@ -1381,13 +1417,22 @@ } if (typeof entity[sts[fuuid]] === 'undefined' || !_.isArray(entity[sts[fuuid]])){ - entity[sts[fuuid]] = []; + entity.value[sts[fuuid]] = []; + } + entity.value[sts[fuuid]].push(fuuid); + sttasks.push(ProjectEntitiesService.update( + {data: {uuid: entity.uuid, entity:entity}})); } - entity[sts[fuuid]].push(fuuid); - ProjectEntitiesService.update({data: {uuid: entity.uuid, entity:entity}}); } - } - }; + $scope.ui.busy = true; + $q.all(sttasks).then(function(resps){ + $scope.data.fileSubTags = []; + _setFileEntities(); + _setEntities(); + $scope.ui.parentEntities = currentState.project.getParentEntity($scope.data.files); + $scope.ui.busy = false; + }); + }; $scope.ui.parentEntities = currentState.project.getParentEntity($scope.data.files); @@ -1495,9 +1540,12 @@ $scope.ui.busy = true; $q.all(tasks).then( function(e){ - $scope.ui.busy = false; $scope.data.newFileProjectTags = []; $scope.data.projectTagsToUnrelate = []; + _setFileEntities(); + _setEntities(); + $scope.ui.parentEntities = currentState.project.getParentEntity($scope.data.files); + $scope.ui.busy = false; }, function(er){ $scope.ui.busy = false; $scope.ui.error = er; @@ -1542,6 +1590,9 @@ function(resp){ $scope.data.form.projectTagToAdd = {optional:{}}; currentState.project.addEntity(resp); + _setFileEntities(); + _setEntities(); + $scope.ui.parentEntities = currentState.project.getParentEntity($scope.data.files); $scope.ui.error = false; $scope.ui.addingTag = false; }, diff --git a/designsafe/static/scripts/ng-designsafe/services/project-service.js b/designsafe/static/scripts/ng-designsafe/services/project-service.js index 6daaf7a366..5d936e4a12 100644 --- a/designsafe/static/scripts/ng-designsafe/services/project-service.js +++ b/designsafe/static/scripts/ng-designsafe/services/project-service.js @@ -185,6 +185,22 @@ $scope.form.addExperiments.splice(index, 1); }; + $scope.getEF = function(str){ + var efs = $scope.ui.efs[$scope.data.project.value.projectType]; + var ef = _.find(efs, function(ef){ + return ef.name === str; + }); + return ef; + }; + + $scope.getET = function(type, str){ + var ets = $scope.ui.experimentTypes[type]; + var et = _.find(ets, function(et){ + return et.name === str; + }); + return et; + }; + $scope.toggleDeleteExperiment = function(uuid){ if (uuid in $scope.ui.experiments && $scope.ui.experiments[uuid].deleted){ @@ -209,6 +225,8 @@ name: 'designsafe.project.experiment', entity: exp } + }).then(function(res){ + $scope.data.project.addEntity(res); }); } }); @@ -225,10 +243,13 @@ $q.all(tasks).then( function (results) { - $uibModalInstance.close(results); + $scope.data.busy = false; + $scope.form.addExperiments = [{}]; + //$uibModalInstance.close(results); }, function (error) { - $uibModalInstance.reject(error.data); + $scope.data.error = error; + //$uibModalInstance.reject(error.data); } ); }; From bc74bfa9e442d8fb74285d0be97e614f5dd8cedd Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 27 Feb 2017 14:58:53 -0600 Subject: [PATCH 186/520] Showing correct file tag --- .../html/modals/data-browser-service-metadata.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html b/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html index d6f5dc2116..8dc25de330 100644 --- a/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html +++ b/designsafe/static/scripts/ng-designsafe/html/modals/data-browser-service-metadata.html @@ -103,10 +103,12 @@

    Assign

    From 647c3c843b0734b9e54a4b5af86373778b0bf9cd Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 27 Feb 2017 14:59:07 -0600 Subject: [PATCH 187/520] Showing correct data for experiments in UI --- .../project-service-manage-experiments.html | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/designsafe/static/scripts/ng-designsafe/html/modals/project-service-manage-experiments.html b/designsafe/static/scripts/ng-designsafe/html/modals/project-service-manage-experiments.html index e422c37aa0..20a6455c94 100644 --- a/designsafe/static/scripts/ng-designsafe/html/modals/project-service-manage-experiments.html +++ b/designsafe/static/scripts/ng-designsafe/html/modals/project-service-manage-experiments.html @@ -31,8 +31,8 @@ - - + +
    + {{getFileSubTag(file, entity)}}
    {{experiment.value.title}}{{experiment.value.experimentalFacility}}{{experiment.value.experimentType}}{{getEF(experiment.value.experimentalFacility).label}}{{getET(getEF(experiment.value.experimentalFacility).name, experiment.value.experimentType).label}} +
    • {{experiment.value.title}}
        -
      • +
      • Event {{event.value.title}} +
    From a7927924f95c9cd1db1aeaa297ed66eaebc431db Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 27 Feb 2017 15:23:29 -0600 Subject: [PATCH 188/520] Updating entity relationships --- designsafe/apps/api/projects/models.py | 27 ++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/designsafe/apps/api/projects/models.py b/designsafe/apps/api/projects/models.py index 10bd74868b..df9ae16515 100644 --- a/designsafe/apps/api/projects/models.py +++ b/designsafe/apps/api/projects/models.py @@ -227,15 +227,6 @@ class Experiment(RelatedEntity): experimental_facility = fields.CharField('Experimental Facility', max_length=1024) project = fields.RelatedObjectField(ExperimentalProject) -class Event(RelatedEntity): - model_name = 'designsafe.project.event' - event_type = fields.CharField('Event Type', max_length=255, default='other') - title = fields.CharField('Title', max_length=1024) - description = fields.CharField('Description', max_length=1024, default='') - load = fields.RelatedObjectField(FileModel, multiple=True) - project = fields.RelatedObjectField(ExperimentalProject) - experiments = fields.RelatedObjectField(Experiment) - files = fields.RelatedObjectField(FileModel, multiple=True) class Analysis(RelatedEntity): model_name = 'designsafe.project.analysis' @@ -247,7 +238,7 @@ class Analysis(RelatedEntity): script = fields.RelatedObjectField(FileModel, multiple=True) project = fields.RelatedObjectField(ExperimentalProject) experiments = fields.RelatedObjectField(Experiment) - events = fields.RelatedObjectField(Event) + #events = fields.RelatedObjectField(Event) files = fields.RelatedObjectField(FileModel, multiple=True) class ModelConfiguration(RelatedEntity): @@ -261,7 +252,7 @@ class ModelConfiguration(RelatedEntity): model_drawing = fields.RelatedObjectField(FileModel, multiple=True) project = fields.RelatedObjectField(ExperimentalProject) experiments = fields.RelatedObjectField(Experiment) - events = fields.RelatedObjectField(Event) + #events = fields.RelatedObjectField(Event) files = fields.RelatedObjectField(FileModel, multiple=True) class SensorList(RelatedEntity): @@ -272,6 +263,18 @@ class SensorList(RelatedEntity): sensor_drawing = fields.RelatedObjectField(FileModel, multiple=True) project = fields.RelatedObjectField(ExperimentalProject) experiments = fields.RelatedObjectField(Experiment) - events = fields.RelatedObjectField(Event) + #events = fields.RelatedObjectField(Event) + model_configs = fields.RelatedObjectField(ModelConfiguration) + files = fields.RelatedObjectField(FileModel, multiple=True) + +class Event(RelatedEntity): + model_name = 'designsafe.project.event' + event_type = fields.CharField('Event Type', max_length=255, default='other') + title = fields.CharField('Title', max_length=1024) + description = fields.CharField('Description', max_length=1024, default='') + load = fields.RelatedObjectField(FileModel, multiple=True) + project = fields.RelatedObjectField(ExperimentalProject) + experiments = fields.RelatedObjectField(Experiment) model_configs = fields.RelatedObjectField(ModelConfiguration) + sensor_lists = fields.RelatedObjectField(SensorList) files = fields.RelatedObjectField(FileModel, multiple=True) From 58f104bb07d6b2fe55f67e15458a9879007300eb Mon Sep 17 00:00:00 2001 From: Josue Balandrano Coronel Date: Mon, 27 Feb 2017 15:23:43 -0600 Subject: [PATCH 189/520] Updating entity tree --- .../project-service-manage-experiments.html | 76 ++++++++++--------- 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/designsafe/static/scripts/ng-designsafe/html/modals/project-service-manage-experiments.html b/designsafe/static/scripts/ng-designsafe/html/modals/project-service-manage-experiments.html index 20a6455c94..ccc64af05e 100644 --- a/designsafe/static/scripts/ng-designsafe/html/modals/project-service-manage-experiments.html +++ b/designsafe/static/scripts/ng-designsafe/html/modals/project-service-manage-experiments.html @@ -116,78 +116,84 @@
    -
    +
    + style="background:#fff;">

    {{experiment.value.title}}

    @@ -86,41 +92,42 @@

    {{experiment.value.title}}

    - {{experiment.value.experimentalFacility}} + {{experiment.getEF(browser.project.value.projectType, experiment.value.experimentalFacility).label}}
    - {{experiment.value.experimentType}} + {{experiment.getET(experiment.value.experimentalFacility, experiment.value.experimentType).label}}
    -
    +
      @@ -222,6 +231,116 @@
    +
    + +
    +
    + + +
    +
    + +
    +
    +
    +

    Location

    +
    + + +
    +
    + + +
    +
    + + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + +
    +
    + +
    +
    + {{data.error}} +
    +
    +