Skip to content
Permalink
Browse files

Refactor modules into smaller files by guidelines

Now for every main component (panel) there would be one or a few
component.module.js files and separate files for services,
directives, controllers and components, which make up the module.
This will make further splitting of big controller easier and
help avoid conflicts.
refs #217
  • Loading branch information...
raitisbe authored and SLeitgeb committed Jul 15, 2019
1 parent e43bf21 commit 33285a5eead2f8da58e60e16481679c9a0935921
Showing with 11,320 additions and 11,186 deletions.
  1. +1 −1 README.md
  2. +5 −6 app.js
  3. +1 −1 app.js.template
  4. +1 −1 app_material.js
  5. +1 −1 common/wms/get-capabilities.service.js
  6. +1 −1 common/wmts/get-capabilities.service.js
  7. +3 −3 common_paths.js
  8. +2 −2 components/add-layers/add-layers-vector.module.js
  9. +162 −0 components/add-layers/add-layers-wfs.component.js
  10. +6 −167 components/add-layers/add-layers-wfs.module.js
  11. +46 −0 components/add-layers/add-layers-wms.component.js
  12. +10 −60 components/add-layers/add-layers-wms.module.js
  13. +1 −1 components/add-layers/add-layers-wms.service.js
  14. +131 −0 components/add-layers/add-layers-wmts.component.js
  15. +9 −161 components/add-layers/add-layers-wmts.module.js
  16. +30 −0 components/add-layers/add-layers-wmts.service.js
  17. +153 −0 components/add-layers/add-layers.component.js
  18. +4 −155 components/add-layers/add-layers.module.js
  19. +8 −0 components/add-layers/capabilities-error.directive.js
  20. +8 −0 components/add-layers/resample-dialog.directive.js
  21. +0 −105 components/api/api.js
  22. +12 −0 components/api/api.module.js
  23. +94 −0 components/api/api.service.js
  24. +213 −0 components/compositions/compositions-parser.service.js
  25. +518 −0 components/compositions/compositions.component.js
  26. +0 −93 components/compositions/compositions.js
  27. +74 −0 components/compositions/compositions.module.js
  28. +365 −0 components/compositions/compositions.service.js
  29. +17 −0 components/compositions/config-parsers.module.js
  30. +2 −15 components/compositions/{config_parsers.js → config-parsers.service.js}
  31. +8 −0 components/compositions/delete-dialog.directive.js
  32. +0 −522 components/compositions/hs.compositions.controller.js
  33. +0 −382 components/compositions/hs.compositions.service.js
  34. +0 −231 components/compositions/hs.compositions.service_parser.js
  35. +8 −0 components/compositions/info-dialog.directive.js
  36. +8 −0 components/compositions/overwrite-dialog.directive.js
  37. +8 −0 components/compositions/share-dialog.directive.js
  38. +590 −599 components/core/core.js
  39. +6 −0 components/customhtml/customhtml.component.js
  40. +0 −18 components/customhtml/customhtml.js
  41. +8 −0 components/customhtml/customhtml.module.js
  42. +8 −0 components/datasource-selector/advanced-micka-dialog.directive.js
  43. +209 −0 components/datasource-selector/datasource-selector.component.js
  44. +54 −0 components/datasource-selector/datasource-selector.module.js
  45. +506 −0 components/datasource-selector/datasource-selector.service.js
  46. +8 −0 components/datasource-selector/metadata-dialog.directive.js
  47. +29 −0 components/datasource-selector/object.directive.js
  48. 0 components/{datasource_selector → datasource-selector}/partials/datasource_selector.html
  49. 0 components/{datasource_selector → datasource-selector}/partials/dialog_metadata.html
  50. 0 components/{datasource_selector → datasource-selector}/partials/dialog_micka_advanced.html
  51. 0 components/{datasource_selector → datasource-selector}/partials/dialog_micka_suggestions.html
  52. 0 components/{datasource_selector → datasource-selector}/partials/object.html
  53. +11 −0 components/datasource-selector/suggestions-dialog.directive.js
  54. +0 −819 components/datasource_selector/datasource_selector.js
  55. +66 −0 components/drag/drag.directive.js
  56. +0 −80 components/drag/drag.js
  57. +14 −0 components/drag/drag.module.js
  58. +5 −5 components/draw/{draw.js → draw.module.js}
  59. +19 −19 components/{feature_filter/feature_filter.js → feature-filter/feature-filter.module.js}
  60. 0 components/{feature_filter → feature-filter}/partials/feature_filtermd.html
  61. 0 components/{feature_filter → feature-filter}/partials/feature_listmd.html
  62. +0 −306 components/hscesium/hscesium.js
  63. +91 −0 components/hscesium/hscesium.module.js
  64. +214 −0 components/hscesium/hscesium.service.js
  65. +148 −0 components/info/info.component.js
  66. +0 −170 components/info/info.js
  67. +19 −0 components/info/info.module.js
  68. +0 −224 components/layermanager/hs.layermanager.WMSTservice.js
  69. +0 −142 components/layermanager/hs.layermanager.layerlistDirective.js
  70. +0 −714 components/layermanager/hs.layermanager.service.js
  71. +44 −0 components/layermanager/layermanager-folder.directive.js
  72. +119 −0 components/layermanager/layermanager-layerlist.directive.js
  73. +204 −0 components/layermanager/layermanager-wmst.service.js
  74. +13 −128 components/layermanager/{layermanager.js → layermanager.component.js}
  75. +81 −0 components/layermanager/layermanager.module.js
  76. +694 −0 components/layermanager/layermanager.service.js
  77. +1 −1 components/layermanager/partials/layermanagermd.html
  78. +8 −0 components/layermanager/remove-all-dialog.directive.js
  79. +425 −0 components/layout/layout.controller.js
  80. +55 −0 components/layout/layout.directive.js
  81. +0 −722 components/layout/layout.js
  82. +103 −0 components/layout/layout.module.js
  83. +98 −0 components/layout/layout.service.js
  84. +38 −0 components/layout/md-bottomsheet-scroll.directive.js
  85. +11 −0 components/layout/md-overlay.directive.js
  86. +6 −0 components/layout/md-right-panel.directive.js
  87. +5 −0 components/layout/md-sidenav.directive.js
  88. +5 −0 components/layout/md-swipe-area.directive.js
  89. +5 −0 components/layout/md-toolbar.directive.js
  90. +21 −0 components/layout/panel-creator.directive.js
  91. +1 −1 components/layout/partials/bottom-sheet.html
  92. +8 −8 components/layout/partials/layout.html
  93. +8 −0 components/legend/legend-layer.directive.js
  94. +92 −0 components/legend/legend.component.js
  95. +0 −194 components/legend/legend.js
  96. +23 −0 components/legend/legend.module.js
  97. +77 −0 components/legend/legend.service.js
  98. +104 −0 components/map/map.controller.js
  99. +12 −0 components/map/map.directive.js
  100. +0 −584 components/map/map.js
  101. +36 −0 components/map/map.module.js
  102. +442 −0 components/map/map.service.js
  103. +77 −0 components/measure/measure.component.js
  104. +0 −381 components/measure/measure.js
  105. +21 −0 components/measure/measure.module.js
  106. +284 −0 components/measure/measure.service.js
  107. +0 −184 components/mobile_settings/mobile_settings.js
  108. +25 −0 components/mobile_settings/mobile_settings.module.js
  109. +157 −0 components/mobile_settings/partials/mobile_settings.controller.js
  110. +5 −0 components/mobile_settings/partials/mobile_settings.directive.js
  111. +23 −0 components/mobile_toolbar/mobile-toolbar.controller.js
  112. +5 −0 components/mobile_toolbar/mobile-toolbar.directive.js
  113. +32 −0 components/mobile_toolbar/mobile-toolbar.service.js
  114. +0 −88 components/mobile_toolbar/mobile_toolbar.js
  115. +33 −0 components/mobile_toolbar/mobile_toolbar.module.js
  116. +244 −0 components/permalink/permalink-share.service.js
  117. +259 −0 components/permalink/permalink-url.service.js
  118. +64 −0 components/permalink/permalink.component.js
  119. +0 −604 components/permalink/permalink.js
  120. +42 −0 components/permalink/permalink.module.js
  121. +30 −0 components/print/print.component.js
  122. +0 −75 components/print/print.js
  123. +25 −0 components/print/print.module.js
  124. +25 −0 components/print/print.service.js
  125. +157 −0 components/query/query-base.service.js
  126. +6 −0 components/query/query-info-panel-md.directive.js
  127. +6 −0 components/query/query-info-panel.directive.js
  128. +34 −0 components/query/query-infovalue.directive.js
  129. +105 −0 components/query/query-vector.service.js
  130. +199 −0 components/query/query-wms.service.js
  131. +117 −0 components/query/query.controller.js
  132. +0 −649 components/query/query.js
  133. +70 −0 components/query/query.module.js
  134. BIN components/{status_creator → save-map}/notAvailable.png
  135. +1 −1 components/{status_creator → save-map}/partials/dialog.html
  136. 0 components/{status_creator → save-map}/partials/dialog_result.html
  137. 0 components/{status_creator → save-map}/partials/dialog_save.html
  138. 0 components/{status_creator → save-map}/partials/form.html
  139. +2 −2 components/{status_creator → save-map}/partials/panel.html
  140. 0 components/{status_creator → save-map}/partials/panelmd.html
  141. 0 components/{status_creator → save-map}/partials/simpleform.html
  142. +264 −0 components/save-map/save-map-manager.service.js
  143. +143 −0 components/save-map/save-map.component.js
  144. +120 −0 components/save-map/save-map.module.js
  145. +388 −0 components/save-map/save-map.service.js
  146. +2 −2 components/search/partials/searchinput.html
  147. +15 −0 components/search/search-input.directive.js
  148. +9 −0 components/search/search-results.directive.js
  149. +110 −0 components/search/search.controller.js
  150. +0 −355 components/search/search.js
  151. +37 −0 components/search/search.module.js
  152. +198 −0 components/search/search.service.js
  153. +3 −3 components/sidebar/partials/sidebar.html
  154. +20 −0 components/sidebar/sidebar-mini.directive.js
  155. +33 −0 components/sidebar/sidebar.controller.js
  156. +22 −0 components/sidebar/sidebar.directive.js
  157. +0 −110 components/sidebar/sidebar.js
  158. +44 −0 components/sidebar/sidebar.module.js
  159. +6 −0 components/sidebar/sidebar.service.js
  160. +0 −902 components/status_creator/status_creator.js
  161. +75 −0 components/styles/styler-color.directive.js
  162. +200 −0 components/styles/styler.component.js
  163. +0 −378 components/styles/styles.js
  164. +56 −0 components/styles/styles.module.js
  165. +55 −0 components/styles/styles.service.js
  166. +64 −0 components/toolbar/toolbar.component.js
  167. +0 −79 components/toolbar/toolbar.js
  168. +18 −0 components/toolbar/toolbar.module.js
  169. +93 −0 components/utils/layer-utils.service.js
  170. +0 −412 components/utils/utils.js
  171. +29 −0 components/utils/utils.module.js
  172. +295 −0 components/utils/utils.service.js
  173. +2 −2 materialComponents/panelContents/statusCreator.js
  174. +60 −60 po/cs_CZ.po
  175. +60 −60 po/fr_FR.po
  176. +58 −58 po/lv.po
  177. +60 −60 po/nl.po
  178. +79 −79 po/template.pot
