Skip to content
Permalink
Browse files

Rename ows panels and components to addLayers

Split getcapabilities querying into seperate service.
Ows was too ambiguous name, so rename to addLayers.
Use component architecture instead of controller+directive.

refs #217
  • Loading branch information...
raitisbe committed Jul 1, 2019
1 parent d037866 commit 5ecd851e6e96afa30647a50485b866666be28fd0
Showing with 1,204 additions and 1,279 deletions.
  1. +2 −2 README.md
  2. +3 −3 app.js
  3. +137 −125 app.js.template
  4. +3 −3 app_material.js
  5. +11 −0 common/attribution-utils.js
  6. +21 −0 common/compile.directive.js
  7. +15 −0 common/format-utils.js
  8. +33 −0 common/get-capabilities.module.js
  9. +95 −0 common/wfs/get-capabilities.service.js
  10. +6 −5 components/ows/hs.ows.wms.service_capabilities.js → common/wms/get-capabilities.service.js
  11. +142 −0 common/wmts/get-capabilities.service.js
  12. +2 −1 common_paths.js
  13. +21 −12 components/{ows/ows_nonwms.js → add-layers/add-layers-vector.module.js}
  14. +187 −0 components/add-layers/add-layers-wfs.module.js
  15. +97 −0 components/add-layers/add-layers-wms.module.js
  16. +22 −31 components/{ows/hs.ows.wms.addLayerService.js → add-layers/add-layers-wms.service.js}
  17. +197 −0 components/add-layers/add-layers-wmts.module.js
  18. +181 −0 components/add-layers/add-layers.module.js
  19. +1 −1 components/{ows/partials/ows.html → add-layers/partials/add-layers.directive.html}
  20. 0 components/{ows/partials/owsmd.html → add-layers/partials/add-layers.md.directive.html}
  21. +1 −1 components/{ows/partials/owsnonwms.html → add-layers/partials/add-vector-layer.directive.html}
  22. 0 components/{ows/partials/owswfs.html → add-layers/partials/add-wfs-layer.directive.html}
  23. +1 −1 components/{ows/partials/owswms.html → add-layers/partials/add-wms-layer.directive.html}
  24. +1 −2 components/{ows/partials/owswmsmd.html → add-layers/partials/add-wms-layer.md.directive.html}
  25. 0 components/{ows/partials/owswmts.html → add-layers/partials/add-wmts-layer.directive.html}
  26. 0 components/{ows → add-layers}/partials/dialog_getcapabilities_error.html
  27. 0 components/{ows → add-layers}/partials/dialog_proxyconfirm.html
  28. +1 −2 components/compositions/compositions.js
  29. +3 −3 components/compositions/config_parsers.js
  30. +1 −1 components/compositions/hs.compositions.controller.js
  31. +0 −1 components/compositions/hs.compositions.service.js
  32. +2 −3 components/compositions/hs.compositions.service_parser.js
  33. +3 −3 components/datasource_selector/datasource_selector.js
  34. +3 −4 components/datasource_selector/partials/datasource_selector.html
  35. +3 −1 components/layermanager/hs.layermanager.WMSTservice.js
  36. +1 −1 components/layermanager/hs.layermanager.layerlistDirective.js
  37. +0 −1 components/layermanager/hs.layermanager.service.js
  38. +1 −2 components/layermanager/layermanager.js
  39. +2 −2 components/layout/layout.js
  40. +1 −1 components/layout/partials/bottom-sheet.html
  41. +1 −1 components/layout/partials/layout.html
  42. +0 −265 components/ows/ows.js
  43. +0 −307 components/ows/ows_wfs.js
  44. +0 −124 components/ows/ows_wms.js
  45. +0 −359 components/ows/ows_wmts.js
  46. +0 −8 components/ows/partials/owsprioritized.html
  47. +1 −1 components/sidebar/partials/sidebar.html
  48. +2 −2 materialComponents/panelContents/addLayer.js
@@ -130,8 +130,8 @@ module.value('config', {
})
});