@@ -80,7 +80,7 @@ var module = angular.module('hs', [
'hs.search', 'hs.print', 'hs.permalink', 'hs.measure',
'hs.legend', 'hs.geolocation', 'hs.core',
'hs.datasource_selector',
'hs.status_creator',
'hs.save-map',
'hs.api',
'hs.ows',
'gettext',
11 app.js
@@ -6,10 +6,10 @@ import query from 'query';
import search from 'search';
import measure from 'measure';
import permalink from 'permalink';
import info from 'info';
import ds from 'datasource_selector';
import sidebar from 'sidebar';
import addLayers from 'add-layers.module';
import 'components/info/info.module';
import 'components/datasource-selector/datasource_selector.module';
import 'components/sidebar/sidebar.module';
import 'components/add-layers/add-layers.module';

var module = angular.module('hs', [
'hs.sidebar',
@@ -20,7 +20,7 @@ var module = angular.module('hs', [
'hs.search', 'hs.print', 'hs.permalink', 'hs.measure',
'hs.legend', 'hs.geolocation', 'hs.core',
'hs.datasource_selector',
'hs.status_creator',
'hs.save-map',
'hs.api',
'hs.addLayersModule',
'gettext',
@@ -73,7 +73,6 @@ window.ol = {

module.controller('Main', ['$scope', 'Core', 'hs.addLayersWms.service_layer_producer', 'hs.compositions.service_parser', 'config',
function ($scope, Core, srv_producer, composition_parser, config) {
$scope.hsl_path = config.hsl_path; //Get this from hslayers.js file
$scope.Core = Core;
Core.sidebarRight = false;
Core.singleDatasources = true;
@@ -26,7 +26,7 @@ var module = angular.module('hs', [
'hs.search', 'hs.print', 'hs.permalink', 'hs.measure',
'hs.legend', 'hs.geolocation', 'hs.core',
'hs.datasource_selector',
'hs.status_creator',
'hs.save-map',
'hs.api',
'hs.addLayers',
'gettext',
@@ -22,7 +22,7 @@ var module = angular.module('hs', [
'hs.search', 'hs.print', 'hs.permalink', 'hs.measure',
'hs.legend', 'hs.geolocation', 'hs.core',
'hs.datasource_selector',
'hs.status_creator',
'hs.save-map',
'hs.api',
'hs.addLayers',
'gettext',
@@ -1,5 +1,5 @@
import { WMSCapabilities } from 'ol/format';
import 'utils';
import 'components/utils/utils.module';
import { Tile } from 'ol/layer';
import { TileWMS } from 'ol/source';
import { Attribution } from 'ol/control.js';
@@ -1,5 +1,5 @@
import WMTSCapabilities from 'ol/format/WMTSCapabilities';
import 'utils';
import 'components/utils/utils.module';
import { Tile } from 'ol/layer';
import { WMTS } from 'ol/source';
import { Attribution } from 'ol/control.js';
@@ -25,11 +25,11 @@ exports.paths = [
__dirname + '/components/compositions',
__dirname + '/components/core',
__dirname + '/components/customhtml',
__dirname + '/components/datasource_selector',
__dirname + '/components/datasource-selector',
__dirname + '/components/drag',
__dirname + '/components/draw',
__dirname + '/components/feature_crossfilter',
__dirname + '/components/feature_filter',
__dirname + '/components/feature-filter',
__dirname + '/components/floating_action_button',
__dirname + '/components/format',
__dirname + '/components/geolocation',
@@ -53,7 +53,7 @@ exports.paths = [
__dirname + '/components/rtserver',
__dirname + '/components/search',
__dirname + '/components/sidebar',
__dirname + '/components/status_creator',
__dirname + '/components/save-map',
__dirname + '/components/styles',
__dirname + '/components/tracking',
__dirname + '/components/translations/js',
@@ -2,7 +2,7 @@ import { DragAndDrop } from 'ol/interaction';
import { GPX, IGC,KML, TopoJSON, GeoJSON } from 'ol/format';
import SparqlJson from 'hs.source.SparqlJson'
import WfsSource from 'hs.source.Wfs'
import 'styles';
import 'components/styles/styles.module';
import * as loadingstrategy from 'ol/loadingstrategy';
import {transform, transformExtent, get as getProj} from 'ol/proj';
import { Vector } from 'ol/source';
@@ -30,7 +30,7 @@ angular.module('hs.addLayersVector', ['hs.styles'])
* @name hs.addLayersVector.service
* @description Service handling adding nonwms OWS services or files. Handles also drag and drop addition.
*/
.service('hs.addLayersVector.service', ['config', '$rootScope', 'hs.map.service', 'hs.styles.service', 'hs.utils.service', '$http', 'hs.status_creator.service',
.service('hs.addLayersVector.service', ['config', '$rootScope', 'hs.map.service', 'hs.styles.service', 'hs.utils.service', '$http', 'hs.save-map.service',
function (config, $rootScope, OlMap, styles, utils, $http, statusCreator) {
var me = this;

@@ -0,0 +1,162 @@
import 'components/utils/utils.module';
import moment from 'moment';
global.moment = moment;
import '../../common/get-capabilities.module';
import VectorLayer from 'ol/layer/Vector';
import WfsSource from 'hs.source.Wfs';
import WFSCapabilities from 'hs.format.WFSCapabilities';
import { WFS } from 'ol/format';
import { getPreferedFormat } from '../../common/format-utils';
import { addAnchors } from '../../common/attribution-utils';

export default {
template: ['config', function (config) {
return {
template: require('components/add-layers/partials/add-wfs-layer.directive.html')
};
}],
controller: ['$scope', 'hs.map.service', 'hs.wfs.getCapabilitiesService', 'Core', '$compile', '$rootScope',
function ($scope, OlMap, srv_caps, Core, $compile, $rootScope) {
$scope.map_projection = OlMap.map.getView().getProjection().getCode().toUpperCase();
$scope.$on('ows_wfs.capabilities_received', function (event, response) {
try {
caps = new WFSCapabilities(response.data);
$scope.title = caps.ServiceIdentification.Title;
$scope.description = addAnchors(caps.ServiceIdentification.Abstract);
$scope.version = caps.Version || caps.version;
$scope.output_formats = caps.FeatureTypeList.FeatureType[0].OutputFormats;
$scope.srss = [caps.FeatureTypeList.FeatureType[0].DefaultCRS];
angular.forEach(caps.FeatureTypeList.FeatureType[0].OtherCRS, function (srs) {
$scope.srss.push(srs);
})

if ($scope.srss.indexOf('CRS:84') > -1) $scope.srss.splice($scope.srss.indexOf('CRS:84'), 1);

if (srv_caps.currentProjectionSupported($scope.srss))
$scope.srs = $scope.srss.indexOf(OlMap.map.getView().getProjection().getCode()) > -1 ? OlMap.map.getView().getProjection().getCode() : OlMap.map.getView().getProjection().getCode().toLowerCase();
else if ($scope.srss.indexOf('EPSG::4326') > -1) {
$scope.srs = 'EPSG:4326';
} else
$scope.srs = $scope.srss[0];
$scope.services = caps.FeatureTypeList.FeatureType;
console.log($scope.services);
angular.forEach(caps.OperationsMetadata.Operation, function (operation) {
switch (operation.name) {
case "DescribeFeatureType":
$scope.describeFeatureType = operation.DCP[0].HTTP.Get;
break;
case "GetFeature":
$scope.getFeature = operation.DCP[0].HTTP.Get;
break;
}
})

$scope.output_format = getPreferedFormat($scope.output_formats, ["text/xml; subtype=gml/3.2.1"]);


} catch (e) {
if (console) console.log(e);
$scope.error = e.toString();
var previousDialog = document.getElementById("ows-wfs-capabilities-error");
if (previousDialog)
previousDialog.parentNode.removeChild(previousDialog);
var el = angular.element('<div hs.add-layers-wfs.capabilities-error-directive></span>');
$compile(el)($scope);
document.getElementById("hs-dialog-area").appendChild(el[0]);
//throw "WMS Capabilities parsing problem";
}
});

/**
* @function selectAllLayers
* @memberOf hs.addLayersWfs
* @description Select all layers from service.
*/
$scope.selectAllLayers = function () {
var recurse = function (layer) {
layer.checked = true;

angular.forEach(layer.Layer, function (sublayer) {
recurse(sublayer)
})
}
angular.forEach($scope.services.Layer, function (layer) {
recurse(layer)
});
}

/**
* @function tryAddLayers
* @memberOf hs.addLayersWfs
* @description Callback for "Add layers" button. Checks if current map projection is supported by wms service and warns user about resampling if not. Otherwise proceeds to add layers to the map.
* @param {boolean} checked - Add all available layers or only checked ones. Checked=false=all
*/
$scope.tryAddLayers = function (checked) {
$scope.add_all = checked;
$scope.addLayers(checked);
return;
};

/**
* @function addLayers
* @memberOf hs.addLayersWfs
* @description Seconds step in adding layers to the map, with resampling or without. Lops through the list of layers and calls addLayer.
* @param {boolean} checked - Add all available layers or olny checked ones. Checked=false=all
*/
$scope.addLayers = function (checked) {
var recurse = function (layer) {
if (!checked || layer.checked)
addLayer(
layer,
layer.Title.replace(/\//g, "&#47;"),
$scope.folder_name,
$scope.output_format,
$scope.srs
);

angular.forEach(layer.Layer, function (sublayer) {
recurse(sublayer)
})
}
angular.forEach($scope.services, function (layer) {
recurse(layer)
});
Core.setMainPanel('layermanager');
};

/**
* @function addLayer
* @memberOf hs.addLayersWfs
* @param {Object} layer capabilities layer object
* @param {String} layerName layer name in the map
* @param {String} folder name
* @param {String} outputFormat
* @param {OpenLayers.Projection} srs of the layer
* (PRIVATE) Add selected layer to map???
*/
var addLayer = function (layer, layerName, folder, outputFormat, srs) {
if (console) console.log(layer);

var url = srv_caps.service_url.split("?")[0];
var definition = {};
definition.url = url;
definition.format = 'hs.format.WFS';

var new_layer = new VectorLayer({
title: layerName,
definition: definition,
source: new WfsSource({
url: url,
typename: layer.Name,
projection: srs,
version: $scope.version,
format: new WFS(),
}),
})


OlMap.map.addLayer(new_layer);
}
}
]
}

0 comments on commit 33285a5

Please sign in to comment.
You can’t perform that action at this time.