module.controller('Main', ['$scope', 'Core', 'hs.ows.wms.service_layer_producer', 'hs.compositions.service_parser', 'config',
function ($scope, Core, srv_producer, composition_parser, config) {
module.controller('Main', ['$scope', 'Core', 'hs.compositions.service_parser', 'config',
function ($scope, Core, composition_parser, config) {
Core.sidebarRight = false;
}
]);
6 app.js
@@ -9,7 +9,7 @@ import permalink from 'permalink';
import info from 'info';
import ds from 'datasource_selector';
import sidebar from 'sidebar';
import ows from 'ows';
import addLayers from 'add-layers.module';

var module = angular.module('hs', [
'hs.sidebar',
@@ -22,7 +22,7 @@ var module = angular.module('hs', [
'hs.datasource_selector',
'hs.status_creator',
'hs.api',
'hs.ows',
'hs.addLayersModule',
'gettext',
'hs.compositions',
'hs.info'
@@ -71,7 +71,7 @@ window.ol = {
proj
};

module.controller('Main', ['$scope', 'Core', 'hs.ows.wms.service_layer_producer', 'hs.compositions.service_parser', 'config',
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;
@@ -1,133 +1,145 @@
'use strict';
import toolbar from 'toolbar';
import print from 'print';
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 add-layers.module';
import bootstrapBundle from 'bootstrap/dist/js/bootstrap.bundle';
import { ImageWMS, ImageArcGISRest } from 'ol/source';
import View from 'ol/View';
import { transform, transformExtent } from 'ol/proj';
import { Tile, Group, Image as ImageLayer } from 'ol/layer';
import { TileWMS, WMTS, OSM, XYZ } from 'ol/source';
import {Style, Icon, Stroke, Fill, Circle} from 'ol/style';

define(['angular', 'ol', 'toolbar', 'layermanager', 'sidebar', 'map', 'ows', 'query', 'search', 'print', 'permalink', 'measure', 'legend', 'bootstrap.bundle', 'geolocation', 'core', 'datasource_selector', 'api', 'angular-gettext', 'translations', 'compositions', 'status_creator', 'info'],
var module = angular.module('hs', [
'hs.sidebar',
'hs.toolbar',
'hs.layermanager',
'hs.map',
'hs.query',
'hs.search', 'hs.print', 'hs.permalink', 'hs.measure',
'hs.legend', 'hs.geolocation', 'hs.core',
'hs.datasource_selector',
'hs.status_creator',
'hs.api',
'hs.addLayers',
'gettext',
'hs.compositions',
'hs.info'
]);

function(angular, ol, toolbar, layermanager) {
var module = angular.module('hs', [
'hs.sidebar',
'hs.toolbar',
'hs.layermanager',
'hs.map',
'hs.query',
'hs.search', 'hs.print', 'hs.permalink', 'hs.measure',
'hs.legend', 'hs.geolocation', 'hs.core',
'hs.datasource_selector',
'hs.status_creator',
'hs.api',
'hs.ows',
'gettext',
'hs.compositions',
'hs.info'
]);
module.directive('hs', ['config', 'Core', function(config, Core) {
return {
template: require('hslayers.html'),
link: function(scope, element) {
Core.fullScreenMap(element);
}
};
}]);

module.directive('hs', ['config', 'Core', function(config, Core) {
return {
template: require('hslayers.html'),
link: function(scope, element) {
Core.fullScreenMap(element);
}
};
}]);

module.value('config', {
open_lm_after_comp_loaded: true,
layer_order: '-position',
box_layers: [
new ol.layer.Group({
'img': 'osm.png',
title: 'Base layer',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM(),
title: "OpenStreetMap",
base: true,
visible: true,
removable: false
})
],
}), new ol.layer.Group({
'img': 'armenia.png',
title: 'WMS layers',
layers: [
new ol.layer.Tile({
title: "Swiss",
source: new ol.source.TileWMS({
url: 'http://wms.geo.admin.ch/',
params: {
LAYERS: 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
INFO_FORMAT: undefined,
FORMAT: "image/png; mode=8bit"
},
crossOrigin: "anonymous"
}),
}),
new ol.layer.Tile({
title: "Ilida plastics kg/ha per year",
source: new ol.source.TileWMS({
url: 'http://gis.lesprojekt.cz/cgi-bin/mapserv?map=/home/dima/maps/ilida/ilida.map',
params: {
LAYERS: 'ilida_cultivation_plastics',
INFO_FORMAT: undefined,
FORMAT: "image/png",
ABSTRACT: "Plastic waste in Ilida municipality"
},
crossOrigin: "anonymous"
}),
path: 'Ilida Thematic Data',
visible: true,
opacity: 0.8
}),
new ol.layer.Tile({
title: "Výnosový potenciál",
source: new ol.source.TileWMS({
url: 'http://foodie-data.wirelessinfo.cz/geoserver-hsl/kojcice/wms?',
params: {
LAYERS: 'kojcice_vynospot_5m_poly',
//INFO_FORMAT: undefined,
INFO_FORMAT: 'text/html',
FORMAT: "image/png"
},
crossOrigin: "anonymous"
}),
path: 'Kojčice',
visible: true,
opacity: 0.5
})
]
module.value('config', {
open_lm_after_comp_loaded: true,
layer_order: '-position',
box_layers: [
new Group({
'img': 'osm.png',
title: 'Base layer',
layers: [
new Tile({
source: new OSM(),
title: "OpenStreetMap",
base: true,
visible: true,
removable: false
})
],
default_view: new ol.View({
center: ol.proj.transform([17.474129, 52.574000], 'EPSG:4326', 'EPSG:3857'), //Latitude longitude to Spherical Mercator
zoom: 4,
units: "m"
}),
hostname: {
"default": {
"title": "Default",
"type": "default",
"editable": false,
"url": 'http://www.whatstheplan.eu'
}
},
compositions_catalogue_url: '/p4b-dev/cat/catalogue/libs/cswclient/cswClientRun.php',
status_manager_url: '/wwwlibs/statusmanager2/index.php',
datasources: [{
title: "SuperCAT",
url: "http://cat.ccss.cz/csw/",
language: 'eng',
type: "micka",
code_list_url: 'http://www.whatstheplan.eu/php/metadata/util/codelists.php?_dc=1440156028103&language=eng&page=1&start=0&limit=25&filter=%5B%7B%22property%22%3A%22label%22%7D%5D'
}]
});
}), new Group({
'img': 'armenia.png',
title: 'WMS layers',
layers: [
new Tile({
title: "Swiss",
source: new TileWMS({
url: 'http://wms.geo.admin.ch/',
params: {
LAYERS: 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
INFO_FORMAT: undefined,
FORMAT: "image/png; mode=8bit"
},
crossOrigin: "anonymous"
}),
}),
new Tile({
title: "Ilida plastics kg/ha per year",
source: new TileWMS({
url: 'http://gis.lesprojekt.cz/cgi-bin/mapserv?map=/home/dima/maps/ilida/ilida.map',
params: {
LAYERS: 'ilida_cultivation_plastics',
INFO_FORMAT: undefined,
FORMAT: "image/png",
ABSTRACT: "Plastic waste in Ilida municipality"
},
crossOrigin: "anonymous"
}),
path: 'Ilida Thematic Data',
visible: true,
opacity: 0.8
}),
new Tile({
title: "Výnosový potenciál",
source: new TileWMS({
url: 'http://foodie-data.wirelessinfo.cz/geoserver-hsl/kojcice/wms?',
params: {
LAYERS: 'kojcice_vynospot_5m_poly',
//INFO_FORMAT: undefined,
INFO_FORMAT: 'text/html',
FORMAT: "image/png"
},
crossOrigin: "anonymous"
}),
path: 'Kojčice',
visible: true,
opacity: 0.5
})
]
})
],
default_view: new View({
center: transform([17.474129, 52.574000], 'EPSG:4326', 'EPSG:3857'), //Latitude longitude to Spherical Mercator
zoom: 4,
units: "m"
}),
hostname: {
"default": {
"title": "Default",
"type": "default",
"editable": false,
"url": 'http://www.whatstheplan.eu'
}
},
compositions_catalogue_url: '/p4b-dev/cat/catalogue/libs/cswclient/cswClientRun.php',
status_manager_url: '/wwwlibs/statusmanager2/index.php',
datasources: [{
title: "SuperCAT",
url: "http://cat.ccss.cz/csw/",
language: 'eng',
type: "micka",
code_list_url: 'http://www.whatstheplan.eu/php/metadata/util/codelists.php?_dc=1440156028103&language=eng&page=1&start=0&limit=25&filter=%5B%7B%22property%22%3A%22label%22%7D%5D'
}]
});

module.controller('Main', ['$scope', 'Core', 'hs.ows.wms.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;
}
]);
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;
}
]);

return module;
});
@@ -11,7 +11,7 @@ import permalink from 'permalink';
import info from 'info';
import ds from 'datasource_selector';
import sidebar from 'sidebar';
import ows from 'ows';
import addLayers from 'add-layers.module';

var module = angular.module('hs', [
'hs.sidebar',
@@ -24,7 +24,7 @@ var module = angular.module('hs', [
'hs.datasource_selector',
'hs.status_creator',
'hs.api',
'hs.ows',
'hs.addLayers',
'gettext',
'hs.compositions',
'hs.info'
@@ -41,7 +41,7 @@ module.directive('hs', ['config', 'Core', function (config, Core) {

if (window.hslayersNgConfig) module.value('config', Object.assign({}, window.hslayersNgConfig(ol)));

module.controller('Main', ['$scope', 'Core', 'hs.ows.wms.service_layer_producer', 'hs.compositions.service_parser', 'config',
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;
@@ -0,0 +1,11 @@
/**
* Replace Urls in text by anchor html tag with url, usefull for attribution to be clickable
* @function addAnchors
* @param {String} url String to look for Urls
* @returns {String} Text with added anchors
*/
export function addAnchors(url) {
if (!url) return null;
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
return url.replace(exp, "<a href='$1'>$1</a>");
}
@@ -0,0 +1,21 @@
export default ['$compile', function ($compile) {
return function (scope, element, attrs) {
scope.$watch(
function (scope) {
// watch the 'compile' expression for changes
return scope.$eval(attrs.compile);
},
function (value) {
// when the 'compile' expression changes
// assign it into the current DOM
element.html(value);

// compile the new DOM and link it to the current
// scope.
// NOTE: we only compile .childNodes so that
// we don't get into infinite loop compiling ourselves
$compile(element.contents())(scope);
}
);
};
}]
@@ -0,0 +1,15 @@
/**
* Loop through list of formats returned by getcapabilities and select first available from the list of available formats
* @function getPreferedFormat
* @param {Array} formats List of formats avaiable for service
* @param {String} preferedFormats List of prefered formats for output
* @returns {String} Either one of prefered formats or first first avaiable format
*/
export function getPreferedFormat (formats, preferedFormats) {
for (var i = 0; i < preferedFormats.length; i++) {
if (formats.indexOf(preferedFormats[i]) > -1) {
return (preferedFormats[i]);
}
}
return formats[0];
}

0 comments on commit 5ecd851

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