From 0aa1cf2c06fd0f72b342cf2cdbc645e44a71d4c2 Mon Sep 17 00:00:00 2001 From: PAPATHEODOROU Constantinos Date: Mon, 31 Aug 2020 16:52:13 +0300 Subject: [PATCH 01/33] [UNIONVMS-4725] - Fixed bug in printing of segments and the info popup --- .../app/service/spatial/mapFishModel.js | 2162 ++++++++--------- 1 file changed, 1081 insertions(+), 1081 deletions(-) diff --git a/unionvms-web/app/service/spatial/mapFishModel.js b/unionvms-web/app/service/spatial/mapFishModel.js index 1d80a4118..c6a578b0d 100644 --- a/unionvms-web/app/service/spatial/mapFishModel.js +++ b/unionvms-web/app/service/spatial/mapFishModel.js @@ -1,1081 +1,1081 @@ -/* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . -*/ -angular.module('unionvmsWeb').factory('MapFish',function() { - - var model = { - - isDeployed : false, - - jobStatusData : { - done : true, - status : undefined, - elapsedTime: undefined, - waitingTime: undefined, - downloadURL: undefined - }, - - templateData : undefined, - capabilitiesData : undefined, - - templates: [], - selected_template : undefined, - - formats : [], - selected_format : undefined, - - layouts : [], - selected_layout : undefined, - - suggestedDpi : [], - selected_dpi : undefined, - - layoutAttributes : [], - - printJobData : { - ref: undefined, - statusURL: undefined, - downloadURL: undefined - }, - - includeCoordGrid: true, - projectionId: undefined, - includeLongCopyright: false, - - printMapSize: [], - - reset: function(){ - model.templates = []; - model.layouts = []; - model.formats = []; - model.layoutAttributes = []; - model.suggestedDpi = []; - model.selected_format = undefined; - model.selected_layout = undefined; - model.selected_dpi = undefined; - model.printMapSize = []; - }, - - resetOnLayoutChange: function(){ - model.layoutAttributes = []; - model.suggestedDpi = []; - model.selected_dpi = undefined; - model.printMapSize = []; - }, - - initTemplateCmbx : function(templates){ - model.templateData = templates; - for (var i = 0; i < templates.length; i++) { - model.templates.push({"text": model.templateData[i], "code": model.templateData[i]}); - } - model.selected_template = model.templates[0].code; - }, - - initLayoutCmbx : function(capabilities){ - model.capabilitiesData = capabilities; - for (var l = 0; l < model.capabilitiesData.layouts.length; l++) { - var layout = model.capabilitiesData.layouts[l]; - model.layouts.push({"text": layout.name, "code": layout.name }); - } - model.selected_layout = model.layouts[0].code; - }, - - initFormatsCmbx : function(capabilities){ - model.capabilitiesData = capabilities; - for (var f = 0; f < model.capabilitiesData.formats.length; f++) { - if (model.capabilitiesData.formats[f] !== 'bmp'){ - model.formats.push({"text": model.capabilitiesData.formats[f], "code": model.capabilitiesData.formats[f]}); - } - } - model.selected_format = model.formats[0].code; - }, - - initLayoutAttributes : function(capabilities, _layout){ - model.layoutAttributes = []; - capabilities.layouts.filter( - function(layout){ - if (layout.name === _layout){ - layout.attributes.filter(function(attribute){ - if (attribute.type === 'String' && ((attribute.default !== undefined && attribute.default.length < 1) || attribute.default === undefined)){ - model.layoutAttributes.push(attribute); - } - else if (attribute.type === 'MapAttributeValues'){ - model.suggestedDpi = []; - for (var d = 0; d < attribute.clientInfo.dpiSuggestions.length; d++){ - var dpiValue = attribute.clientInfo.dpiSuggestions[d]; - model.suggestedDpi.push({"text": dpiValue, "code": dpiValue}); - model.selected_dpi = model.suggestedDpi[0].code; - } - model.printMapSize = [attribute.clientInfo.width, attribute.clientInfo.height]; - } - }); - } - } - ); - } - }; - - return model; - -}) -.factory('MapFishPayload',function(locale, $location, Color, MapFish, mapService, mapFishPrintRestService, unitConversionService, projectionService, coordinateFormatService){ - function mapFishPayload(){ - this.layout = undefined; - this.attributes = {}; - } - - mapFishPayload.prototype.createPayloadObj = function(data, iconLeg){ - this.layout = MapFish.selected_layout; - this.attributes = buildAttributes(data, iconLeg); - }; - - - mapFishPayload.prototype.getIconPayload = function(type){ - var forbidenKeys = ['lineStyle', 'default', 'lineWidth']; - var styles = mapService.styles[type]; - - if (angular.isDefined(styles)){ - var obj, i, keys; - var classes = []; - if (type === 'alarms'){ - obj = { - title: locale.getString('spatial.styles_attr_status') - }; - - keys = _.keys(styles); - for (i = 0; i < keys.length; i++){ - if (keys[i] !== 'size'){ - classes.push({ - text: locale.getString('spatial.legend_panel_alarms_' + keys[i]), - color: styles[keys[i]] - }); - } - } - } else { - obj = { - title: getSubtitle(styles) - }; - - if (type === 'segments'){ - switch (styles.style.lineStyle) { - case 'dotted': - obj.lineStyle = '1,1'; - break; - case 'dashed': - obj.lineStyle = '5,5'; - break; - case 'dotdashed': - obj.lineStyle = '5,2,1,2'; - break; - default: - obj.lineStyle = '0,0'; - break; - } - } else { - obj.cluster = { - text: locale.getString('spatial.print_cluster_legend_title'), - bgcolor: '#FFFFFF', - bordercolor: '#F7580D' - }; - } - - switch (styles.attribute) { - case 'countryCode': - for (i = 0; i < styles.displayedCodes.length; i++){ - classes.push({ - text: styles.displayedCodes[i], - color: styles.style[styles.displayedCodes[i]] - }); - } - break; - case 'activity': //Positions - case 'type': - case 'segmentCategory': //Segments - keys = _.keys(styles.style); - for (i = 0; i < keys.length; i++){ - if (_.indexOf(forbidenKeys, keys[i]) === -1){ - classes.push({ - text: keys[i], - color: styles.style[keys[i]] - }); - } - } - - //Finally add the default rule - classes.push({ - text: locale.getString('spatial.legend_panel_all_other_values'), - color: styles.style.default - }); - - break; - case 'reportedCourse': //Positions - case 'calculatedSpeed': - case 'reportedSpeed': - case 'speedOverGround': //Segments - case 'distance': - case 'courseOverGround': - for (i = 0; i < styles.breaks.intervals.length; i++){ - classes.push({ - text: styles.breaks.intervals[i][0] + ' - ' + styles.breaks.intervals[i][1], - color: styles.style[styles.breaks.intervals[i][0] + '-' + styles.breaks.intervals[i][1]] - }); - } - - //Finally add the default rule - classes.push({ - text: locale.getString('spatial.legend_panel_all_other_values'), - color: styles.style.default - }); - - break; - } - } - - obj.classes = classes; - return obj; - } - }; - - var getSubtitle = function(srcDef){ - var withSpeed = ['reportedSpeed', 'calculatedSpeed', 'speedOverGround']; - var withCourse = ['reportedCourse', 'courseOverGround']; - - var subTitle = locale.getString('spatial.styles_attr_' + srcDef.attribute); - if (_.indexOf(withSpeed, srcDef.attribute) !== -1){ - var srcUnit = unitConversionService.speed.getUnit(); - subTitle += ' (' + locale.getString('common.speed_unit_' + srcUnit) + ')'; - } - - if (_.indexOf(withCourse, srcDef.attribute) !== -1){ - subTitle += ' (' + String.fromCharCode(parseInt('00B0', 16)) + ')'; - } - - if (srcDef.attribute === 'distance'){ - subTitle += ' (' + unitConversionService.distance.getUnit() + ')'; - } - - return subTitle; - }; - - var buildAttributes = function(data, iconLeg){ - var attr = {}; - - //Setting attributes defined through the printing widget like title, description, etc - angular.forEach(data, function(value, key) { - attr[key] = value; - }, attr); - - var spatialAttr = buildMapAndLegendAttributes(iconLeg); - attr.map = spatialAttr.map; - attr.legend = spatialAttr.legend; - attr.datasource = []; - - attr.copyrightTitle = locale.getString('spatial.print_copyright_title').toUpperCase(); - attr.legendTitle = locale.getString('spatial.print_legend_title').toUpperCase(); - - if (spatialAttr.copyright.length > 0){ - attr.datasource.push({ - displayName: '', - table: { - columns: ['layer', 'copyright'], - data: spatialAttr.copyright - } - }); - } - - return attr; - }; - - var buildMapAndLegendAttributes = function(iconLeg){ - var map = {}; - var legend = { - name: '', - classes: [] - }; - - var layerSrc = mapService.getLayerByType('print').getSource(); - - map.projection = mapService.getMapProjectionCode(); - map.bbox = layerSrc.getExtent(); - map.dpi = MapFish.selected_dpi; - map.rotation = 0; - - var configs = getLayersAndLegendConfigsArray(iconLeg); - map.layers = configs.layers; - legend.classes = configs.legend; - - var finalObj = { - map: map, - legend: legend, - copyright: configs.copyright - }; - - return finalObj; - }; - - var getUrl = function(){ - var url = $location.protocol() + '://' + $location.host(); - if ($location.port() !== 80){ - url += ':' + $location.port(); - } - - return url; - }; - - var legendFuncs = { - buildWMS: function(layer){ - var src = layer.getSource(); - var params = src.getParams(); - var url = src.getUrls()[0] + '?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=25&HEIGHT=25&LAYER='; - url += params.LAYERS; - - if (angular.isDefined(params.STYLES) && params.STYLES !== ''){ - url += '&STYLE='; - url += params.STYLES; - } - - var name = layer.get('title'); - - return { - name: name.charAt(0).toUpperCase() + name.slice(1), - icons: [url] - }; - }, - buildVMSPOS: function(layer, iconLeg){ - return this.buildVectorLegend(layer, iconLeg, 'vmspos'); - }, - buildVMSSEG: function(layer, iconLeg){ - return this.buildVectorLegend(layer, iconLeg, 'vmsseg'); - }, - buildALARMS: function(layer, iconLeg){ - return this.buildVectorLegend(layer, iconLeg, 'alarms'); - }, - buildVectorLegend: function(layer, iconLeg, type){ - var url = getUrl(); - url += iconLeg.legend.base; - - switch (type) { - case 'vmspos': - url += iconLeg.legend.positions; - break; - case 'vmsseg': - url += iconLeg.legend.segments; - break; - case 'alarms': - url += iconLeg.legend.alarms; - break; - default: - break; - } - - var name = layer.get('title'); - - return { - name: name.charAt(0).toUpperCase() + name.slice(1), - icons: [url] - }; - } - }; - - var styleFuncs = { - buildVMSPOSCluster: function(features){ - var style = { - version: 2, - strokeColor: '#F7580D', - strokeWidth: 2, - fillColor: '#ffffff', - fillOpacity: 0.3, - fontWeight: 'BOLD', - fontColor: '#000000', - fontSize: 8, - fontFamily: 'Arial', - labelAlign: 'cm', - labelXOffset: -1, - labelYOffset: -1 - }; - - var name; - angular.forEach(features, function(feature) { - var radius = feature.get('radius'); - - name = "["; - name +="radius = " + feature.get('radius'); - name += "]"; - - style[name] = { - symbolizers: [{ - type: 'point', - pointRadius: radius - },{ - type: 'text', - label: '[printLabel]' - }] - }; - }); - - return style; - }, - buildVMSPOS: function(features, iconLeg){ - var styleDef = mapService.styles.positions; - - var style = { - version: 2, - graphicWidth: 18, - graphicOpacity : 1.0, - graphicFormat : 'image/png', - type: 'point' - }; - - this.buildVectorStyle(style, styleDef, 'vmspos', iconLeg); - - return style; - }, - buildALARMS: function(layer){ - var styleDef = mapService.styles.alarms; - - var style = { - version: 2, - strokeColor: '#FFFFFF', - strokeWidth: 2, - pointRadius: styleDef.size * 2, - type: 'point', - }; - - this.buildAlarmsStyle(style, styleDef, 'alarms'); - - return style; - }, - buildVMSSEG: function(layer){ - var styleDef = mapService.styles.segments; - - var style = { - version: 2, - strokeWidth: angular.isDefined(styleDef.style.lineWidth) ? parseInt(styleDef.style.lineWidth) : 2, - strokeDashstyle: 'solid', - strokeLinecap: 'round', - type: 'line' - }; - - var interval, dot; - if (angular.isDefined(styleDef.style.lineStyle)){ - switch (styleDef.style.lineStyle) { - case 'dotted': - dot = (style.strokeWidth + 1).toString(); - interval = style.strokeWidth.toString(); - style.strokeDashstyle = dot + ' ' + interval; - break; - case 'dashed': - style.strokeDashstyle = 'longdash'; - break; - case 'dotdashed': - var dash = (4 * style.strokeWidth).toString(); - dot = (style.strokeWidth + 1).toString(); - interval = (2 * style.strokeWidth).toString(); - style.strokeDashstyle = dash + ' ' + interval + ' ' + dot + ' ' + interval; - break; - default: - style.strokeDashstyle = 'solid'; - break; - } - } - - this.buildVectorStyle(style, styleDef, 'vmsseg'); - - - return style; - }, - buildAlarmsStyle: function(style, styleDef){ - var keys = _.keys(styleDef); - - for (var i = 0; i < keys.length; i++){ - if (keys[i] !== 'size'){ - var name = "[ticketStatus = '" + keys[i].toUpperCase() + "']"; - style[name] = { - symbolizers: [{ - fillColor: styleDef[keys[i]], - fillOpacity: 1.0, - }] - }; - } - } - - }, - buildVectorStyle: function(style, styleDef, type, iconLeg){ - var keys = _.keys(styleDef.style); - - var url; - if (type === 'vmspos'){ - url = getUrl(); - url += iconLeg.map.vmspos.base; - } - - var i, name, defaultName, color, tempName; - switch (styleDef.attribute) { - case 'activity': //Positions - case 'type': - case 'segmentCategory': //Segments - var forbidenKeys = ['lineStyle', 'default', 'lineWidth']; - for (i = 0; i < keys.length; i++){ - tempName = styleDef.attribute; - if (styleDef.attribute === 'activity'){ - tempName = 'activityType'; - } else if (styleDef.attribute === 'type'){ - tempName = 'movementType'; - } - - if (_.indexOf(forbidenKeys, keys[i]) === -1){ - name = "["; - name += tempName + " = '" + keys[i]; - name += "']"; - - if (type === 'vmsseg'){ - style[name] = { - symbolizers: [{ - strokeWidth: style.strokeWidth + 3, - strokeColor: '#ffffff' - },{ - strokeColor: styleDef.style[keys[i]] - }] - }; - } else { - color = styleDef.style[keys[i]].slice(1); - if (_.indexOf(iconLeg.map.vmspos.colors, color) !== -1){ - style[name] = { - symbolizers: [{ - rotation: '[reportedCourse]', - externalGraphic: url + color - }] - }; - } - } - - } - } - //Finally we build the defaults rule - defaultName = "["; - defaultName += tempName + " not in ('"; - defaultName += keys.join("','"); - defaultName += "')]"; - - if (type === 'vmsseg'){ - style[defaultName] = { - symbolizers: [{ - strokeWidth: style.strokeWidth + 3, - strokeColor: '#ffffff' - },{ - strokeColor: styleDef.style.default - }] - }; - } else { - color = styleDef.style.default.slice(1); - style[defaultName] = { - symbolizers: [{ - rotation: '[reportedCourse]', - externalGraphic: url + color - }] - }; - } - - break; - case 'countryCode': - for (i = 0; i < keys.length; i++){ - if (styleDef.displayedCodes.indexOf(keys[i]) !== -1){ - name = "["; - name += styleDef.attribute + " = '" + keys[i]; - name += "']"; - if (type === 'vmsseg'){ - style[name] = { - symbolizers: [{ - strokeWidth: style.strokeWidth + 3, - strokeColor: '#ffffff' - },{ - strokeColor: styleDef.style[keys[i]] - }] - }; - } else { - color = styleDef.style[keys[i]].slice(1); - if (_.indexOf(iconLeg.map.vmspos.colors, color) !== -1){ - style[name] = { - symbolizers: [{ - rotation: '[reportedCourse]', - externalGraphic: url + color - }] - }; - } - } - } - } - break; - case 'reportedCourse': //Positions - case 'calculatedSpeed': - case 'reportedSpeed': - case 'speedOverGround': //Segments - case 'distance': - case 'courseOverGround': - var min, max; - for (i = 0; i < styleDef.breaks.intervals.length; i++){ - name = "["; - name += styleDef.attribute + " >= " + styleDef.breaks.intervals[i][0]; - name += " and "; - name += styleDef.attribute + " < " + styleDef.breaks.intervals[i][1]; - name += "]"; - - if (type === 'vmsseg'){ - style[name] = { - symbolizers: [{ - strokeWidth: style.strokeWidth + 3, - strokeColor: '#ffffff' - },{ - strokeColor: styleDef.style[styleDef.breaks.intervals[i][0] + '-' + styleDef.breaks.intervals[i][1]] - }] - }; - } else { - color = styleDef.style[styleDef.breaks.intervals[i][0] + '-' + styleDef.breaks.intervals[i][1]].slice(1); - if (_.indexOf(iconLeg.map.vmspos.colors, color) !== -1){ - style[name] = { - symbolizers: [{ - rotation: '[reportedCourse]', - externalGraphic: url + color - }] - }; - } - } - - - if (i === 0){ - min = styleDef.breaks.intervals[i][0]; - max = styleDef.breaks.intervals[i][1]; - } else { - min = Math.min(min, styleDef.breaks.intervals[i][0]); - max = Math.max(max, styleDef.breaks.intervals[i][1]); - } - } - //Finally we build the defaults rule - defaultName = "["; - defaultName += styleDef.attribute + " < " + min; - defaultName += " or "; - defaultName += styleDef.attribute + " >= " + max; - defaultName += "]"; - - if (type === 'vmsseg'){ - style[defaultName] = { - symbolizers: [{ - strokeWidth: style.strokeWidth + 3, - strokeColor: '#ffffff' - },{ - strokeColor: styleDef.breaks.defaultColor - }] - }; - } else { - color = styleDef.style.default.slice(1); - style[defaultName] = { - symbolizers: [{ - rotation: '[reportedCourse]', - externalGraphic: url + color - }] - }; - } - break; - } - } - }; - - var rgbToHex = function(colorStr){ - var pattern = /\d+/g; - var rgb = colorStr.match(pattern); - - return '#' + ((1 << 24) | (parseInt(rgb[0], 10) << 16) | (parseInt(rgb[1], 10) << 8) | parseInt(rgb[2], 10)).toString(16).substr(1); - }; - - var layerFuncs = { - buildOSEA: function(layer){ - return this.buildOSM(layer); - }, - buildOSM: function(layer){ - var prop = layer.getProperties(); - - var url; - if (prop.type === 'OSM'){ - url = 'http://tile.openstreetmap.org'; - } else { - url = 'http://tiles.openseamap.org/seamark'; - } - - var obj = { - baseURL: url, - type: 'OSM', - resolutions: [156543.03390625, 78271.516953125, 39135.7584765625, 19567.87923828125, 9783.939619140625, 4891.9698095703125, 2445.9849047851562, 1222.9924523925781, 611.4962261962891, 305.74811309814453, 152.87405654907226, 76.43702827453613, 38.218514137268066, 19.109257068634033, 9.554628534317017, 4.777314267158508, 2.388657133579254, 1.194328566789627, 0.5971642833948135], - opacity: prop.opacity, - maxExtent: [-20037508.34, -20037508.34, 20037508.34, 20037508.34], - tileSize: [256, 256], - imageExtension: 'png' - }; - - return obj; - }, - buildWMS: function(layer){ - var prop = layer.getProperties(); - var src = layer.getSource(); - var params = src.getParams(); - - var obj = { - baseURL: src.getUrls()[0], - customParams: { - EXCEPTIONS: 'INIMAGE', - TRANSPARENT: true, - CQL_FILTER: angular.isDefined(params.cql_filter) && params.cql_filter !== null ? params.cql_filter : undefined - }, - layers: [params.LAYERS], - opacity: prop.opacity, - type: 'WMS' - }; - - var server = layer.get('serverType'); - if (angular.isDefined(server)){ - obj.serverType = server; - } - - if (angular.isDefined(params.STYLES) && params.STYLES !== ''){ - obj.styles = [params.STYLES]; - } - - if (angular.isDefined(params.FORMAT) && params.FORMAT !== ''){ - obj.imageFormat = params.FORMAT; - } else { - obj.imageFormat = 'image/png'; - } - - return obj; - }, - buildALARMS: function(layer){ - var obj = { - type: 'geojson', - style: styleFuncs.buildALARMS(layer), - geojson: getGeoJSON(layer) - }; - - return obj; - }, - buildVMSSEG: function(layer){ - var obj = { - type: 'geojson', - style: styleFuncs.buildVMSSEG(layer), - geojson: getGeoJSON(layer) - }; - - if (mapService.vmssegLabels.active){ - var dataFields = []; - var fields = mapService.labelVisibility.segments; - var mappings = mapService.getMappingTitlesProperties('vmsseg'); - var titles = mapService.getSegmentTitles(); - - if (fields.length > 0){ - angular.forEach(fields, function(item) { - var def = { - displayName: titles[item], - propName: mappings[item] - }; - - if (!_.isEqual(def, {})){ - dataFields.push(def); - } - }); - - var labelEl = $('.vector-label-vmsseg').first(); - obj.popupProperties = { - showAttrNames: mapService.labelVisibility.segmentsTitles, - dataFields: dataFields, - popupStyle: { - width: parseInt(labelEl.css('width')), - radius: parseInt(labelEl.css('border-radius')), - border: { - color: rgbToHex(labelEl.css('border-left-color')), - width: parseInt(labelEl.css('border-left-width')) - } - } - }; - } - } - - return obj; - }, - buildVMSPOS: function(layer, iconLeg){ - var format = new ol.format.GeoJSON(); - var printLayerSrc = mapService.getLayerByType('print').getSource(); - var src = layer.getSource(); - var srcStyle = layer.getStyle(); - - var features = src.getFeaturesInExtent(printLayerSrc.getExtent()); - var clusters = []; - var singleFeatures = []; - var tempSizes = {}; - angular.forEach(features, function(clusterFeat) { - var featuresInCluster = clusterFeat.get('features'); - - if (featuresInCluster.length > 1 && clusterFeat.get('featNumber') > 1){ - var clusterToPrint = new ol.Feature({ - geometry: clusterFeat.getGeometry() - }); - - var number = clusterFeat.get('featNumber'); - var radius = clusterFeat.get('radius'); - - if (!angular.isDefined(radius)){ - var featStyle = srcStyle(clusterFeat)[0]; - radius = featStyle.getImage().getRadius(); - } - - clusterToPrint.set('printLabel', clusterFeat.get('featNumber')); - clusterToPrint.set('radius', radius); - - clusters.push(clusterToPrint); - } else { - var feature; - if (featuresInCluster.length === 1){ - feature = featuresInCluster[0].clone(); - } else { - feature = clusterFeat.get('featureToDisplay').clone(); - } - - if (angular.isUndefined(feature.get('reportedCourse'))){ - feature.set('reportedCourse', 0); - } - - if (mapService.vmsposLabels.active){ - if (feature.get('overlayHidden') === false){ - var overCoords = mapService.vmsposLabels[feature.get('overlayId')].overlay.getPosition(); - feature.set('popupX', overCoords[0]); - feature.set('popupY', overCoords[1]); - - var srcCoords = feature.getGeometry().getCoordinates(); - var proj = mapService.getMapProjectionCode(); - if (proj !== 'EPSG:4326'){ - srcCoords = ol.proj.toLonLat(srcCoords, proj); - } - - feature.set('disp_lon', coordinateFormatService.formatAccordingToUserSettings(srcCoords[0])); - feature.set('disp_lat', coordinateFormatService.formatAccordingToUserSettings(srcCoords[1])); - feature.set('positionTime', unitConversionService.date.convertToUserFormat(feature.get('positionTime'))); - feature.set('reportedSpeed', unitConversionService.speed.formatSpeed(feature.get('reportedSpeed'), 5)); - feature.set('calculatedSpeed', unitConversionService.speed.formatSpeed(feature.get('calculatedSpeed'), 5)); - } - } - singleFeatures.push(feature); - } - }); - - var output = {}; - if (singleFeatures.length > 0){ - output.singleFeatures = { - type: 'geojson', - style: styleFuncs.buildVMSPOS(singleFeatures, iconLeg), - geojson: format.writeFeaturesObject(singleFeatures) - }; - - if (mapService.vmsposLabels.active){ - var dataFields = []; - var fields = mapService.labelVisibility.positions; - var mappings = mapService.getMappingTitlesProperties('vmspos'); - var titles = mapService.getPositionTitles(); - - if (fields.length > 0){ - angular.forEach(fields, function(item) { - var def = { - displayName: titles[item] - }; - - if (item === 'lon'){ - def.propName = 'disp_lon'; - } else if (item === 'lat'){ - def.propName = 'disp_lat'; - } else { - def.propName = mappings[item]; - } - - if (!_.isEqual(def, {})){ - dataFields.push(def); - } - }); - - var labelEl = $('.vector-label-vmspos').first(); - output.singleFeatures.popupProperties = { - showAttrNames: mapService.labelVisibility.positionsTitles, - dataFields: dataFields, - popupStyle: { - width: parseInt(labelEl.css('width')), - radius: parseInt(labelEl.css('border-radius')), - border: { - color: rgbToHex(labelEl.css('border-left-color')), - width: parseInt(labelEl.css('border-left-width')) - } - } - }; - } - } - } - - if (clusters.length > 0){ - output.clusters = { - type: 'geojson', - style: styleFuncs.buildVMSPOSCluster(clusters), - geojson: format.writeFeaturesObject(clusters) - }; - } - - return output; - }, - buildGrid: function(){ - var proj = projectionService.getProjectionEpsgById(MapFish.projectionId); - var obj = { - type: 'grid', - gridType: 'points', - numberOfLines: [5,5], - opacity: 1, - renderAsSvg: true, - labelProjection: angular.isDefined(proj) ? 'EPSG:' + proj : 'EPSG:4326', - labelFomat: '%1.2f%s', - font: { - name: ['Arial'], - size: 8, - style: 'BOLD' - }, - labelColor: "#000000", - gridColor: "#000000", - haloRadius: 3 - }; - - return obj; - } - }; - - var getGeoJSON = function(layer){ - var format = new ol.format.GeoJSON(); - var printLayerSrc = mapService.getLayerByType('print').getSource(); - var src = layer.getSource(); - - var features = angular.copy(src.getFeaturesInExtent(printLayerSrc.getExtent())); - if (layer.get('type') === 'vmsseg' && mapService.vmssegLabels.active){ - angular.forEach(features, function(feature) { - if (feature.get('overlayHidden') === false){ - feature.set('distance', unitConversionService.distance.formatDistance(feature.get('distance'), 5)); - feature.set('duration', unitConversionService.duration.timeToHuman(feature.get('duration'))); - feature.set('speedOverGround', unitConversionService.speed.formatSpeed(feature.get('speedOverGround'), 5)); - - var overCoords = mapService.vmssegLabels[feature.get('overlayId')].overlay.getPosition(); - feature.set('popupX', overCoords[0]); - feature.set('popupY', overCoords[1]); - } - }); - } - var geojson = format.writeFeaturesObject(features); - - return geojson; - }; - - var getAttribution = function(layer){ - var attribution = layer.getSource().getAttributions(); - - var attrArray = []; - if (attribution !== null && attribution.length > 0){ - var title = layer.get('title'); - attrArray.push(title.charAt(0).toUpperCase() + title.slice(1)); - - var text = ''; - for (var i = 0; i < attribution.length; i++){ - text += $('

').html(attribution[i].getHTML()).text(); - if (i < attribution.length - 1){ - text += ' | '; - } - } - if (MapFish.includeLongCopyright === true){ - if (text.length > 0){ - text += ' | '; - } - text += layer.get('longAttribution'); - } - attrArray.push(text); - } - - return attrArray; - }; - - var getLayersAndLegendConfigsArray = function(iconLeg){ - var layers = []; - var legClasses = []; - var copyright = []; - var mapLayers = mapService.map.getLayers(); - - mapLayers.forEach(function(lyr, idx, lyrs){ - var type = lyr.get('type'); - var supportedTypes = ['OSM', 'vmspos', 'vmsseg', 'alarms', 'WMS', 'OSEA']; - var supportedLegTypes = ['WMS', 'vmspos', 'vmsseg', 'alarms']; - if (angular.isDefined(type) && _.indexOf(supportedTypes, type) !== -1 && lyr.get('visible') === true){ - var fn = 'build' + type.toUpperCase(); - var layerObj; - if (type === 'vmspos'){ - layerObj = layerFuncs[fn](lyr, iconLeg); - } else { - layerObj = layerFuncs[fn](lyr); - } - - var legObj; - if (_.indexOf(supportedLegTypes, type) !== -1 && (type === 'vmspos' || type === 'vmsseg' || type === 'alarms')){ - legObj = legendFuncs[fn](lyr, iconLeg); - } else if (_.indexOf(supportedLegTypes, type) !== -1){ - legObj = legendFuncs[fn](lyr); - } - - if (angular.isDefined(layerObj)){ - if (type === 'vmspos'){ - if (angular.isDefined(layerObj.clusters) && layerObj.clusters.geojson.features.length > 0){ - layers.push(layerObj.clusters); - } - if (angular.isDefined(layerObj.singleFeatures) && layerObj.singleFeatures.geojson.features.length > 0){ - layers.push(layerObj.singleFeatures); - } - } else if(type === 'vmsseg'){ - if (layerObj.geojson.features.length > 0){ - layers.push(layerObj); - } - } else { - layers.push(layerObj); - } - } - - if (angular.isDefined(legObj)){ - legClasses.push(legObj); - } - - //copyright stuff - var copyArray = getAttribution(lyr); - if (angular.isDefined(copyArray) && copyArray.length > 0){ - copyright.push(copyArray); - } - } - }); - - if (MapFish.includeCoordGrid === true){ - layers.push(layerFuncs.buildGrid()); - } - layers.reverse(); - legClasses.reverse(); - copyright.reverse(); - - return { - layers: layers, - legend: legClasses, - copyright: copyright - }; - }; - - return mapFishPayload; -}); - +/* +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . +*/ +angular.module('unionvmsWeb').factory('MapFish',function() { + + var model = { + + isDeployed : false, + + jobStatusData : { + done : true, + status : undefined, + elapsedTime: undefined, + waitingTime: undefined, + downloadURL: undefined + }, + + templateData : undefined, + capabilitiesData : undefined, + + templates: [], + selected_template : undefined, + + formats : [], + selected_format : undefined, + + layouts : [], + selected_layout : undefined, + + suggestedDpi : [], + selected_dpi : undefined, + + layoutAttributes : [], + + printJobData : { + ref: undefined, + statusURL: undefined, + downloadURL: undefined + }, + + includeCoordGrid: true, + projectionId: undefined, + includeLongCopyright: false, + + printMapSize: [], + + reset: function(){ + model.templates = []; + model.layouts = []; + model.formats = []; + model.layoutAttributes = []; + model.suggestedDpi = []; + model.selected_format = undefined; + model.selected_layout = undefined; + model.selected_dpi = undefined; + model.printMapSize = []; + }, + + resetOnLayoutChange: function(){ + model.layoutAttributes = []; + model.suggestedDpi = []; + model.selected_dpi = undefined; + model.printMapSize = []; + }, + + initTemplateCmbx : function(templates){ + model.templateData = templates; + for (var i = 0; i < templates.length; i++) { + model.templates.push({"text": model.templateData[i], "code": model.templateData[i]}); + } + model.selected_template = model.templates[0].code; + }, + + initLayoutCmbx : function(capabilities){ + model.capabilitiesData = capabilities; + for (var l = 0; l < model.capabilitiesData.layouts.length; l++) { + var layout = model.capabilitiesData.layouts[l]; + model.layouts.push({"text": layout.name, "code": layout.name }); + } + model.selected_layout = model.layouts[0].code; + }, + + initFormatsCmbx : function(capabilities){ + model.capabilitiesData = capabilities; + for (var f = 0; f < model.capabilitiesData.formats.length; f++) { + if (model.capabilitiesData.formats[f] !== 'bmp'){ + model.formats.push({"text": model.capabilitiesData.formats[f], "code": model.capabilitiesData.formats[f]}); + } + } + model.selected_format = model.formats[0].code; + }, + + initLayoutAttributes : function(capabilities, _layout){ + model.layoutAttributes = []; + capabilities.layouts.filter( + function(layout){ + if (layout.name === _layout){ + layout.attributes.filter(function(attribute){ + if (attribute.type === 'String' && ((attribute.default !== undefined && attribute.default.length < 1) || attribute.default === undefined)){ + model.layoutAttributes.push(attribute); + } + else if (attribute.type === 'MapAttributeValues'){ + model.suggestedDpi = []; + for (var d = 0; d < attribute.clientInfo.dpiSuggestions.length; d++){ + var dpiValue = attribute.clientInfo.dpiSuggestions[d]; + model.suggestedDpi.push({"text": dpiValue, "code": dpiValue}); + model.selected_dpi = model.suggestedDpi[0].code; + } + model.printMapSize = [attribute.clientInfo.width, attribute.clientInfo.height]; + } + }); + } + } + ); + } + }; + + return model; + +}) +.factory('MapFishPayload',function(locale, $location, Color, MapFish, mapService, mapFishPrintRestService, unitConversionService, projectionService, coordinateFormatService){ + function mapFishPayload(){ + this.layout = undefined; + this.attributes = {}; + } + + mapFishPayload.prototype.createPayloadObj = function(data, iconLeg){ + this.layout = MapFish.selected_layout; + this.attributes = buildAttributes(data, iconLeg); + }; + + + mapFishPayload.prototype.getIconPayload = function(type){ + var forbidenKeys = ['lineStyle', 'default', 'lineWidth']; + var styles = mapService.styles[type]; + + if (angular.isDefined(styles)){ + var obj, i, keys; + var classes = []; + if (type === 'alarms'){ + obj = { + title: locale.getString('spatial.styles_attr_status') + }; + + keys = _.keys(styles); + for (i = 0; i < keys.length; i++){ + if (keys[i] !== 'size'){ + classes.push({ + text: locale.getString('spatial.legend_panel_alarms_' + keys[i]), + color: styles[keys[i]] + }); + } + } + } else { + obj = { + title: getSubtitle(styles) + }; + + if (type === 'segments'){ + switch (styles.style.lineStyle) { + case 'dotted': + obj.lineStyle = '1,1'; + break; + case 'dashed': + obj.lineStyle = '5,5'; + break; + case 'dotdashed': + obj.lineStyle = '5,2,1,2'; + break; + default: + obj.lineStyle = '0,0'; + break; + } + } else { + obj.cluster = { + text: locale.getString('spatial.print_cluster_legend_title'), + bgcolor: '#FFFFFF', + bordercolor: '#F7580D' + }; + } + + switch (styles.attribute) { + case 'countryCode': + for (i = 0; i < styles.displayedCodes.length; i++){ + classes.push({ + text: styles.displayedCodes[i], + color: styles.style[styles.displayedCodes[i]] + }); + } + break; + case 'activity': //Positions + case 'type': + case 'segmentCategory': //Segments + keys = _.keys(styles.style); + for (i = 0; i < keys.length; i++){ + if (_.indexOf(forbidenKeys, keys[i]) === -1){ + classes.push({ + text: keys[i], + color: styles.style[keys[i]] + }); + } + } + + //Finally add the default rule + classes.push({ + text: locale.getString('spatial.legend_panel_all_other_values'), + color: styles.style.default + }); + + break; + case 'reportedCourse': //Positions + case 'calculatedSpeed': + case 'reportedSpeed': + case 'speedOverGround': //Segments + case 'distance': + case 'courseOverGround': + for (i = 0; i < styles.breaks.intervals.length; i++){ + classes.push({ + text: styles.breaks.intervals[i][0] + ' - ' + styles.breaks.intervals[i][1], + color: styles.style[styles.breaks.intervals[i][0] + '-' + styles.breaks.intervals[i][1]] + }); + } + + //Finally add the default rule + classes.push({ + text: locale.getString('spatial.legend_panel_all_other_values'), + color: styles.style.default + }); + + break; + } + } + + obj.classes = classes; + return obj; + } + }; + + var getSubtitle = function(srcDef){ + var withSpeed = ['reportedSpeed', 'calculatedSpeed', 'speedOverGround']; + var withCourse = ['reportedCourse', 'courseOverGround']; + + var subTitle = locale.getString('spatial.styles_attr_' + srcDef.attribute); + if (_.indexOf(withSpeed, srcDef.attribute) !== -1){ + var srcUnit = unitConversionService.speed.getUnit(); + subTitle += ' (' + locale.getString('common.speed_unit_' + srcUnit) + ')'; + } + + if (_.indexOf(withCourse, srcDef.attribute) !== -1){ + subTitle += ' (' + String.fromCharCode(parseInt('00B0', 16)) + ')'; + } + + if (srcDef.attribute === 'distance'){ + subTitle += ' (' + unitConversionService.distance.getUnit() + ')'; + } + + return subTitle; + }; + + var buildAttributes = function(data, iconLeg){ + var attr = {}; + + //Setting attributes defined through the printing widget like title, description, etc + angular.forEach(data, function(value, key) { + attr[key] = value; + }, attr); + + var spatialAttr = buildMapAndLegendAttributes(iconLeg); + attr.map = spatialAttr.map; + attr.legend = spatialAttr.legend; + attr.datasource = []; + + attr.copyrightTitle = locale.getString('spatial.print_copyright_title').toUpperCase(); + attr.legendTitle = locale.getString('spatial.print_legend_title').toUpperCase(); + + if (spatialAttr.copyright.length > 0){ + attr.datasource.push({ + displayName: '', + table: { + columns: ['layer', 'copyright'], + data: spatialAttr.copyright + } + }); + } + + return attr; + }; + + var buildMapAndLegendAttributes = function(iconLeg){ + var map = {}; + var legend = { + name: '', + classes: [] + }; + + var layerSrc = mapService.getLayerByType('print').getSource(); + + map.projection = mapService.getMapProjectionCode(); + map.bbox = layerSrc.getExtent(); + map.dpi = MapFish.selected_dpi; + map.rotation = 0; + + var configs = getLayersAndLegendConfigsArray(iconLeg); + map.layers = configs.layers; + legend.classes = configs.legend; + + var finalObj = { + map: map, + legend: legend, + copyright: configs.copyright + }; + + return finalObj; + }; + + var getUrl = function(){ + var url = $location.protocol() + '://' + $location.host(); + if ($location.port() !== 80){ + url += ':' + $location.port(); + } + + return url; + }; + + var legendFuncs = { + buildWMS: function(layer){ + var src = layer.getSource(); + var params = src.getParams(); + var url = src.getUrls()[0] + '?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=25&HEIGHT=25&LAYER='; + url += params.LAYERS; + + if (angular.isDefined(params.STYLES) && params.STYLES !== ''){ + url += '&STYLE='; + url += params.STYLES; + } + + var name = layer.get('title'); + + return { + name: name.charAt(0).toUpperCase() + name.slice(1), + icons: [url] + }; + }, + buildVMSPOS: function(layer, iconLeg){ + return this.buildVectorLegend(layer, iconLeg, 'vmspos'); + }, + buildVMSSEG: function(layer, iconLeg){ + return this.buildVectorLegend(layer, iconLeg, 'vmsseg'); + }, + buildALARMS: function(layer, iconLeg){ + return this.buildVectorLegend(layer, iconLeg, 'alarms'); + }, + buildVectorLegend: function(layer, iconLeg, type){ + var url = getUrl(); + url += iconLeg.legend.base; + + switch (type) { + case 'vmspos': + url += iconLeg.legend.positions; + break; + case 'vmsseg': + url += iconLeg.legend.segments; + break; + case 'alarms': + url += iconLeg.legend.alarms; + break; + default: + break; + } + + var name = layer.get('title'); + + return { + name: name.charAt(0).toUpperCase() + name.slice(1), + icons: [url] + }; + } + }; + + var styleFuncs = { + buildVMSPOSCluster: function(features){ + var style = { + version: 2, + strokeColor: '#F7580D', + strokeWidth: 2, + fillColor: '#ffffff', + fillOpacity: 0.3, + fontWeight: 'BOLD', + fontColor: '#000000', + fontSize: 8, + fontFamily: 'Arial', + labelAlign: 'cm', + labelXOffset: -1, + labelYOffset: -1 + }; + + var name; + angular.forEach(features, function(feature) { + var radius = feature.get('radius'); + + name = "["; + name +="radius = " + feature.get('radius'); + name += "]"; + + style[name] = { + symbolizers: [{ + type: 'point', + pointRadius: radius + },{ + type: 'text', + label: '[printLabel]' + }] + }; + }); + + return style; + }, + buildVMSPOS: function(features, iconLeg){ + var styleDef = mapService.styles.positions; + + var style = { + version: 2, + graphicWidth: 18, + graphicOpacity : 1.0, + graphicFormat : 'image/png', + type: 'point' + }; + + this.buildVectorStyle(style, styleDef, 'vmspos', iconLeg); + + return style; + }, + buildALARMS: function(layer){ + var styleDef = mapService.styles.alarms; + + var style = { + version: 2, + strokeColor: '#FFFFFF', + strokeWidth: 2, + pointRadius: styleDef.size * 2, + type: 'point', + }; + + this.buildAlarmsStyle(style, styleDef, 'alarms'); + + return style; + }, + buildVMSSEG: function(layer){ + var styleDef = mapService.styles.segments; + + var style = { + version: 2, + strokeWidth: angular.isDefined(styleDef.style.lineWidth) ? parseInt(styleDef.style.lineWidth) : 2, + strokeDashstyle: 'solid', + strokeLinecap: 'round', + type: 'line' + }; + + var interval, dot; + if (angular.isDefined(styleDef.style.lineStyle)){ + switch (styleDef.style.lineStyle) { + case 'dotted': + dot = (style.strokeWidth + 1).toString(); + interval = style.strokeWidth.toString(); + style.strokeDashstyle = dot + ' ' + interval; + break; + case 'dashed': + style.strokeDashstyle = 'longdash'; + break; + case 'dotdashed': + var dash = (4 * style.strokeWidth).toString(); + dot = (style.strokeWidth + 1).toString(); + interval = (2 * style.strokeWidth).toString(); + style.strokeDashstyle = dash + ' ' + interval + ' ' + dot + ' ' + interval; + break; + default: + style.strokeDashstyle = 'solid'; + break; + } + } + + this.buildVectorStyle(style, styleDef, 'vmsseg'); + + + return style; + }, + buildAlarmsStyle: function(style, styleDef){ + var keys = _.keys(styleDef); + + for (var i = 0; i < keys.length; i++){ + if (keys[i] !== 'size'){ + var name = "[ticketStatus = '" + keys[i].toUpperCase() + "']"; + style[name] = { + symbolizers: [{ + fillColor: styleDef[keys[i]], + fillOpacity: 1.0, + }] + }; + } + } + + }, + buildVectorStyle: function(style, styleDef, type, iconLeg){ + var keys = _.keys(styleDef.style); + + var url; + if (type === 'vmspos'){ + url = getUrl(); + url += iconLeg.map.vmspos.base; + } + + var i, name, defaultName, color, tempName; + switch (styleDef.attribute) { + case 'activity': //Positions + case 'type': + case 'segmentCategory': //Segments + var forbidenKeys = ['lineStyle', 'default', 'lineWidth']; + for (i = 0; i < keys.length; i++){ + tempName = styleDef.attribute; + if (styleDef.attribute === 'activity'){ + tempName = 'activityType'; + } else if (styleDef.attribute === 'type'){ + tempName = 'movementType'; + } + + if (_.indexOf(forbidenKeys, keys[i]) === -1){ + name = "["; + name += tempName + " = '" + keys[i]; + name += "']"; + + if (type === 'vmsseg'){ + style[name] = { + symbolizers: [{ + strokeWidth: style.strokeWidth + 3, + strokeColor: '#ffffff' + },{ + strokeColor: styleDef.style[keys[i]] + }] + }; + } else { + color = styleDef.style[keys[i]].slice(1); + if (_.indexOf(iconLeg.map.vmspos.colors, color) !== -1){ + style[name] = { + symbolizers: [{ + rotation: '[reportedCourse]', + externalGraphic: url + color + }] + }; + } + } + + } + } + //Finally we build the defaults rule + defaultName = "["; + defaultName += tempName + " not in ('"; + defaultName += keys.join("','"); + defaultName += "')]"; + + if (type === 'vmsseg'){ + style[defaultName] = { + symbolizers: [{ + strokeWidth: style.strokeWidth + 3, + strokeColor: '#ffffff' + },{ + strokeColor: styleDef.style.default + }] + }; + } else { + color = styleDef.style.default.slice(1); + style[defaultName] = { + symbolizers: [{ + rotation: '[reportedCourse]', + externalGraphic: url + color + }] + }; + } + + break; + case 'countryCode': + for (i = 0; i < keys.length; i++){ + if (styleDef.displayedCodes.indexOf(keys[i]) !== -1){ + name = "["; + name += styleDef.attribute + " = '" + keys[i]; + name += "']"; + if (type === 'vmsseg'){ + style[name] = { + symbolizers: [{ + strokeWidth: style.strokeWidth + 3, + strokeColor: '#ffffff' + },{ + strokeColor: styleDef.style[keys[i]] + }] + }; + } else { + color = styleDef.style[keys[i]].slice(1); + if (_.indexOf(iconLeg.map.vmspos.colors, color) !== -1){ + style[name] = { + symbolizers: [{ + rotation: '[reportedCourse]', + externalGraphic: url + color + }] + }; + } + } + } + } + break; + case 'reportedCourse': //Positions + case 'calculatedSpeed': + case 'reportedSpeed': + case 'speedOverGround': //Segments + case 'distance': + case 'courseOverGround': + var min, max; + for (i = 0; i < styleDef.breaks.intervals.length; i++){ + name = "["; + name += styleDef.attribute + " >= " + styleDef.breaks.intervals[i][0]; + name += " and "; + name += styleDef.attribute + " < " + styleDef.breaks.intervals[i][1]; + name += "]"; + + if (type === 'vmsseg'){ + style[name] = { + symbolizers: [{ + strokeWidth: style.strokeWidth + 3, + strokeColor: '#ffffff' + },{ + strokeColor: styleDef.style[styleDef.breaks.intervals[i][0] + '-' + styleDef.breaks.intervals[i][1]] + }] + }; + } else { + color = styleDef.style[styleDef.breaks.intervals[i][0] + '-' + styleDef.breaks.intervals[i][1]].slice(1); + if (_.indexOf(iconLeg.map.vmspos.colors, color) !== -1){ + style[name] = { + symbolizers: [{ + rotation: '[reportedCourse]', + externalGraphic: url + color + }] + }; + } + } + + + if (i === 0){ + min = styleDef.breaks.intervals[i][0]; + max = styleDef.breaks.intervals[i][1]; + } else { + min = Math.min(min, styleDef.breaks.intervals[i][0]); + max = Math.max(max, styleDef.breaks.intervals[i][1]); + } + } + //Finally we build the defaults rule + defaultName = "["; + defaultName += styleDef.attribute + " < " + min; + defaultName += " or "; + defaultName += styleDef.attribute + " >= " + max; + defaultName += "]"; + + if (type === 'vmsseg'){ + style[defaultName] = { + symbolizers: [{ + strokeWidth: style.strokeWidth + 3, + strokeColor: '#ffffff' + },{ + strokeColor: styleDef.breaks.defaultColor + }] + }; + } else { + color = styleDef.style.default.slice(1); + style[defaultName] = { + symbolizers: [{ + rotation: '[reportedCourse]', + externalGraphic: url + color + }] + }; + } + break; + } + } + }; + + var rgbToHex = function(colorStr){ + var pattern = /\d+/g; + var rgb = colorStr.match(pattern); + + return '#' + ((1 << 24) | (parseInt(rgb[0], 10) << 16) | (parseInt(rgb[1], 10) << 8) | parseInt(rgb[2], 10)).toString(16).substr(1); + }; + + var layerFuncs = { + buildOSEA: function(layer){ + return this.buildOSM(layer); + }, + buildOSM: function(layer){ + var prop = layer.getProperties(); + + var url; + if (prop.type === 'OSM'){ + url = 'http://tile.openstreetmap.org'; + } else { + url = 'http://tiles.openseamap.org/seamark'; + } + + var obj = { + baseURL: url, + type: 'OSM', + resolutions: [156543.03390625, 78271.516953125, 39135.7584765625, 19567.87923828125, 9783.939619140625, 4891.9698095703125, 2445.9849047851562, 1222.9924523925781, 611.4962261962891, 305.74811309814453, 152.87405654907226, 76.43702827453613, 38.218514137268066, 19.109257068634033, 9.554628534317017, 4.777314267158508, 2.388657133579254, 1.194328566789627, 0.5971642833948135], + opacity: prop.opacity, + maxExtent: [-20037508.34, -20037508.34, 20037508.34, 20037508.34], + tileSize: [256, 256], + imageExtension: 'png' + }; + + return obj; + }, + buildWMS: function(layer){ + var prop = layer.getProperties(); + var src = layer.getSource(); + var params = src.getParams(); + + var obj = { + baseURL: src.getUrls()[0], + customParams: { + EXCEPTIONS: 'INIMAGE', + TRANSPARENT: true, + CQL_FILTER: angular.isDefined(params.cql_filter) && params.cql_filter !== null ? params.cql_filter : undefined + }, + layers: [params.LAYERS], + opacity: prop.opacity, + type: 'WMS' + }; + + var server = layer.get('serverType'); + if (angular.isDefined(server)){ + obj.serverType = server; + } + + if (angular.isDefined(params.STYLES) && params.STYLES !== ''){ + obj.styles = [params.STYLES]; + } + + if (angular.isDefined(params.FORMAT) && params.FORMAT !== ''){ + obj.imageFormat = params.FORMAT; + } else { + obj.imageFormat = 'image/png'; + } + + return obj; + }, + buildALARMS: function(layer){ + var obj = { + type: 'geojson', + style: styleFuncs.buildALARMS(layer), + geojson: getGeoJSON(layer) + }; + + return obj; + }, + buildVMSSEG: function(layer){ + var obj = { + type: 'geojson', + style: styleFuncs.buildVMSSEG(layer), + geojson: getGeoJSON(mapService.getLayerByType('vmsseg')) + }; + + if (mapService.vmssegLabels.active){ + var dataFields = []; + var fields = mapService.labelVisibility.segments; + var mappings = mapService.getMappingTitlesProperties('vmsseg'); + var titles = mapService.getSegmentTitles(); + + if (fields.length > 0){ + angular.forEach(fields, function(item) { + var def = { + displayName: titles[item], + propName: mappings[item] + }; + + if (!_.isEqual(def, {})){ + dataFields.push(def); + } + }); + + var labelEl = $('.vector-label-vmsseg').first(); + obj.popupProperties = { + showAttrNames: mapService.labelVisibility.segmentsTitles, + dataFields: dataFields, + popupStyle: { + width: parseInt(labelEl.css('width')), + radius: parseInt(labelEl.css('border-radius')), + border: { + color: rgbToHex(labelEl.css('border-left-color')), + width: parseInt(labelEl.css('border-left-width')) + } + } + }; + } + } + + return obj; + }, + buildVMSPOS: function(layer, iconLeg){ + var format = new ol.format.GeoJSON(); + var printLayerSrc = mapService.getLayerByType('print').getSource(); + var src = layer.getSource(); + var srcStyle = layer.getStyle(); + + var features = src.getFeaturesInExtent(printLayerSrc.getExtent()); + var clusters = []; + var singleFeatures = []; + var tempSizes = {}; + angular.forEach(features, function(clusterFeat) { + var featuresInCluster = clusterFeat.get('features'); + + if (featuresInCluster.length > 1 && clusterFeat.get('featNumber') > 1){ + var clusterToPrint = new ol.Feature({ + geometry: clusterFeat.getGeometry() + }); + + var number = clusterFeat.get('featNumber'); + var radius = clusterFeat.get('radius'); + + if (!angular.isDefined(radius)){ + var featStyle = srcStyle(clusterFeat)[0]; + radius = featStyle.getImage().getRadius(); + } + + clusterToPrint.set('printLabel', clusterFeat.get('featNumber')); + clusterToPrint.set('radius', radius); + + clusters.push(clusterToPrint); + } else { + var feature; + if (featuresInCluster.length === 1){ + feature = featuresInCluster[0].clone(); + } else { + feature = clusterFeat.get('featureToDisplay').clone(); + } + + if (angular.isUndefined(feature.get('reportedCourse'))){ + feature.set('reportedCourse', 0); + } + + if (mapService.vmsposLabels.active){ + if (feature.get('overlayHidden') === false){ + var overCoords = mapService.vmsposLabels[feature.get('overlayId')].overlay.getPosition(); + feature.set('popupX', overCoords[0]); + feature.set('popupY', overCoords[1]); + + var srcCoords = feature.getGeometry().getCoordinates(); + var proj = mapService.getMapProjectionCode(); + if (proj !== 'EPSG:4326'){ + srcCoords = ol.proj.toLonLat(srcCoords, proj); + } + + feature.set('disp_lon', coordinateFormatService.formatAccordingToUserSettings(srcCoords[0])); + feature.set('disp_lat', coordinateFormatService.formatAccordingToUserSettings(srcCoords[1])); + feature.set('positionTime', unitConversionService.date.convertToUserFormat(feature.get('positionTime'))); + feature.set('reportedSpeed', unitConversionService.speed.formatSpeed(feature.get('reportedSpeed'), 5)); + feature.set('calculatedSpeed', unitConversionService.speed.formatSpeed(feature.get('calculatedSpeed'), 5)); + } + } + singleFeatures.push(feature); + } + }); + + var output = {}; + if (singleFeatures.length > 0){ + output.singleFeatures = { + type: 'geojson', + style: styleFuncs.buildVMSPOS(singleFeatures, iconLeg), + geojson: format.writeFeaturesObject(singleFeatures) + }; + + if (mapService.vmsposLabels.active){ + var dataFields = []; + var fields = mapService.labelVisibility.positions; + var mappings = mapService.getMappingTitlesProperties('vmspos'); + var titles = mapService.getPositionTitles(); + + if (fields.length > 0){ + angular.forEach(fields, function(item) { + var def = { + displayName: titles[item] + }; + + if (item === 'lon'){ + def.propName = 'disp_lon'; + } else if (item === 'lat'){ + def.propName = 'disp_lat'; + } else { + def.propName = mappings[item]; + } + + if (!_.isEqual(def, {})){ + dataFields.push(def); + } + }); + + var labelEl = $('.vector-label-vmspos').first(); + output.singleFeatures.popupProperties = { + showAttrNames: mapService.labelVisibility.positionsTitles, + dataFields: dataFields, + popupStyle: { + width: parseInt(labelEl.css('width')), + radius: parseInt(labelEl.css('border-radius')), + border: { + color: rgbToHex(labelEl.css('border-left-color')), + width: parseInt(labelEl.css('border-left-width')) + } + } + }; + } + } + } + + if (clusters.length > 0){ + output.clusters = { + type: 'geojson', + style: styleFuncs.buildVMSPOSCluster(clusters), + geojson: format.writeFeaturesObject(clusters) + }; + } + + return output; + }, + buildGrid: function(){ + var proj = projectionService.getProjectionEpsgById(MapFish.projectionId); + var obj = { + type: 'grid', + gridType: 'points', + numberOfLines: [5,5], + opacity: 1, + renderAsSvg: true, + labelProjection: angular.isDefined(proj) ? 'EPSG:' + proj : 'EPSG:4326', + labelFomat: '%1.2f%s', + font: { + name: ['Arial'], + size: 8, + style: 'BOLD' + }, + labelColor: "#000000", + gridColor: "#000000", + haloRadius: 3 + }; + + return obj; + } + }; + + var getGeoJSON = function(layer){ + var format = new ol.format.GeoJSON(); + var printLayerSrc = mapService.getLayerByType('print').getSource(); + var src = layer.getSource(); + + var features = angular.copy(src.getSource().getFeaturesInExtent(printLayerSrc.getExtent())); + if (layer.get('type') === 'vmsseg' && mapService.vmssegLabels.active){ + angular.forEach(features, function(feature) { + if (feature.get('overlayHidden') === false){ + feature.set('distance', unitConversionService.distance.formatDistance(feature.get('distance'), 5)); + feature.set('duration', unitConversionService.duration.timeToHuman(feature.get('duration'))); + feature.set('speedOverGround', unitConversionService.speed.formatSpeed(feature.get('speedOverGround'), 5)); + + var overCoords = mapService.vmssegLabels[feature.get('overlayId')].overlay.getPosition(); + feature.set('popupX', overCoords[0]); + feature.set('popupY', overCoords[1]); + } + }); + } + var geojson = format.writeFeaturesObject(features); + + return geojson; + }; + + var getAttribution = function(layer){ + var attribution = layer.getSource().getAttributions(); + + var attrArray = []; + if (attribution !== null && attribution.length > 0){ + var title = layer.get('title'); + attrArray.push(title.charAt(0).toUpperCase() + title.slice(1)); + + var text = ''; + for (var i = 0; i < attribution.length; i++){ + text += $('

').html(attribution[i].getHTML()).text(); + if (i < attribution.length - 1){ + text += ' | '; + } + } + if (MapFish.includeLongCopyright === true){ + if (text.length > 0){ + text += ' | '; + } + text += layer.get('longAttribution'); + } + attrArray.push(text); + } + + return attrArray; + }; + + var getLayersAndLegendConfigsArray = function(iconLeg){ + var layers = []; + var legClasses = []; + var copyright = []; + var mapLayers = mapService.map.getLayers(); + + mapLayers.forEach(function(lyr, idx, lyrs){ + var type = lyr.get('type'); + var supportedTypes = ['OSM', 'vmspos', 'vmsseg', 'alarms', 'WMS', 'OSEA']; + var supportedLegTypes = ['WMS', 'vmspos', 'vmsseg', 'alarms']; + if (angular.isDefined(type) && _.indexOf(supportedTypes, type) !== -1 && lyr.get('visible') === true){ + var fn = 'build' + type.toUpperCase(); + var layerObj; + if (type === 'vmspos'){ + layerObj = layerFuncs[fn](lyr, iconLeg); + } else { + layerObj = layerFuncs[fn](lyr); + } + + var legObj; + if (_.indexOf(supportedLegTypes, type) !== -1 && (type === 'vmspos' || type === 'vmsseg' || type === 'alarms')){ + legObj = legendFuncs[fn](lyr, iconLeg); + } else if (_.indexOf(supportedLegTypes, type) !== -1){ + legObj = legendFuncs[fn](lyr); + } + + if (angular.isDefined(layerObj)){ + if (type === 'vmspos'){ + if (angular.isDefined(layerObj.clusters) && layerObj.clusters.geojson.features.length > 0){ + layers.push(layerObj.clusters); + } + if (angular.isDefined(layerObj.singleFeatures) && layerObj.singleFeatures.geojson.features.length > 0){ + layers.push(layerObj.singleFeatures); + } + } else if(type === 'vmsseg'){ + if (layerObj.geojson.features.length > 0){ + layers.push(layerObj); + } + } else { + layers.push(layerObj); + } + } + + if (angular.isDefined(legObj)){ + legClasses.push(legObj); + } + + //copyright stuff + var copyArray = getAttribution(lyr); + if (angular.isDefined(copyArray) && copyArray.length > 0){ + copyright.push(copyArray); + } + } + }); + + if (MapFish.includeCoordGrid === true){ + layers.push(layerFuncs.buildGrid()); + } + layers.reverse(); + legClasses.reverse(); + copyright.reverse(); + + return { + layers: layers, + legend: legClasses, + copyright: copyright + }; + }; + + return mapFishPayload; +}); + From 120d33d9c87fb821b7ded39bb62e145cf4624c5b Mon Sep 17 00:00:00 2001 From: nomikosi <42890529+nomikosi@users.noreply.github.com> Date: Fri, 11 Sep 2020 08:39:34 +0300 Subject: [PATCH 02/33] [UNIONVMS-4725] added activities to generated report --- .../visibilitySettings/visibilitySettings.js | 5 + .../liveViewPanel/mapPanel/mapPanel.js | 5 + .../app/service/reporting/reportService.js | 6 +- .../app/service/spatial/mapFishModel.js | 102 ++++++++++++++++-- .../app/service/spatial/mapService.js | 18 +++- 5 files changed, 127 insertions(+), 9 deletions(-) diff --git a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/visibilitySettings.js b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/visibilitySettings.js index d895d33f4..2d4771dd1 100644 --- a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/visibilitySettings.js +++ b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/visibilitySettings.js @@ -65,6 +65,11 @@ angular.module('unionvmsWeb').controller('VisibilitysettingsCtrl',function($scop popup: true, label: true }, + activity: { + table: true, + popup: true, + label: true + }, segments: { table: true, popup: true, diff --git a/unionvms-web/app/partial/spatial/liveViewPanel/mapPanel/mapPanel.js b/unionvms-web/app/partial/spatial/liveViewPanel/mapPanel/mapPanel.js index 8a1b85fcf..2f93bfce2 100644 --- a/unionvms-web/app/partial/spatial/liveViewPanel/mapPanel/mapPanel.js +++ b/unionvms-web/app/partial/spatial/liveViewPanel/mapPanel/mapPanel.js @@ -282,6 +282,7 @@ angular.module('unionvmsWeb').controller('MapCtrl',function($log, $scope, locale var payload = new MapFishPayload(); var positions = payload.getIconPayload('positions'); + var activities = payload.getIconPayload('activity'); var segments = payload.getIconPayload('segments'); var alarms = payload.getIconPayload('alarms'); @@ -292,6 +293,10 @@ angular.module('unionvmsWeb').controller('MapCtrl',function($log, $scope, locale iconPayload.positions = positions; } + if (angular.isDefined(activities) && angular.isDefined(mapService.getLayerByType('ers')) && mapService.getLayerByType('ers').get('visible')){ + iconPayload.activities = activities; + } + if (angular.isDefined(segments) && angular.isDefined(mapService.getLayerByType('vmsseg')) && mapService.getLayerByType('vmsseg').get('visible')){ iconPayload.segments = segments; } diff --git a/unionvms-web/app/service/reporting/reportService.js b/unionvms-web/app/service/reporting/reportService.js index ac9c7aad7..0a5c42d5b 100644 --- a/unionvms-web/app/service/reporting/reportService.js +++ b/unionvms-web/app/service/reporting/reportService.js @@ -482,6 +482,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp var getVmsDataError = function(error){ rep.loadReportHistory(); rep.positions = []; + rep.activities = []; rep.segments = []; rep.tracks = []; rep.isReportExecuting = false; @@ -500,6 +501,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp rep.positions = data.movements.features; rep.segments = data.segments.features; rep.tracks = data.tracks; + rep.activities = data.activities.features; //TODO activities //Remove existing vms vector layers from the map @@ -532,6 +534,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp rep.positions = []; rep.segments = []; rep.tracks = []; + rep.activities = []; //TODO activities mapService.resetLabelContainers(); @@ -621,6 +624,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp mapService.setPositionStylesObj(data.vectorStyles.positions); mapService.setSegmentStylesObj(data.vectorStyles.segments); mapService.setAlarmsStylesObj(data.vectorStyles.alarms); + // mapService.setActivityStylesObj(data.vectorStyles.activities); Uncomment when activity settings are added in spatial //Set vms table attribute visibility visibilityService.setVisibility(data.visibilitySettings); @@ -832,4 +836,4 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp }); return rep; -}); \ No newline at end of file +}); diff --git a/unionvms-web/app/service/spatial/mapFishModel.js b/unionvms-web/app/service/spatial/mapFishModel.js index c6a578b0d..d25807772 100644 --- a/unionvms-web/app/service/spatial/mapFishModel.js +++ b/unionvms-web/app/service/spatial/mapFishModel.js @@ -160,9 +160,15 @@ angular.module('unionvmsWeb').factory('MapFish',function() { } } } else { - obj = { - title: getSubtitle(styles) - }; + if(type === 'activity'){ + obj = { + title: '' + }; + } else { + obj = { + title: getSubtitle(styles) + }; + } if (type === 'segments'){ switch (styles.style.lineStyle) { @@ -179,6 +185,12 @@ angular.module('unionvmsWeb').factory('MapFish',function() { obj.lineStyle = '0,0'; break; } + } else if(type === 'activity'){ + obj.cluster = { + text: 'Fishing Activity', + bgcolor: '#FFFFFF', + bordercolor: '#078dbe' + }; } else { obj.cluster = { text: locale.getString('spatial.print_cluster_legend_title'), @@ -358,11 +370,17 @@ angular.module('unionvmsWeb').factory('MapFish',function() { buildALARMS: function(layer, iconLeg){ return this.buildVectorLegend(layer, iconLeg, 'alarms'); }, + buildERS: function(layer, iconLeg){ + return this.buildVectorLegend(layer, iconLeg, 'ers'); + }, buildVectorLegend: function(layer, iconLeg, type){ var url = getUrl(); url += iconLeg.legend.base; switch (type) { + case 'ers': + url += iconLeg.legend.activity; + break; case 'vmspos': url += iconLeg.legend.positions; break; @@ -438,6 +456,41 @@ angular.module('unionvmsWeb').factory('MapFish',function() { return style; }, + buildERS: function(features, iconLeg){ + + var style = { + version: 2, + strokeColor: '#ffffff', + strokeWidth: 2, + fillColor: '#078dbe', + fillOpacity: 0.3, + fontWeight: 'BOLD', + labelAlign: 'cm', + labelXOffset: -1, + labelYOffset: -1 + }; + + var name; + angular.forEach(features, function(feature) { + var radius = 7; + + name = "["; + name +="radius = " + radius; + name += "]"; + + style[name] = { + symbolizers: [{ + type: 'point', + pointRadius: radius + },{ + type: 'text', + label: '[printLabel]' + }] + }; + }); + + return style; + }, buildALARMS: function(layer){ var styleDef = mapService.styles.alarms; @@ -932,6 +985,43 @@ angular.module('unionvmsWeb').factory('MapFish',function() { return output; }, + buildERS: function(layer, iconLeg){ + + var printLayerSrc = mapService.getLayerByType('print').getSource(); + var src = layer.getSource(); + + var features = src.getFeaturesInExtent(printLayerSrc.getExtent()); + var clusters = []; + + angular.forEach(features, function(entry) { + var feature = entry.clone(); + entry.getGeometry().set('type','Point'); + var clusterToPrint = new ol.Feature({ + geometry: entry.getGeometry() + }); + clusterToPrint.set('radius', 7); + clusterToPrint.set('printLabel', ''); + clusters.push(clusterToPrint); + + if (mapService.ersLabels.active) { + if (feature.get('overlayHidden') === false) { + var overCoords = mapService.ersLabels[feature.get('overlayId')].overlay.getPosition(); + feature.set('popupX', overCoords[0]); + feature.set('popupY', overCoords[1]); + } + } + + }); + + + var format = new ol.format.GeoJSON(); + return { + type: 'geojson', + style: styleFuncs.buildERS(clusters, iconLeg), + geojson: format.writeFeaturesObject(clusters) + }; + + }, buildGrid: function(){ var proj = projectionService.getProjectionEpsgById(MapFish.projectionId); var obj = { @@ -1015,8 +1105,8 @@ angular.module('unionvmsWeb').factory('MapFish',function() { mapLayers.forEach(function(lyr, idx, lyrs){ var type = lyr.get('type'); - var supportedTypes = ['OSM', 'vmspos', 'vmsseg', 'alarms', 'WMS', 'OSEA']; - var supportedLegTypes = ['WMS', 'vmspos', 'vmsseg', 'alarms']; + var supportedTypes = ['OSM', 'vmspos', 'vmsseg', 'alarms', 'WMS', 'OSEA','ers']; + var supportedLegTypes = ['WMS', 'vmspos', 'vmsseg', 'alarms','ers']; if (angular.isDefined(type) && _.indexOf(supportedTypes, type) !== -1 && lyr.get('visible') === true){ var fn = 'build' + type.toUpperCase(); var layerObj; @@ -1027,7 +1117,7 @@ angular.module('unionvmsWeb').factory('MapFish',function() { } var legObj; - if (_.indexOf(supportedLegTypes, type) !== -1 && (type === 'vmspos' || type === 'vmsseg' || type === 'alarms')){ + if (_.indexOf(supportedLegTypes, type) !== -1 && (type === 'vmspos' || type === 'vmsseg' || type === 'alarms' || type === 'ers')){ legObj = legendFuncs[fn](lyr, iconLeg); } else if (_.indexOf(supportedLegTypes, type) !== -1){ legObj = legendFuncs[fn](lyr); diff --git a/unionvms-web/app/service/spatial/mapService.js b/unionvms-web/app/service/spatial/mapService.js index 7d898277c..bab0aaa90 100644 --- a/unionvms-web/app/service/spatial/mapService.js +++ b/unionvms-web/app/service/spatial/mapService.js @@ -973,7 +973,12 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.styles = { positions: undefined, segments: undefined, - alarms: undefined + alarms: undefined, + activity: { strokeColor: '#ffffff', + strokeWidth: 2, + fillColor: '#078dbe', + fillOpacity: 0.3, + } }; @@ -1673,6 +1678,15 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, return [style]; }; + + ms.setActivityStylesObj = function(styles){ + ms.styles.activities = { + strokeColor: '#ffffff', + strokeWidth: 2, + fillColor: '#078dbe', + fillOpacity: 0.3, + }; + }; /** * Set the style for the fishing activities layer @@ -1725,7 +1739,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, * @alias clearVectorLayers */ ms.clearVectorLayers = function(){ - var layers = [ms.getLayerByType('highlight'), ms.getLayerByType('vmspos'), ms.getLayerByType('vmsseg'), ms.getLayerByType('alarms')]; + var layers = [ms.getLayerByType('highlight'), ms.getLayerByType('vmspos'), ms.getLayerByType('vmsseg'), ms.getLayerByType('alarms'),ms.getLayerByType('ers')]; for (var i = 0; i < layers.length; i++){ if (angular.isDefined(layers[i])){ ms.map.removeLayer(layers[i]); From f7a7a356f80645edc271da1108ff7e87136614a6 Mon Sep 17 00:00:00 2001 From: nomikosi <42890529+nomikosi@users.noreply.github.com> Date: Mon, 21 Sep 2020 23:41:30 +0300 Subject: [PATCH 03/33] [UNIONVMS-4775] added printing for labels --- .../spatial/legendPanel/legendPanel.js | 618 +++++++++--------- .../app/service/reporting/reportService.js | 1 + .../app/service/spatial/mapFishModel.js | 99 ++- .../app/service/spatial/mapService.js | 22 + 4 files changed, 419 insertions(+), 321 deletions(-) diff --git a/unionvms-web/app/directive/spatial/legendPanel/legendPanel.js b/unionvms-web/app/directive/spatial/legendPanel/legendPanel.js index 3f1792b94..05eddcd84 100644 --- a/unionvms-web/app/directive/spatial/legendPanel/legendPanel.js +++ b/unionvms-web/app/directive/spatial/legendPanel/legendPanel.js @@ -1,130 +1,130 @@ /* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . -*/ -angular.module('unionvmsWeb').directive('imageOnLoad', function(){ - return { - restrict: 'A', - link: function(scope, element, attrs){ - element.bind('error', function(){ - scope.$emit('legendError', scope.$parent.$parent.record); - }); - }, - controller: function($scope){ - var record = $scope.$parent.$parent.record; - $scope.$parent.$on('legendError', function(evt, record){ - record.visibility = false; - }); - } - }; -}) -.directive('legendPanel', function(locale, mapService, unitConversionService, $localStorage, $compile, layerPanelService) { - return { - restrict: 'EA', - replace: true, - scope: false, - templateUrl: 'directive/spatial/legendPanel/legendPanel.html', - controller: function(){ - - //For WMS layers - this.buildRecWMS = function(layer){ - var isInternal = layer.get('isInternal'); - var record = { - isLabelOnly: false - }; - var src = layer.getSource(); - var params = src.getParams(); - - var url = src.getUrls()[0]; - if (url.substr(url.length - 1) !== '?'){ - url += '?'; - } - url += 'REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=25&HEIGHT=25&LAYER=' + params.LAYERS; - if (params.STYLES !== '' && angular.isDefined(params.STYLES)){ - if (params.STYLES.indexOf('label') !== -1 && params.STYLES.indexOf('geom') === -1){ - url = undefined; - record.isLabelOnly = true; - } else { - url += '&STYLE=' + params.STYLES; - } - } - - if (angular.isDefined(url)){ - url += '&SCALE=' + mapService.getCurrentScale(); - - if (isInternal){ - this.getLegendWithUsm(url, record); - record.isInternal = true; - } else { - record.src = url; - record.isInternal = false; - } - } - - record.title = layer.get('title'); - record.type = 'wms'; - record.visibility = layer.get('visible'); - - return record; - }; - - this.getLegendWithUsm = function(url, record){ - var xhr = new XMLHttpRequest(); - xhr.open('GET', url, true); - xhr.withCredentials = true; - xhr.setRequestHeader('Authorization', $localStorage.token); - xhr.responseType = 'arraybuffer'; - xhr.onload = function(){ - if (typeof window.btoa === 'function'){ - if (this.status === 200){ - var uInt8Array = new Uint8Array(this.response); - var i = uInt8Array.length; - var binaryString = new Array(i); - while (i--){ - binaryString[i] = String.fromCharCode(uInt8Array[i]); - } - var data = binaryString.join(''); - var type = xhr.getResponseHeader('content-type'); - if (type.indexOf('image') === 0) { - record.src = 'data:' + type + ';base64,' + window.btoa(data); - } - } - } - }; - xhr.send(); - }; - - //VMS positions - this.buildRecVmsPos = function(layer){ - var record = { - title: layer.get('title'), - subtitle: this.getSubtitle('positions'), - type: 'vmspos', - visibility: layer.get('visible'), - styles: this.getStyles('positions') - }; - - return record; - }; - - //VMS segments - this.buildRecVmsSeg = function(layer){ - var record = { - title: layer.get('title'), - subtitle: this.getSubtitle('segments'), - type: 'vmsseg', - visibility: layer.get('visible'), - styles: this.getStyles('segments') - }; - - return record; +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . +*/ +angular.module('unionvmsWeb').directive('imageOnLoad', function(){ + return { + restrict: 'A', + link: function(scope, element, attrs){ + element.bind('error', function(){ + scope.$emit('legendError', scope.$parent.$parent.record); + }); + }, + controller: function($scope){ + var record = $scope.$parent.$parent.record; + $scope.$parent.$on('legendError', function(evt, record){ + record.visibility = false; + }); + } + }; +}) +.directive('legendPanel', function(locale, mapService, unitConversionService, $localStorage, $compile, layerPanelService) { + return { + restrict: 'EA', + replace: true, + scope: false, + templateUrl: 'directive/spatial/legendPanel/legendPanel.html', + controller: function(){ + + //For WMS layers + this.buildRecWMS = function(layer){ + var isInternal = layer.get('isInternal'); + var record = { + isLabelOnly: false + }; + var src = layer.getSource(); + var params = src.getParams(); + + var url = src.getUrls()[0]; + if (url.substr(url.length - 1) !== '?'){ + url += '?'; + } + url += 'REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=25&HEIGHT=25&LAYER=' + params.LAYERS; + if (params.STYLES !== '' && angular.isDefined(params.STYLES)){ + if (params.STYLES.indexOf('label') !== -1 && params.STYLES.indexOf('geom') === -1){ + url = undefined; + record.isLabelOnly = true; + } else { + url += '&STYLE=' + params.STYLES; + } + } + + if (angular.isDefined(url)){ + url += '&SCALE=' + mapService.getCurrentScale(); + + if (isInternal){ + this.getLegendWithUsm(url, record); + record.isInternal = true; + } else { + record.src = url; + record.isInternal = false; + } + } + + record.title = layer.get('title'); + record.type = 'wms'; + record.visibility = layer.get('visible'); + + return record; + }; + + this.getLegendWithUsm = function(url, record){ + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.withCredentials = true; + xhr.setRequestHeader('Authorization', $localStorage.token); + xhr.responseType = 'arraybuffer'; + xhr.onload = function(){ + if (typeof window.btoa === 'function'){ + if (this.status === 200){ + var uInt8Array = new Uint8Array(this.response); + var i = uInt8Array.length; + var binaryString = new Array(i); + while (i--){ + binaryString[i] = String.fromCharCode(uInt8Array[i]); + } + var data = binaryString.join(''); + var type = xhr.getResponseHeader('content-type'); + if (type.indexOf('image') === 0) { + record.src = 'data:' + type + ';base64,' + window.btoa(data); + } + } + } + }; + xhr.send(); + }; + + //VMS positions + this.buildRecVmsPos = function(layer){ + var record = { + title: layer.get('title'), + subtitle: this.getSubtitle('positions'), + type: 'vmspos', + visibility: layer.get('visible'), + styles: this.getStyles('positions') + }; + + return record; + }; + + //VMS segments + this.buildRecVmsSeg = function(layer){ + var record = { + title: layer.get('title'), + subtitle: this.getSubtitle('segments'), + type: 'vmsseg', + visibility: layer.get('visible'), + styles: this.getStyles('segments') + }; + + return record; }; //Fishing activities @@ -138,59 +138,59 @@ angular.module('unionvmsWeb').directive('imageOnLoad', function(){ }; return record; - }; - - //Alarms - this.buildRecAlarms = function(layer){ - var record = { - title: layer.get('title'), - subtitle: locale.getString('spatial.styles_attr_status'), - type: 'alarms', - visibility: layer.get('visible'), - styles: this.getAlarmStyles() - }; - - return record; - }; - - this.getSubtitle = function(type){ - var srcDef = mapService.styles[type]; - var withSpeed = ['reportedSpeed', 'calculatedSpeed', 'speedOverGround']; - var withCourse = ['reportedCourse', 'courseOverGround']; - - var subTitle = locale.getString('spatial.styles_attr_' + srcDef.attribute); - if (_.indexOf(withSpeed, srcDef.attribute) !== -1){ - var srcUnit = unitConversionService.speed.getUnit(); - subTitle += ' (' + locale.getString('common.speed_unit_' + srcUnit) + ')'; - } - - if (_.indexOf(withCourse, srcDef.attribute) !== -1){ - subTitle += ' (' + String.fromCharCode(parseInt('00B0', 16)) + ')'; - } - - if (srcDef.attribute === 'distance'){ - subTitle += ' (' + unitConversionService.distance.getUnit() + ')'; - } - - return subTitle; - }; - - //Get styles for alarms - this.getAlarmStyles = function(){ - var srcDef = mapService.styles.alarms; - var keys = Object.keys(srcDef); - - var finalStyles = []; - for (var i = 0; i < keys.length; i++){ - if (keys[i] !== 'size'){ - finalStyles.push({ - title: locale.getString('spatial.legend_panel_alarms_' + keys[i]), - color: {"color": srcDef[keys[i]]} - }); - } - } - - return finalStyles; + }; + + //Alarms + this.buildRecAlarms = function(layer){ + var record = { + title: layer.get('title'), + subtitle: locale.getString('spatial.styles_attr_status'), + type: 'alarms', + visibility: layer.get('visible'), + styles: this.getAlarmStyles() + }; + + return record; + }; + + this.getSubtitle = function(type){ + var srcDef = mapService.styles[type]; + var withSpeed = ['reportedSpeed', 'calculatedSpeed', 'speedOverGround']; + var withCourse = ['reportedCourse', 'courseOverGround']; + + var subTitle = locale.getString('spatial.styles_attr_' + srcDef.attribute); + if (_.indexOf(withSpeed, srcDef.attribute) !== -1){ + var srcUnit = unitConversionService.speed.getUnit(); + subTitle += ' (' + locale.getString('common.speed_unit_' + srcUnit) + ')'; + } + + if (_.indexOf(withCourse, srcDef.attribute) !== -1){ + subTitle += ' (' + String.fromCharCode(parseInt('00B0', 16)) + ')'; + } + + if (srcDef.attribute === 'distance'){ + subTitle += ' (' + unitConversionService.distance.getUnit() + ')'; + } + + return subTitle; + }; + + //Get styles for alarms + this.getAlarmStyles = function(){ + var srcDef = mapService.styles.alarms; + var keys = Object.keys(srcDef); + + var finalStyles = []; + for (var i = 0; i < keys.length; i++){ + if (keys[i] !== 'size'){ + finalStyles.push({ + title: locale.getString('spatial.legend_panel_alarms_' + keys[i]), + color: {"color": srcDef[keys[i]]} + }); + } + } + + return finalStyles; }; //Get styles for fishing activities @@ -201,140 +201,140 @@ angular.module('unionvmsWeb').directive('imageOnLoad', function(){ color: {"color": '#078dbe'} }]; }; - - - //Get styles definition for both positions and segments as type - this.getStyles = function(type){ - var styleDef = mapService.styles[type]; - var keys = Object.keys(styleDef.style); - - var finalStyles = []; - var i; - switch (styleDef.attribute) { - case 'activity': //Positions - case 'type': - case 'segmentCategory': //Segments - var defaultObj = {}; - for (i = 0; i < keys.length; i++){ - if (_.indexOf(['lineWidth', 'lineStyle'], keys[i]) === -1){ - var styleObj = { - title: keys[i] === 'default' ? locale.getString('spatial.legend_panel_all_other_values') : keys[i].toUpperCase(), - color: {"color" : styleDef.style[keys[i]]} - }; - if (keys[i] === 'default'){ - angular.copy(styleObj, defaultObj); - } else { - finalStyles.push(styleObj); - } - } - } - //Add default color for all other values - if (_.keys(defaultObj).length !== 0){ - finalStyles.push(defaultObj); - } - break; - case 'countryCode': - for (i = 0; i < keys.length; i++){ - if (styleDef.displayedCodes.indexOf(keys[i]) !== -1){ - finalStyles.push({ - title: keys[i].toUpperCase(), - color: {"color" : styleDef.style[keys[i]]} - }); - } - } - break; - case 'reportedCourse': //Positions - case 'calculatedSpeed': - case 'reportedSpeed': - case 'speedOverGround': //Segments - case 'distance': - case 'courseOverGround': - for (i = 0; i < styleDef.breaks.intervals.length; i++){ - finalStyles.push({ - title: styleDef.breaks.intervals[i][0] + ' - ' + styleDef.breaks.intervals[i][1], - color: {"color" : styleDef.style[styleDef.breaks.intervals[i][0] + '-' + styleDef.breaks.intervals[i][1]]} - }); - } - //Finally, add default color for all other values - finalStyles.push({ - title: locale.getString('spatial.legend_panel_all_other_values'), - color: {"color" : styleDef.breaks.defaultColor} - }); - break; - default: - break; - } - - return finalStyles; - }; - - this.init = function(){ - if (!angular.isDefined(mapService.map)){ - return; - } - - var records = []; - var layers = mapService.map.getLayers(); - - layers.forEach(function(layer, idx){ + + + //Get styles definition for both positions and segments as type + this.getStyles = function(type){ + var styleDef = mapService.styles[type]; + var keys = Object.keys(styleDef.style); + + var finalStyles = []; + var i; + switch (styleDef.attribute) { + case 'activity': //Positions + case 'type': + case 'segmentCategory': //Segments + var defaultObj = {}; + for (i = 0; i < keys.length; i++){ + if (_.indexOf(['lineWidth', 'lineStyle'], keys[i]) === -1){ + var styleObj = { + title: keys[i] === 'default' ? locale.getString('spatial.legend_panel_all_other_values') : keys[i].toUpperCase(), + color: {"color" : styleDef.style[keys[i]]} + }; + if (keys[i] === 'default'){ + angular.copy(styleObj, defaultObj); + } else { + finalStyles.push(styleObj); + } + } + } + //Add default color for all other values + if (_.keys(defaultObj).length !== 0){ + finalStyles.push(defaultObj); + } + break; + case 'countryCode': + for (i = 0; i < keys.length; i++){ + if (styleDef.displayedCodes.indexOf(keys[i]) !== -1){ + finalStyles.push({ + title: keys[i].toUpperCase(), + color: {"color" : styleDef.style[keys[i]]} + }); + } + } + break; + case 'reportedCourse': //Positions + case 'calculatedSpeed': + case 'reportedSpeed': + case 'speedOverGround': //Segments + case 'distance': + case 'courseOverGround': + for (i = 0; i < styleDef.breaks.intervals.length; i++){ + finalStyles.push({ + title: styleDef.breaks.intervals[i][0] + ' - ' + styleDef.breaks.intervals[i][1], + color: {"color" : styleDef.style[styleDef.breaks.intervals[i][0] + '-' + styleDef.breaks.intervals[i][1]]} + }); + } + //Finally, add default color for all other values + finalStyles.push({ + title: locale.getString('spatial.legend_panel_all_other_values'), + color: {"color" : styleDef.breaks.defaultColor} + }); + break; + default: + break; + } + + return finalStyles; + }; + + this.init = function(){ + if (!angular.isDefined(mapService.map)){ + return; + } + + var records = []; + var layers = mapService.map.getLayers(); + + layers.forEach(function(layer, idx){ if (layer.get('visible')){ var lyrSrc = layer.getSource(); - - if (lyrSrc instanceof ol.source.TileWMS){ - records.push(this.buildRecWMS(layer)); - } - - if (lyrSrc instanceof ol.source.Vector || lyrSrc instanceof ol.source.ImageVector){ - switch (layer.get('type')){ - case 'vmspos': - if (lyrSrc.getSource().getFeatures().length !== 0){ - records.push(this.buildRecVmsPos(layer)); - } - break; - case 'vmsseg': - if (lyrSrc.getSource().getFeatures().length !== 0){ - records.push(this.buildRecVmsSeg(layer)); - } + + if (lyrSrc instanceof ol.source.TileWMS){ + records.push(this.buildRecWMS(layer)); + } + + if (lyrSrc instanceof ol.source.Vector || lyrSrc instanceof ol.source.ImageVector){ + switch (layer.get('type')){ + case 'vmspos': + if (lyrSrc.getSource().getFeatures().length !== 0){ + records.push(this.buildRecVmsPos(layer)); + } + break; + case 'vmsseg': + if (lyrSrc.getSource().getFeatures().length !== 0){ + records.push(this.buildRecVmsSeg(layer)); + } break; case 'ers': if (lyrSrc.getFeatures().length !== 0){ records.push(this.buildRecActivity(layer)); } - break; - case 'alarms': - if (lyrSrc.getFeatures().length !== 0){ - records.push(this.buildRecAlarms(layer)); - } - break; - default: - return; - } - } - } - }, this); - - if (records.length > 0){ - records.reverse(); - } - - return records; - }; - }, - link: function(scope, element, attrs, ctrl) { - if(!scope.initialized){ - scope.initialized = true; - scope.legendRecords = ctrl.init(); - - layerPanelService.panelToReload.push(function(){ - scope.legendRecords = ctrl.init(); - }); - /*scope.$on('reloadLegend', function(){ - scope.legendRecords = ctrl.init(); - });*/ - $compile(element)(scope); - } - - } - }; -}); - + break; + case 'alarms': + if (lyrSrc.getFeatures().length !== 0){ + records.push(this.buildRecAlarms(layer)); + } + break; + default: + return; + } + } + } + }, this); + + if (records.length > 0){ + records.reverse(); + } + + return records; + }; + }, + link: function(scope, element, attrs, ctrl) { + if(!scope.initialized){ + scope.initialized = true; + scope.legendRecords = ctrl.init(); + + layerPanelService.panelToReload.push(function(){ + scope.legendRecords = ctrl.init(); + }); + /*scope.$on('reloadLegend', function(){ + scope.legendRecords = ctrl.init(); + });*/ + $compile(element)(scope); + } + + } + }; +}); + diff --git a/unionvms-web/app/service/reporting/reportService.js b/unionvms-web/app/service/reporting/reportService.js index 0a5c42d5b..fea1e1afd 100644 --- a/unionvms-web/app/service/reporting/reportService.js +++ b/unionvms-web/app/service/reporting/reportService.js @@ -211,6 +211,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp if (mapService.vmssegLabels.active === true){ mapService.deactivateVectorLabels('vmsseg'); } + mapService.resetLabelContainers(); //Deactivate popups diff --git a/unionvms-web/app/service/spatial/mapFishModel.js b/unionvms-web/app/service/spatial/mapFishModel.js index d25807772..e098eb6ba 100644 --- a/unionvms-web/app/service/spatial/mapFishModel.js +++ b/unionvms-web/app/service/spatial/mapFishModel.js @@ -491,6 +491,14 @@ angular.module('unionvmsWeb').factory('MapFish',function() { return style; }, + buildERSPOS: function(features, iconLeg){ + + var style = { + + }; + + return style; + }, buildALARMS: function(layer){ var styleDef = mapService.styles.alarms; @@ -989,37 +997,104 @@ angular.module('unionvmsWeb').factory('MapFish',function() { var printLayerSrc = mapService.getLayerByType('print').getSource(); var src = layer.getSource(); - + var singleFeatures = []; var features = src.getFeaturesInExtent(printLayerSrc.getExtent()); var clusters = []; + var format = new ol.format.GeoJSON(); + angular.forEach(features, function(entry) { - var feature = entry.clone(); - entry.getGeometry().set('type','Point'); - var clusterToPrint = new ol.Feature({ - geometry: entry.getGeometry() - }); - clusterToPrint.set('radius', 7); - clusterToPrint.set('printLabel', ''); - clusters.push(clusterToPrint); if (mapService.ersLabels.active) { + var feature = entry.clone(); if (feature.get('overlayHidden') === false) { var overCoords = mapService.ersLabels[feature.get('overlayId')].overlay.getPosition(); feature.set('popupX', overCoords[0]); feature.set('popupY', overCoords[1]); + + var srcCoords = feature.getGeometry().getCoordinates(); + var proj = mapService.getMapProjectionCode(); + if (proj !== 'EPSG:4326'){ + srcCoords = ol.proj.toLonLat(srcCoords, proj); + } + + feature.set('disp_lon', coordinateFormatService.formatAccordingToUserSettings(srcCoords[0])); + feature.set('disp_lat', coordinateFormatService.formatAccordingToUserSettings(srcCoords[1])); + feature.set('positionTime', unitConversionService.date.convertToUserFormat(feature.get('positionTime'))); + feature.set('reportedSpeed', unitConversionService.speed.formatSpeed(feature.get('reportedSpeed'), 5)); + feature.set('calculatedSpeed', unitConversionService.speed.formatSpeed(feature.get('calculatedSpeed'), 5)); + } + singleFeatures.push(feature); + } else { + entry.getGeometry().set('type','Point'); + var clusterToPrint = new ol.Feature({ + geometry: entry.getGeometry() + }); + clusterToPrint.set('radius', 7); + clusterToPrint.set('printLabel', ''); + clusters.push(clusterToPrint); } - }); + var output = {}; + if (singleFeatures.length > 0) { + output.singleFeatures = { + type: 'geojson', + style: styleFuncs.buildERSPOS(singleFeatures, iconLeg), + geojson: format.writeFeaturesObject(singleFeatures) + }; - var format = new ol.format.GeoJSON(); - return { + var dataFields = []; + var fields = mapService.labelVisibility.activities; + var mappings = mapService.getMappingTitlesProperties('ers'); + var titles = mapService.getActivityTitles(); + + if (fields.length > 0) { + angular.forEach(fields, function (item) { + var def = { + displayName: titles[item] + }; + + if (item === 'lon') { + def.propName = 'disp_lon'; + } else if (item === 'lat') { + def.propName = 'disp_lat'; + } else { + def.propName = mappings[item]; + } + + if (!_.isEqual(def, {})) { + dataFields.push(def); + } + }); + + var labelEl = $('.vector-label-ers').first(); + output.singleFeatures.popupProperties = { + showAttrNames: mapService.labelVisibility.activitiesTitles, + dataFields: dataFields, + popupStyle: { + width: parseInt(labelEl.css('width')), + radius: parseInt(labelEl.css('border-radius')), + border: { + color: rgbToHex(labelEl.css('border-left-color')), + width: parseInt(labelEl.css('border-left-width')) + } + } + }; + return output.singleFeatures; + } + } + + if (clusters.length > 0){ + output = { type: 'geojson', style: styleFuncs.buildERS(clusters, iconLeg), geojson: format.writeFeaturesObject(clusters) }; + return output; + } + }, buildGrid: function(){ diff --git a/unionvms-web/app/service/spatial/mapService.js b/unionvms-web/app/service/spatial/mapService.js index bab0aaa90..19e88e6e8 100644 --- a/unionvms-web/app/service/spatial/mapService.js +++ b/unionvms-web/app/service/spatial/mapService.js @@ -3404,6 +3404,28 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, source: 'source' }; } + if (type === 'ers'){ + return { + name: 'name', + fs: 'flagState', + ext_mark: 'EXT_MARK', + ircs: 'IRCS', + cfr: 'CFR', + gfcm: 'GFCM', + date: 'acceptedDateTime', + iccat: 'ICCAT', + uvi: 'UVI', + source: 'dataSource', + activityType: 'activityType', + reportType: 'reportType', + purposeCode: 'purposeCode', + occurrence: 'acceptedDateTime', + areas: 'areas', + gears: 'gears', + species: 'species', + asset:'name' + }; + } if (type === 'vmsseg'){ return { From 0710f2344376d540ad6886c2f3f9d3979adfc44a Mon Sep 17 00:00:00 2001 From: gmanifavas Date: Mon, 3 Aug 2020 17:33:46 +0300 Subject: [PATCH 04/33] [UNIONVMS-4741] Choose vessel from Reports page and pan to its latest position. --- unionvms-web/app/app.less | 1 + unionvms-web/app/index.html | 1 + .../liveViewPanel/mapPanel/mapPanel.html | 599 +++++++++--------- .../vesselDropdown/vesselDropdown.html | 56 ++ .../vesselDropdown/vesselDropdown.js | 92 +++ .../vesselDropdown/vesselDropdown.less | 131 ++++ .../app/service/reporting/reportService.js | 5 + 7 files changed, 587 insertions(+), 298 deletions(-) create mode 100644 unionvms-web/app/partial/spatial/reportsPanel/reportForm/vesselDropdown/vesselDropdown.html create mode 100644 unionvms-web/app/partial/spatial/reportsPanel/reportForm/vesselDropdown/vesselDropdown.js create mode 100644 unionvms-web/app/partial/spatial/reportsPanel/reportForm/vesselDropdown/vesselDropdown.less diff --git a/unionvms-web/app/app.less b/unionvms-web/app/app.less index b1fa67487..bd3a56d20 100644 --- a/unionvms-web/app/app.less +++ b/unionvms-web/app/app.less @@ -116,6 +116,7 @@ copy of the GNU General Public License along with the IFDM Suite. If not, see + diff --git a/unionvms-web/app/partial/spatial/liveViewPanel/mapPanel/mapPanel.html b/unionvms-web/app/partial/spatial/liveViewPanel/mapPanel/mapPanel.html index 792776338..777e66cc3 100644 --- a/unionvms-web/app/partial/spatial/liveViewPanel/mapPanel/mapPanel.html +++ b/unionvms-web/app/partial/spatial/liveViewPanel/mapPanel/mapPanel.html @@ -1,298 +1,301 @@ - -

- -
-
-
- -
-
- {{'spatial.map_label_auto_refresh_status' | i18n }} - -
- - - - - -
-
- - - - - -
-
-
-
-
- - - -
-
-
-
- -
- -
-
- - -
-
- {{'spatial.map_tip_bookmarks' | i18n}} - - - -
-
- -
-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - -
{{'spatial.map_bookmarks_table_name_header' | i18n}}
{{'spatial.table_no_data' | i18n}}
{{bookmark.name}} - - -
-
-
-
-
-
- - -
-
-
-
-
- {{'spatial.more_details' | i18n}} -
- -
-
- -
-
-
- {{'spatial.map_measure_window_title' | i18n}} - - - -
-
-
-
- - -
-
- -
- -
{{'spatial.reports_form_vms_field_label_speed_unit_knots' | i18n }}
-
-
-
- - -
-
-
- - - -
-
-
- {{'spatial.map_print_window_title' | i18n}} - - - -
-
-
- - - - - -
-
-
-
- -
-
+ +
+ +
+
+
+ +
+
+ {{'spatial.map_label_auto_refresh_status' | i18n }} + +
+ + + + + +
+
+ + + + + +
+
+ +
+
+
+
+
+ + + +
+
+
+
+ +
+ +
+
+ + +
+
+ {{'spatial.map_tip_bookmarks' | i18n}} + + + +
+
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
{{'spatial.map_bookmarks_table_name_header' | i18n}}
{{'spatial.table_no_data' | i18n}}
{{bookmark.name}} + + +
+
+
+
+
+
+ + +
+
+
+
+
+ {{'spatial.more_details' | i18n}} +
+ +
+
+ +
+
+
+ {{'spatial.map_measure_window_title' | i18n}} + + + +
+
+
+
+ + +
+
+ +
+ +
{{'spatial.reports_form_vms_field_label_speed_unit_knots' | i18n }}
+
+
+
+ + +
+
+
+ + + +
+
+
+ {{'spatial.map_print_window_title' | i18n}} + + + +
+
+
+ + + + + +
+
+
+
+ +
+
diff --git a/unionvms-web/app/partial/spatial/reportsPanel/reportForm/vesselDropdown/vesselDropdown.html b/unionvms-web/app/partial/spatial/reportsPanel/reportForm/vesselDropdown/vesselDropdown.html new file mode 100644 index 000000000..a56d435bc --- /dev/null +++ b/unionvms-web/app/partial/spatial/reportsPanel/reportForm/vesselDropdown/vesselDropdown.html @@ -0,0 +1,56 @@ + +
+
+ {{display}} + Go to vessel + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
NameCFRIRCSExt. markingICCAT
{{item.name | dataNotAvailable}}{{item.cfr | dataNotAvailable}}{{item.ircs | dataNotAvailable}}{{item.externalMarking | dataNotAvailable}}{{item.iccat | dataNotAvailable}}
+
+
+
+{{place}} diff --git a/unionvms-web/app/partial/spatial/reportsPanel/reportForm/vesselDropdown/vesselDropdown.js b/unionvms-web/app/partial/spatial/reportsPanel/reportForm/vesselDropdown/vesselDropdown.js new file mode 100644 index 000000000..974bd5ba0 --- /dev/null +++ b/unionvms-web/app/partial/spatial/reportsPanel/reportForm/vesselDropdown/vesselDropdown.js @@ -0,0 +1,92 @@ +angular.module('unionvmsWeb').directive("vesselDropdown", function(mapService, reportService) { + return { + restrict: "E", + templateUrl: "partial/spatial/reportsPanel/reportForm/vesselDropdown/vesselDropdown.html", + scope: {}, + link: function(scope) { + scope.listVisible = false; + scope.selected = undefined; + + scope.select = function(item) { + scope.selected = item; + scope.listVisible = false; + scope.panTo(item.coordinates); + }; + + scope.panTo = function(coordinates) { + var coords = ol.proj.transform(coordinates, 'EPSG:4326', mapService.getMapProjectionCode()); + mapService.panTo(coords); + var geom = new ol.geom.Point(coords); + geom.set('GeometryType', 'Point'); + mapService.highlightFeature(geom); + }; + + scope.isSelected = function(item) { + if(scope.selected) { + return item === scope.selected; + } + }; + + scope.show = function() { + scope.listVisible = !scope.listVisible; + }; + + scope.$watch("selected", function(value) { + if(scope.selected){ + scope.display = scope.selected.name; + } + }); + + scope.clearSelection = function(event) { + event.stopPropagation(); + scope.selected = undefined; + scope.listVisible = false; + }; + + scope.vesselsFromMovements = []; + + scope.$watch(function() { return reportService.getPositions(); }, function(positions) { + if(!angular.equals([], positions)) { + positions.sort(function(a,b) { + return (a.properties.positionTime < b.properties.positionTime) ? 1 : ((b.properties.positionTime < a.properties.positionTime) ? -1 : 0) + }); + angular.forEach(positions, function (position) { + var existingVessel = includesVessel(position.properties); + if(existingVessel){ + if(existingVessel.positionTime < position.properties.positionTime) { + existingVessel.coordinates = position.geometry.coordinates; + existingVessel.positionTime = position.properties.positionTime; + } + } else { + scope.vesselsFromMovements.push({"coordinates" : position.geometry.coordinates, + "positionTime" : position.properties.positionTime, + "name" : position.properties.name, + "cfr" : position.properties.cfr, + "ircs" : position.properties.ircs, + "externalMarking" : position.properties.externalMarking, + "iccat" : position.properties.iccat}); + } + }); + if(scope.selected) { + scope.panTo(scope.selected.coordinates); + } + } + }, true); + + var includesVessel = function(vesselProperties) { + var vessel = undefined; + angular.forEach(scope.vesselsFromMovements, function (entry) { + if( entry.name === vesselProperties.name && + entry.cfr === vesselProperties.cfr && + entry.ircs === vesselProperties.ircs && + entry.externalMarking === vesselProperties.externalMarking && + entry.iccat === vesselProperties.iccat) { + + vessel = entry; + } + }); + return vessel; + }; + } + } +}); diff --git a/unionvms-web/app/partial/spatial/reportsPanel/reportForm/vesselDropdown/vesselDropdown.less b/unionvms-web/app/partial/spatial/reportsPanel/reportForm/vesselDropdown/vesselDropdown.less new file mode 100644 index 000000000..46c77f544 --- /dev/null +++ b/unionvms-web/app/partial/spatial/reportsPanel/reportForm/vesselDropdown/vesselDropdown.less @@ -0,0 +1,131 @@ +@height: 25px; +@spacing: 10px; +@placeholder-colour: #AAA; +@select-colour: #089fd7; +@font-size: 14px; +@border-colour: #DDD; +.vertical-centre (@height) { + height: @height; + line-height: @height !important; + display: inline-block; + vertical-align: middle; +} +.vesselDropdown { + float: left; + display: block; + width: 750px; + fill: #FFFFFF; + background-color: #FFFFFF; + >div { + float: left; + width: 100%; + position: relative; + >div.vesselDropdown-display { + float: left; + width: 100%; + background: white; + height: @height; + cursor: pointer; + border: solid 1px @border-colour; + box-sizing: border-box; + @icon-width: 14px; + position: relative; + display: block; + >* { + float: left; + height: 100%; + .vertical-centre(@height); + } + >span.text { + font-size: @font-size; + width: 100%; + position: relative; + box-sizing: border-box; + padding-right: @icon-width+@spacing*2; + padding-left: @spacing; + &.placeholder { + color: @placeholder-colour; + } + } + >i.clear-selection { + position: absolute; + width: @icon-width; + margin-left: (@spacing+2*@icon-width)*-1; + font-size: 1.125em; + font-weight: bold; + padding-right: @spacing + @icon-width; + text-align: right; + margin-top: -2px; + } + >i.show-list { + position: relative; + width: @icon-width; + margin-left: (@spacing+@icon-width)*-1; + font-size: 1.125em; + font-weight: bold; + padding-right: @spacing; + text-align: right; + } + .caret { + color: @primaryColor; + position: absolute; + right: 10px; + top: 50%; + margin-top: -2px; + } + } + >div.vesselDropdown-display:hover { + border-color: #089fd7; + } + >div.vesselDropdown-list { + margin-top: @height; + float: left; + width: 100%; + border-color: #089fd7; + position: absolute; + >div { + position: absolute; + width: 100%; + z-index: 2; + cursor: pointer; + background: white; + >table { + margin-bottom: 0; + } + >table>tbody>tr.selected>td { + background: @select-colour; + } + >div { + float: left; + width: 100%; + padding: 0 @spacing; + font-size: @font-size; + box-sizing: border-box; + border: solid 1px @border-colour; + border-top: none; + @icon-width: 20px; + &:hover { + background: #F0F0F0; + } + >* { + .vertical-centre(@height); + } + >span { + float: left; + width: 100%; + position: relative; + padding-right: @icon-width+@spacing; + box-sizing: border-box; + color: inherit; + } + >i { + float: left; + width: @icon-width; + margin-left: @icon-width*-1; + display: none; + } + } + } + } + } +} diff --git a/unionvms-web/app/service/reporting/reportService.js b/unionvms-web/app/service/reporting/reportService.js index fea1e1afd..84524a54f 100644 --- a/unionvms-web/app/service/reporting/reportService.js +++ b/unionvms-web/app/service/reporting/reportService.js @@ -400,6 +400,11 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp return nodes; }; + rep.getPositions = function () { + return rep.positions; + }; + + //Get VMS data Success callback var getVmsDataSuccess = function(data){ rep.positions = data.movements.features; From 717878fd9d46490b6aa7a059f75d7d4e77818857 Mon Sep 17 00:00:00 2001 From: lsotiriadis Date: Mon, 24 Aug 2020 15:16:11 +0300 Subject: [PATCH 05/33] [UNIONVMS-4743] Allowing filter criteria to extend the selection (OR) Signed-off-by: lsotiriadis --- .../spatial/stResetSearch/stResetSearch.js | 128 +- .../stFieldSearchGeoJson.js | 844 +++++----- .../liveViewPanel/vmsPanel/vmsPanel.html | 1446 +++++++++-------- .../liveViewPanel/vmsPanel/vmsPanel.js | 284 ++-- .../liveViewPanel/vmsPanel/vmsPanel.less | 587 +++---- 5 files changed, 1711 insertions(+), 1578 deletions(-) diff --git a/unionvms-web/app/directive/spatial/stResetSearch/stResetSearch.js b/unionvms-web/app/directive/spatial/stResetSearch/stResetSearch.js index 390187962..42fb567f9 100644 --- a/unionvms-web/app/directive/spatial/stResetSearch/stResetSearch.js +++ b/unionvms-web/app/directive/spatial/stResetSearch/stResetSearch.js @@ -1,71 +1,71 @@ /* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . -*/ -angular.module('unionvmsWeb').directive('stResetSearch', function() { - return { - restrict: 'E', - require: '^stTable', - scope: { - formId: '@', +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . +*/ +angular.module('unionvmsWeb').directive('stResetSearch', function() { + return { + restrict: 'E', + require: '^stTable', + scope: { + formId: '@', clearDates: '&', - clearCombos: '&' - }, - templateUrl: 'directive/spatial/stResetSearch/stResetSearch.html', - link: function(scope, element, attrs, ctrl) { - scope.getTableState = function(){ - return ctrl.tableState(); - }; - - scope.resetFields = function(){ - var coordFields = ['lon|dd', 'lat|dd', 'lon|deg', 'lat|deg', 'lon|min', 'lat|min']; - $('#' + scope.formId + ' [name]').each( - function(index){ - var input = $(this); + clearCombos: '&' + }, + templateUrl: 'directive/spatial/stResetSearch/stResetSearch.html', + link: function(scope, element, attrs, ctrl) { + scope.getTableState = function(){ + return ctrl.tableState(); + }; + + scope.resetFields = function(){ + var coordFields = ['lon|dd', 'lat|dd', 'lon|deg', 'lat|deg', 'lon|min', 'lat|min']; + $('[id^=' + scope.formId + '] [name]').each( + function(index){ + var input = $(this); var name = input.attr('name'); - input.val(''); - if (_.indexOf(coordFields, name) !== -1 && input.is(':visible') && input.hasClass('coordError')){ - input.removeClass('coordError'); - var qtipEl; - if (name.indexOf('dd') !== -1){ - qtipEl = '#qtip-' + name.replace('|', '-') + ' i'; - } else { - qtipEl = '#qtip-' + name.split('|')[0] + '-ddm i'; - } - $(qtipEl).removeClass('hasError'); - } - } - ); - - if (angular.isDefined(attrs.clearDates)){ - scope.clearDates(); + input.val(''); + if (_.indexOf(coordFields, name) !== -1 && input.is(':visible') && input.hasClass('coordError')){ + input.removeClass('coordError'); + var qtipEl; + if (name.indexOf('dd') !== -1){ + qtipEl = '#qtip-' + name.replace('|', '-') + ' i'; + } else { + qtipEl = '#qtip-' + name.split('|')[0] + '-ddm i'; + } + $(qtipEl).removeClass('hasError'); + } + } + ); + + if (angular.isDefined(attrs.clearDates)){ + scope.clearDates(); } if (angular.isDefined(attrs.clearCombos)){ scope.clearCombos(); - } - }; - - scope.resetFilters = function(){ - scope.resetFields(); - var state = scope.getTableState(); - state.search.predicateObject = {}; - state.pagination.start = 0; - return ctrl.pipe(); - }; - - scope.$watch('executedReport.isReportExecuting', function(newVal){ - if (newVal){ - scope.resetFilters(); - } - }); - } - }; -}); + } + }; + + scope.resetFilters = function(){ + scope.resetFields(); + var state = scope.getTableState(); + state.search.predicateObject = {}; + state.pagination.start = 0; + return ctrl.pipe(); + }; + + scope.$watch('executedReport.isReportExecuting', function(newVal){ + if (newVal){ + scope.resetFilters(); + } + }); + } + }; +}); diff --git a/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js b/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js index 9fa2883af..1a0dc7350 100644 --- a/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js +++ b/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js @@ -1,413 +1,433 @@ -angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, unitConversionService, coordinateFormatService){ - return function(array, predictedObject){ - //check predicted object type and parse it back - var pKey = _.keys(predictedObject); - var srcObject = {}; - var type = 'tracks'; - if (pKey.length === 1){ - srcObject = JSON.parse(predictedObject[pKey[0]]); - type = pKey[0]; - } - - //Filter - var filterFilter = $filter('filter'); - var filteredRecs = []; - - - var searchableKeys = _.keys(srcObject); - var searchObj = {}; - var additionalFilters = { - doSearch: false, - recs: [] - }; - - var timeFields = ['duration', 'totalTimeAtSea']; - var numberFields = ['reportedSpeed', 'calculatedSpeed', 'speedOverGround', 'distance']; - - if (type !== 'tracks' && type !== 'trips'){ - searchObj.properties = {}; - } - - //HELPER FUNCTIONS - var getNumDecimals = function(num){ - if (_.isNumber(num)){ - num = num.toString(); - } - - var numSplit = num.split(".")[1]; - var decimals = 0; - if (angular.isDefined(numSplit)){ - decimals = numSplit.length; - } - return decimals; - }; - - var getDecimalsAsString = function(num){ - if (_.isNumber(num)){ - num = num.toString(); - } - return num.split(".")[1]; - }; - - var fixDecimalNotation = function(numStr){ - return numStr.replace(',','.'); - }; - - var checkDecimalDegrees = function(dd, geomCoord){ - //src dd filter - var numerical = parseFloat(fixDecimalNotation(dd)); - var decimals = getNumDecimals(numerical); - - var resp = false; - if (Math.sign(geomCoord) === Math.sign(numerical)){ - if (decimals === 0){ - resp = Math.abs(numerical) === Math.abs(Math.trunc(geomCoord)); - } else { - resp = Math.abs(Math.trunc(numerical)) === Math.abs(Math.trunc(geomCoord)) && getDecimalsAsString(geomCoord).indexOf(getDecimalsAsString(numerical)) === 0; - } - } - - return resp; - }; - - var getMinutesFromDD = function(dd){ - var num = dd.toString(); - var numSplit = num.split('.'); - - var minutes; - if (angular.isDefined(numSplit[1])){ - var decimals = numSplit[1].length; - minutes = parseInt(numSplit[1]) / Math.pow(10, decimals) * 60; - } - - return minutes; - }; - - var checkDecimalMinutes = function(minutes, geomCoord){ - var decimals = getNumDecimals(minutes); - minutes = parseFloat(minutes).toString(); - var coordMin = getMinutesFromDD(geomCoord); - if (decimals === 0){ - coordMin = Math.trunc(coordMin).toString(); - } else { - coordMin = coordMin.toFixed(decimals); - } - - var resp = false; - if (coordMin.indexOf(minutes) === 0){ - resp = true; - } - - return resp; - }; - - //Function to calculate upper boundary when filtering fields with duration/time - var dehumanizeTimeAndCalculateUpBoundary = function(time){ - var parsedStr = time.match(/([0-9]+[dhms]{1})/ig); - var secondsToAdd = 0; - var fixedSeconds = 0; - if (_.isArray(parsedStr)){ - for (var i = 0; i < parsedStr.length; i++){ - //days - if (parsedStr[i].toUpperCase().indexOf('D') !== -1){ - fixedSeconds += parseInt(parsedStr[i]) * 24 * 3600; - if (i + 1 === parsedStr.length){ - secondsToAdd += 24 * 3600; - } - } - //hours - if (parsedStr[i].toUpperCase().indexOf('H') !== -1){ - fixedSeconds += parseInt(parsedStr[i]) * 3600; - if (i + 1 === parsedStr.length){ - secondsToAdd += 3600; - } - } - //minutes - if (parsedStr[i].toUpperCase().indexOf('M') !== -1){ - fixedSeconds += parseInt(parsedStr[i]) * 60; - if (i + 1 === parsedStr.length){ - secondsToAdd += 60; - } - } - //seconds - if (parsedStr[i].toUpperCase().indexOf('S') !== -1){ - fixedSeconds += parseInt(parsedStr[i]); - } - } - - //return converted input and seconds as miliseconds to add for upper boundary - return [fixedSeconds * 1000, secondsToAdd * 1000]; - } - }; - - //LET'S DO THE ACTUAL FILTERING - var comps; - for (var i = 0; i < searchableKeys.length; i++){ - var keyIn = false; - if (_.indexOf(numberFields, searchableKeys[i]) !== -1){ - keyIn = true; - additionalFilters[searchableKeys[i]] = srcObject[searchableKeys[i]]; - additionalFilters.doSearch = true; - } - - if (_.indexOf(timeFields, searchableKeys[i]) !== -1){ - var calcTimes = dehumanizeTimeAndCalculateUpBoundary(srcObject[searchableKeys[i]]); - if (_.isArray(calcTimes)){ - keyIn = true; - additionalFilters[searchableKeys[i]] = srcObject[searchableKeys[i]]; - additionalFilters.doSearch = true; - - additionalFilters.srcTime = calcTimes[0]; - additionalFilters.secondsToAdd = calcTimes[1]; - additionalFilters.upBoundary = calcTimes[0] + calcTimes[1]; - } else { - continue; - } - } - - if (type !== 'tracks'){ - if (_.indexOf(numberFields, searchableKeys[i]) === -1 && _.indexOf(timeFields, searchableKeys[i]) === -1){ - if (searchableKeys[i].indexOf('lon') !== -1){ - keyIn = true; - if (!angular.isDefined(additionalFilters.lon)){ - additionalFilters.lon = {}; - } - additionalFilters.doSearch = true; - comps = searchableKeys[i].split('|'); - if (comps[1] === 'dd'){ - additionalFilters.lon.dd = srcObject[searchableKeys[i]]; - } else if (comps[1] === 'deg') { - additionalFilters.lon.deg = srcObject[searchableKeys[i]]; - } else { - additionalFilters.lon.min = srcObject[searchableKeys[i]]; - } - } else if (searchableKeys[i].indexOf('lat') !== -1){ - keyIn = true; - if(!angular.isDefined(additionalFilters.lat)){ - additionalFilters.lat = {}; - } - additionalFilters.doSearch = true; - comps = searchableKeys[i].split('|'); - if (comps[1] === 'dd'){ - additionalFilters.lat.dd = srcObject[searchableKeys[i]]; - } else if (comps[1] === 'deg'){ - additionalFilters.lat.deg = srcObject[searchableKeys[i]]; - } else { - additionalFilters.lat.min = srcObject[searchableKeys[i]]; - } - } else if (searchableKeys[i] === 'startDate' || searchableKeys[i] === 'endDate' || searchableKeys[i] === 'alarmStartDate' || searchableKeys[i] === 'alarmEndDate') { - keyIn = true; - additionalFilters[searchableKeys[i]] = srcObject[searchableKeys[i]]; - var name = searchableKeys[i] + 'Field'; - if (type === 'positions'){ - additionalFilters[name] = 'positionTime'; - } else if (type === 'alarms'){ - additionalFilters[name] = 'ticketOpenDate'; - } else if (type === 'trips'){ - if (searchableKeys[i] === 'startDate'){ - additionalFilters[name] = 'firstFishingActivityDateTime'; - } else { - additionalFilters[name] = 'lastFishingActivityDateTime'; - } - } - - additionalFilters.doSearch = true; - } else if (searchableKeys[i] === 'tripId'){ - keyIn = true; - additionalFilters['tripId'] = srcObject[searchableKeys[i]]; - additionalFilters.doSearch = true; - } - } - } - - if (!keyIn){ - if (type === 'tracks' || type === 'trips'){ - searchObj[searchableKeys[i]] = srcObject[searchableKeys[i]]; //this is the default - } else { - searchObj.properties[searchableKeys[i]] = srcObject[searchableKeys[i]]; //this is the default - } - - } - } - - var tempRecs = []; - if (!angular.equals({}, searchObj)){ - tempRecs = filterFilter(array, searchObj); - } else { - tempRecs = array; - } - - var updateInclude = function(temp, include){ - if (temp === false){ - include = false; - } - return include; - }; - - if (additionalFilters.doSearch === true){ - var additionalKeys = _.keys(additionalFilters); - additionalKeys.splice(0,1); - var temp; - angular.forEach(tempRecs, function(rec, idx){ - var filterDate, recDate; - var includeArray = []; - var include = true; - if (angular.isDefined(this.lon)){ - //decimal degrees - if (angular.isDefined(this.lon.dd)){ - temp = checkDecimalDegrees(this.lon.dd, rec.geometry.coordinates[0]); - } - - //degrees decimal minutes - if (angular.isDefined(this.lon.deg)){ - //degrees - temp = checkDecimalDegrees(this.lon.deg, rec.geometry.coordinates[0]); - - //decimal minutes - if (angular.isDefined(this.lon.min) && temp){ - temp = checkDecimalMinutes(this.lon.min, rec.geometry.coordinates[0]); - } - } - include = updateInclude(temp, include); - } - - if (angular.isDefined(this.lat)){ - //decimal degrees - if (angular.isDefined(this.lat.dd)){ - temp = checkDecimalDegrees(this.lat.dd, rec.geometry.coordinates[1]); - } - - //degrees decimal minutes - if (angular.isDefined(this.lat.deg)){ - //degrees - temp = checkDecimalDegrees(this.lat.deg, rec.geometry.coordinates[1]); - - //decimal minutes - if (angular.isDefined(this.lat.min) && include){ - temp = checkDecimalMinutes(this.lat.min, rec.geometry.coordinates[1]); - } - } - include = updateInclude(temp, include); - } - - var srcRec = rec; - if (angular.isDefined(this.startDate)){ - if (type !== 'trips'){ - srcRec = rec.properties; - } - recDate = moment.utc(srcRec[this.startDateField]); - filterDate = moment.utc(this.startDate); - - temp = recDate.isAfter(filterDate); - include = updateInclude(temp, include); - } - - if (angular.isDefined(this.endDate)){ - if (type !== 'trips'){ - srcRec = rec.properties; - } - - recDate = moment.utc(srcRec[this.endDateField]); - filterDate = moment.utc(this.endDate); - - temp = recDate.isBefore(filterDate); - include = updateInclude(temp, include); - } - - var srcSpeed; - if (angular.isDefined(this.reportedSpeed)){ - srcSpeed = $filter('number')(rec.properties.reportedSpeed, 5); - temp = srcSpeed.indexOf(fixDecimalNotation(this.reportedSpeed)) === 0; - include = updateInclude(temp, include); - } - - if (angular.isDefined(this.calculatedSpeed)){ - srcSpeed = $filter('number')(rec.properties.calculatedSpeed, 5); - temp = srcSpeed.indexOf(fixDecimalNotation(this.calculatedSpeed)) === 0; - include = updateInclude(temp, include); - } - - if (angular.isDefined(this.speedOverGround)){ - srcSpeed = $filter('number')(rec.properties.speedOverGround, 5); - temp = srcSpeed.indexOf(fixDecimalNotation(this.speedOverGround)) === 0; - include = updateInclude(temp, include); - } - - var srcDist; - if (angular.isDefined(this.distance)){ - if (type === 'tracks'){ - srcDist = $filter('number')(rec.distance, 5); - } else { - srcDist = $filter('number')(rec.properties.distance, 5); - } - temp = srcDist.indexOf(fixDecimalNotation(this.distance)) === 0; - include = updateInclude(temp, include); - } - - if (angular.isDefined(this.duration)){ - temp = false; - var srcProp; - if (type === 'tracks'){ - srcProp = rec.duration; - } else if (type === 'trips'){ - srcProp = rec.tripDuration; - } else { - srcProp = rec.properties.duration; - } - - - if (this.upBoundary && srcProp >= this.srcTime && srcProp < this.upBoundary){ - temp = true; - } - - if (srcProp === this.srcTime){ - temp = true; - } - - if (this.secondsToAdd === 0 && srcProp > this.upBoundary - 1 && srcProp <= this.upBoundary){ - temp = true; - } - - include = updateInclude(temp, include); - } - - if (angular.isDefined(this.totalTimeAtSea)){ - temp = false; - if (this.upBoundary && rec.totalTimeAtSea >= this.srcTime && rec.totalTimeAtSea < this.upBoundary){ - temp = true; - } - - if (rec.totalTimeAtSea === this.srcTime){ - temp = true; - } - - if (this.secondsToAdd === 0 && rec.totalTimeAtSea > this.upBoundary - 1 && rec.totalTimeAtSea <= this.upBoundary){ - temp = true; - } - - include = updateInclude(temp, include); - } - - if (angular.isDefined(this.tripId)){ - temp = false; - var tripName = rec.schemeId + ':' + rec.tripId; - if (tripName.indexOf(this.tripId.toUpperCase()) !== -1){ - temp = true; - } - include = updateInclude(temp, include); - } - - if (include){ - this.recs.push(rec); - } - - }, additionalFilters); - angular.copy(additionalFilters.recs, filteredRecs); - additionalFilters.recs = []; - } else { - filteredRecs = tempRecs; - } - - return filteredRecs; - }; +angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, unitConversionService, coordinateFormatService){ + return function(array, predictedObject){ + var filteredRecs = []; + + //check predicted object type and parse it back + var pKey = _.keys(predictedObject); + var srcObjects = []; + var type = 'tracks'; + if (pKey.length === 1){ + srcObjects = JSON.parse(predictedObject[pKey[0]]); + type = pKey[0]; + } + + //Filter + var filterFilter = $filter('filter'); + + //HELPER FUNCTIONS + var getNumDecimals = function(num){ + if (_.isNumber(num)){ + num = num.toString(); + } + + var numSplit = num.split(".")[1]; + var decimals = 0; + if (angular.isDefined(numSplit)){ + decimals = numSplit.length; + } + return decimals; + }; + + var getDecimalsAsString = function(num){ + if (_.isNumber(num)){ + num = num.toString(); + } + return num.split(".")[1]; + }; + + var fixDecimalNotation = function(numStr){ + return numStr.replace(',','.'); + }; + + var checkDecimalDegrees = function(dd, geomCoord){ + //src dd filter + var numerical = parseFloat(fixDecimalNotation(dd)); + var decimals = getNumDecimals(numerical); + + var resp = false; + if (Math.sign(geomCoord) === Math.sign(numerical)){ + if (decimals === 0){ + resp = Math.abs(numerical) === Math.abs(Math.trunc(geomCoord)); + } else { + resp = Math.abs(Math.trunc(numerical)) === Math.abs(Math.trunc(geomCoord)) && getDecimalsAsString(geomCoord).indexOf(getDecimalsAsString(numerical)) === 0; + } + } + + return resp; + }; + + var getMinutesFromDD = function(dd){ + var num = dd.toString(); + var numSplit = num.split('.'); + + var minutes; + if (angular.isDefined(numSplit[1])){ + var decimals = numSplit[1].length; + minutes = parseInt(numSplit[1]) / Math.pow(10, decimals) * 60; + } + + return minutes; + }; + + var checkDecimalMinutes = function(minutes, geomCoord){ + var decimals = getNumDecimals(minutes); + minutes = parseFloat(minutes).toString(); + var coordMin = getMinutesFromDD(geomCoord); + if (decimals === 0){ + coordMin = Math.trunc(coordMin).toString(); + } else { + coordMin = coordMin.toFixed(decimals); + } + + var resp = false; + if (coordMin.indexOf(minutes) === 0){ + resp = true; + } + + return resp; + }; + + //Function to calculate upper boundary when filtering fields with duration/time + var dehumanizeTimeAndCalculateUpBoundary = function(time){ + var parsedStr = time.match(/([0-9]+[dhms]{1})/ig); + var secondsToAdd = 0; + var fixedSeconds = 0; + if (_.isArray(parsedStr)){ + for (var i = 0; i < parsedStr.length; i++){ + //days + if (parsedStr[i].toUpperCase().indexOf('D') !== -1){ + fixedSeconds += parseInt(parsedStr[i]) * 24 * 3600; + if (i + 1 === parsedStr.length){ + secondsToAdd += 24 * 3600; + } + } + //hours + if (parsedStr[i].toUpperCase().indexOf('H') !== -1){ + fixedSeconds += parseInt(parsedStr[i]) * 3600; + if (i + 1 === parsedStr.length){ + secondsToAdd += 3600; + } + } + //minutes + if (parsedStr[i].toUpperCase().indexOf('M') !== -1){ + fixedSeconds += parseInt(parsedStr[i]) * 60; + if (i + 1 === parsedStr.length){ + secondsToAdd += 60; + } + } + //seconds + if (parsedStr[i].toUpperCase().indexOf('S') !== -1){ + fixedSeconds += parseInt(parsedStr[i]); + } + } + + //return converted input and seconds as miliseconds to add for upper boundary + return [fixedSeconds * 1000, secondsToAdd * 1000]; + } + }; + + var timeFields = ['duration', 'totalTimeAtSea']; + var numberFields = ['reportedSpeed', 'calculatedSpeed', 'speedOverGround', 'distance']; + + if(srcObjects.length === 0) { + srcObjects.push({}); + } + for(var idx =0; idx < srcObjects.length; idx++) { + var srcObject = srcObjects[idx]; + var searchableKeys = _.keys(srcObject); + var searchObj = {}; + var additionalFilters = { + doSearch: false, + recs: [] + }; + + if (type !== 'tracks' && type !== 'trips'){ + searchObj.properties = {}; + } + + //LET'S DO THE ACTUAL FILTERING + var comps; + for (var i = 0; i < searchableKeys.length; i++){ + var keyIn = false; + if (_.indexOf(numberFields, searchableKeys[i]) !== -1){ + keyIn = true; + additionalFilters[searchableKeys[i]] = srcObject[searchableKeys[i]]; + additionalFilters.doSearch = true; + } + + if (_.indexOf(timeFields, searchableKeys[i]) !== -1){ + var calcTimes = dehumanizeTimeAndCalculateUpBoundary(srcObject[searchableKeys[i]]); + if (_.isArray(calcTimes)){ + keyIn = true; + additionalFilters[searchableKeys[i]] = srcObject[searchableKeys[i]]; + additionalFilters.doSearch = true; + + additionalFilters.srcTime = calcTimes[0]; + additionalFilters.secondsToAdd = calcTimes[1]; + additionalFilters.upBoundary = calcTimes[0] + calcTimes[1]; + } else { + continue; + } + } + + if (type !== 'tracks'){ + if (_.indexOf(numberFields, searchableKeys[i]) === -1 && _.indexOf(timeFields, searchableKeys[i]) === -1){ + if (searchableKeys[i].indexOf('lon') !== -1){ + keyIn = true; + if (!angular.isDefined(additionalFilters.lon)){ + additionalFilters.lon = {}; + } + additionalFilters.doSearch = true; + comps = searchableKeys[i].split('|'); + if (comps[1] === 'dd'){ + additionalFilters.lon.dd = srcObject[searchableKeys[i]]; + } else if (comps[1] === 'deg') { + additionalFilters.lon.deg = srcObject[searchableKeys[i]]; + } else { + additionalFilters.lon.min = srcObject[searchableKeys[i]]; + } + } else if (searchableKeys[i].indexOf('lat') !== -1){ + keyIn = true; + if(!angular.isDefined(additionalFilters.lat)){ + additionalFilters.lat = {}; + } + additionalFilters.doSearch = true; + comps = searchableKeys[i].split('|'); + if (comps[1] === 'dd'){ + additionalFilters.lat.dd = srcObject[searchableKeys[i]]; + } else if (comps[1] === 'deg'){ + additionalFilters.lat.deg = srcObject[searchableKeys[i]]; + } else { + additionalFilters.lat.min = srcObject[searchableKeys[i]]; + } + } else if (searchableKeys[i] === 'startDate' || searchableKeys[i] === 'endDate' || searchableKeys[i] === 'alarmStartDate' || searchableKeys[i] === 'alarmEndDate') { + keyIn = true; + additionalFilters[searchableKeys[i]] = srcObject[searchableKeys[i]]; + var name = searchableKeys[i] + 'Field'; + if (type === 'positions'){ + additionalFilters[name] = 'positionTime'; + } else if (type === 'alarms'){ + additionalFilters[name] = 'ticketOpenDate'; + } else if (type === 'trips'){ + if (searchableKeys[i] === 'startDate'){ + additionalFilters[name] = 'firstFishingActivityDateTime'; + } else { + additionalFilters[name] = 'lastFishingActivityDateTime'; + } + } + + additionalFilters.doSearch = true; + } else if (searchableKeys[i] === 'tripId'){ + keyIn = true; + additionalFilters['tripId'] = srcObject[searchableKeys[i]]; + additionalFilters.doSearch = true; + } + } + } + + if (!keyIn){ + if (type === 'tracks' || type === 'trips'){ + searchObj[searchableKeys[i]] = srcObject[searchableKeys[i]]; //this is the default + } else { + searchObj.properties[searchableKeys[i]] = srcObject[searchableKeys[i]]; //this is the default + } + + } + } + + var tempRecs = []; + if (!angular.equals({}, searchObj)){ + tempRecs = filterFilter(array, searchObj); + } else { + tempRecs = array; + } + + var updateInclude = function(temp, include){ + if (temp === false){ + include = false; + } + return include; + }; + + if (additionalFilters.doSearch === true){ + var additionalKeys = _.keys(additionalFilters); + additionalKeys.splice(0,1); + var temp; + angular.forEach(tempRecs, function(rec, idx){ + var filterDate, recDate; + var includeArray = []; + var include = true; + if (angular.isDefined(this.lon)){ + //decimal degrees + if (angular.isDefined(this.lon.dd)){ + temp = checkDecimalDegrees(this.lon.dd, rec.geometry.coordinates[0]); + } + + //degrees decimal minutes + if (angular.isDefined(this.lon.deg)){ + //degrees + temp = checkDecimalDegrees(this.lon.deg, rec.geometry.coordinates[0]); + //decimal minutes + if (angular.isDefined(this.lon.min) && temp){ + temp = checkDecimalMinutes(this.lon.min, rec.geometry.coordinates[0]); + } + } + include = updateInclude(temp, include); + } + + if (angular.isDefined(this.lat)){ + //decimal degrees + if (angular.isDefined(this.lat.dd)){ + temp = checkDecimalDegrees(this.lat.dd, rec.geometry.coordinates[1]); + } + + //degrees decimal minutes + if (angular.isDefined(this.lat.deg)){ + //degrees + temp = checkDecimalDegrees(this.lat.deg, rec.geometry.coordinates[1]); + + //decimal minutes + if (angular.isDefined(this.lat.min) && include){ + temp = checkDecimalMinutes(this.lat.min, rec.geometry.coordinates[1]); + } + } + include = updateInclude(temp, include); + } + + var srcRec = rec; + if (angular.isDefined(this.startDate)){ + if (type !== 'trips'){ + srcRec = rec.properties; + } + recDate = moment.utc(srcRec[this.startDateField]); + filterDate = moment.utc(this.startDate); + + temp = recDate.isAfter(filterDate); + include = updateInclude(temp, include); + } + + if (angular.isDefined(this.endDate)){ + if (type !== 'trips'){ + srcRec = rec.properties; + } + + recDate = moment.utc(srcRec[this.endDateField]); + filterDate = moment.utc(this.endDate); + + temp = recDate.isBefore(filterDate); + include = updateInclude(temp, include); + } + + var srcSpeed; + if (angular.isDefined(this.reportedSpeed)){ + srcSpeed = $filter('number')(rec.properties.reportedSpeed, 5); + temp = srcSpeed.indexOf(fixDecimalNotation(this.reportedSpeed)) === 0; + include = updateInclude(temp, include); + } + + if (angular.isDefined(this.calculatedSpeed)){ + srcSpeed = $filter('number')(rec.properties.calculatedSpeed, 5); + temp = srcSpeed.indexOf(fixDecimalNotation(this.calculatedSpeed)) === 0; + include = updateInclude(temp, include); + } + + if (angular.isDefined(this.speedOverGround)){ + srcSpeed = $filter('number')(rec.properties.speedOverGround, 5); + temp = srcSpeed.indexOf(fixDecimalNotation(this.speedOverGround)) === 0; + include = updateInclude(temp, include); + } + + var srcDist; + if (angular.isDefined(this.distance)){ + if (type === 'tracks'){ + srcDist = $filter('number')(rec.distance, 5); + } else { + srcDist = $filter('number')(rec.properties.distance, 5); + } + temp = srcDist.indexOf(fixDecimalNotation(this.distance)) === 0; + include = updateInclude(temp, include); + } + + if (angular.isDefined(this.duration)){ + temp = false; + var srcProp; + if (type === 'tracks'){ + srcProp = rec.duration; + } else if (type === 'trips'){ + srcProp = rec.tripDuration; + } else { + srcProp = rec.properties.duration; + } + + if (this.upBoundary && srcProp >= this.srcTime && srcProp < this.upBoundary){ + temp = true; + } + + if (srcProp === this.srcTime){ + temp = true; + } + if (this.secondsToAdd === 0 && srcProp > this.upBoundary - 1 && srcProp <= this.upBoundary){ + temp = true; + } + + include = updateInclude(temp, include); + } + + if (angular.isDefined(this.totalTimeAtSea)){ + temp = false; + if (this.upBoundary && rec.totalTimeAtSea >= this.srcTime && rec.totalTimeAtSea < this.upBoundary){ + temp = true; + } + + if (rec.totalTimeAtSea === this.srcTime){ + temp = true; + } + + if (this.secondsToAdd === 0 && rec.totalTimeAtSea > this.upBoundary - 1 && rec.totalTimeAtSea <= this.upBoundary){ + temp = true; + } + + include = updateInclude(temp, include); + } + + if (angular.isDefined(this.tripId)){ + temp = false; + var tripName = rec.schemeId + ':' + rec.tripId; + if (tripName.indexOf(this.tripId.toUpperCase()) !== -1){ + temp = true; + } + include = updateInclude(temp, include); + } + + if (include){ + this.recs.push(rec); + } + + }, additionalFilters); + additionalFilters.recs.forEach(function(val){filteredRecs.push(Object.assign({}, val))}); + additionalFilters.recs = []; + } else { + if(filteredRecs.length === 0) { + filteredRecs = filteredRecs.concat(tempRecs); + } + else if(tempRecs.length > 0){ + for(var y = 0; y < tempRecs.length; y++) { + var tempRec = tempRecs[y]; + var added = false; + for(var innerY=0; innerY < filteredRecs.length; innerY++){ + if(tempRec.id === filteredRecs[innerY].id){ + added = true; + break; + } + } + if(!added){ + filteredRecs.push(tempRec); + } + } + } + } + } + + return filteredRecs; + }; }); \ No newline at end of file diff --git a/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html b/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html index c401175fe..69a2db6bc 100644 --- a/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html +++ b/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html @@ -24,695 +24,765 @@ +
+
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ {{isSegFilterVisible === false ? 'spatial.table_filters_activate' : 'spatial.table_filters_deactivate' | i18n}} + +
+ +
+
+
+
+
+
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ + + + +
+
+
+
{{'spatial.tab_vms_pos_table_header_fs' | i18n }}
+
{{'spatial.tab_vms_pos_table_header_ext_mark' | i18n }}
+
{{'spatial.tab_vms_pos_table_header_ircs' | i18n }}
+
{{'spatial.tab_vms_pos_table_header_cfr' | i18n }}
+
{{'spatial.tab_vms_pos_table_header_name' | i18n }}
+
{{'spatial.tab_vms_seg_table_header_distance' | i18n }}
+
{{'spatial.tab_vms_seg_table_header_duration' | i18n }}
+
{{'spatial.tab_vms_seg_table_header_speed_ground' | i18n }}
+
{{'spatial.tab_vms_seg_table_header_course_ground' | i18n }}
+
{{'spatial.tab_vms_seg_table_header_category' | i18n }}
+
{{'spatial.table_header_actions' | i18n }}
{{'spatial.table_no_data' | i18n}}
+
{{ segment.properties.countryCode }}
+
{{ segment.properties.externalMarking }}
+
{{ segment.properties.ircs }}
+
{{ segment.properties.cfr }}
+
{{ segment.properties.name }}
+
{{ segment.properties.distance | stDistanceUnit : 5 }}
+
{{ segment.properties.duration | stHumanizeTime }}
+
{{ segment.properties.speedOverGround | stSpeedUnit : 5 }}
+
{{ segment.properties.courseOverGround }}°
+
{{ segment.properties.segmentCategory }}
+
+ + +
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ {{isTrackFilterVisible === false ? 'spatial.table_filters_activate' : 'spatial.table_filters_deactivate' | i18n}} + +
+ +
+
+
+
+
+
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ + + + +
+
+
+
{{'spatial.tab_vms_pos_table_header_fs' | i18n }}
+
{{'spatial.tab_vms_pos_table_header_ext_mark' | i18n }}
+
{{'spatial.tab_vms_pos_table_header_ircs' | i18n }}
+
{{'spatial.tab_vms_pos_table_header_cfr' | i18n }}
+
{{'spatial.tab_vms_pos_table_header_name' | i18n }}
+
{{'spatial.tab_vms_seg_table_header_distance' | i18n }}
+
{{'spatial.tab_vms_seg_table_header_duration' | i18n }}
+
{{'spatial.tab_vms_tracks_table_header_time_at_sea' | i18n }}
+
{{'spatial.table_header_actions' | i18n }}
{{'spatial.table_no_data' | i18n}}
+
{{ track.countryCode }}
+
{{ track.externalMarking }}
+
{{ track.ircs }}
+
{{ track.cfr }}
+
{{ track.name }}
+
{{ track.distance | stDistanceUnit : 5 }}
+
{{ track.duration | stHumanizeTime }}
+
{{ track.totalTimeAtSea | stHumanizeTime: track }}
+
+ + +
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ {{isAlarmFilterVisible === false ? 'spatial.table_filters_activate' : 'spatial.table_filters_deactivate' | i18n}} + +
+ +
+
+
+
+
+
+ +
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ + +
+ +
+ + +
+
+
+
+
+ + + + +
+
+
+
{{'spatial.tab_vms_pos_table_header_fs' | i18n }}
+
{{'spatial.tab_vms_pos_table_header_ext_mark' | i18n }}
+
{{'spatial.tab_vms_pos_table_header_ircs' | i18n }}
+
{{'spatial.tab_vms_pos_table_header_cfr' | i18n }}
+
{{'spatial.reports_form_details_modal_vessel_name_header' | i18n }}
+
{{'spatial.rule_table_header_name' | i18n }}
+
{{'spatial.rule_table_header_desc' | i18n }}
+
{{'spatial.rule_open_date' | i18n }}
+
{{'spatial.rule_status' | i18n }}
+
{{'spatial.table_header_actions' | i18n }}
{{'spatial.table_no_data' | i18n}}
+
{{ alarm.properties.fs }}
+
{{ alarm.properties.extMark }}
+
{{ alarm.properties.ircs }}
+
{{ alarm.properties.cfr }}
+
{{ alarm.properties.name }}
+
{{alarm.properties.ruleName}}
+
{{alarm.properties.ruleDesc}}
+
{{alarm.properties.ticketOpenDate | stDateUtc}}
+
{{ alarm.properties.ticketStatus }}
+
+ + + +
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ {{isTripFilterVisible === false ? 'spatial.table_filters_activate' : 'spatial.table_filters_deactivate' | i18n}} + +
+ +
+
+
+
+
+
+ +
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+
+
+
+
+ + + + +
+
+
+
{{'activity.tab_trip_table_header_id' | i18n }}
+
{{'spatial.tab_vms_pos_table_header_fs' | i18n }}
+
{{'spatial.reports_form_vessel_search_table_header_external_marking' | i18n }}
+
{{'spatial.reports_form_vessel_search_table_header_ircs' | i18n }}
+
{{'spatial.reports_form_vessel_search_table_header_cfr' | i18n }}
+
{{'activity.fa_details_item_uvi' | i18n }}
+
{{'activity.fa_details_item_iccat' | i18n }}
+
{{'activity.fa_details_item_gfcm' | i18n }}
+
{{'activity.tab_trip_table_header_first_event' | i18n }}
+
{{'activity.tab_trip_table_header_first_event_time' | i18n }}
+
{{'activity.tab_trip_table_header_last_event' | i18n }}
+
{{'activity.tab_trip_table_header_last_event_time' | i18n }}
+
{{'activity.tab_trip_table_header_duration' | i18n }}
+
{{'activity.tab_trip_table_header_nCorrections' | i18n }}
+
{{'activity.tab_trip_table_header_nPositions' | i18n }}
+
{{'activity.tab_trip_table_header_alarm' | i18n }}
+
{{'spatial.table_header_actions' | i18n }}
{{'spatial.table_no_data' | i18n}}
+
{{ trip.schemeId}}:{{ trip.tripId }}
+
{{ trip.flagState}}
+
{{ trip.EXT_MARK }}
+
{{ trip.CFR }}
+
{{ trip.IRCS }}
+
{{ trip.UVI }}
+
{{ trip.ICCAT }}
+
{{ trip.GFCM }}
+
{{ 'abbreviations.activity_' + trip.firstFishingActivity | i18n }}
+
{{ trip.firstFishingActivityDateTime | stDateUtc }}
+
{{ 'abbreviations.activity_' + trip.lastFishingActivity | i18n }}
+
{{ trip.lastFishingActivityDateTime | stDateUtc }}
+
{{ trip.tripDuration | stHumanizeTime }}
+
{{ trip.noOfCorrections }}
+
{{ trip.vmsPositionCount }}
+
+ + + +
+
+ + +
+
+
+
+
+
+ +
+
+
+ + +
+
+
- + @@ -285,13 +293,21 @@
+
+
+
+ + +
+
+
- + @@ -406,13 +422,21 @@
+
+
+
+ + +
+
+
- + @@ -540,13 +564,21 @@
+
+
+
+ + +
+
+
- + @@ -791,4 +823,4 @@
- \ No newline at end of file + diff --git a/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.js b/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.js index 9c3ba60bf..4e88713fe 100644 --- a/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.js +++ b/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.js @@ -39,6 +39,7 @@ angular.module('unionvmsWeb').controller('VmspanelCtrl',function($scope, locale, 'alarms' : [0], 'trips' : [0] }; + $scope.lastX = undefined; //Define VMS tabs var setVmsTabs = function(){ @@ -327,7 +328,7 @@ angular.module('unionvmsWeb').controller('VmspanelCtrl',function($scope, locale, var data = $scope.getFilterData(formId,type); - valid = $scope.validateDDMCoords(formId,type,data); + valid = $scope.validateDDMCoords(formId,type,data.objects); if (valid){ el.val(JSON.stringify(data)); @@ -392,7 +393,12 @@ angular.module('unionvmsWeb').controller('VmspanelCtrl',function($scope, locale, return value !== ''; }); } - return objects; + var lastXInput = $('#' + type+'-lastX'); + var data = { + "lastX" : lastXInput.val(), + "objects" : objects + }; + return data; }; @@ -827,4 +833,4 @@ angular.module('unionvmsWeb').controller('VmspanelCtrl',function($scope, locale, console.log(item); console.log(collection); }; -}); \ No newline at end of file +}); From c76742c6ef450792e2861382dc38afb92a3a7ebd Mon Sep 17 00:00:00 2001 From: PROTOPAPAS Thanasis Date: Thu, 15 Oct 2020 10:58:16 +0300 Subject: [PATCH 07/33] [UNIONVMS-4854] Add tripId as search field for position and segment tab on report page (tabular view) --- .../stFieldSearchGeoJson.js | 46 ++-- .../liveViewPanel/vmsPanel/vmsPanel.html | 8 + .../app/service/reporting/reportService.js | 213 ++++++++++-------- 3 files changed, 154 insertions(+), 113 deletions(-) diff --git a/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js b/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js index 48ee6cdf9..3bcc20121 100644 --- a/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js +++ b/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js @@ -19,7 +19,7 @@ angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, u } type = pKey[0]; } - + //Filter var filterFilter = $filter('filter'); @@ -28,31 +28,31 @@ angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, u if (_.isNumber(num)){ num = num.toString(); } - + var numSplit = num.split(".")[1]; var decimals = 0; if (angular.isDefined(numSplit)){ decimals = numSplit.length; } - return decimals; + return decimals; }; - + var getDecimalsAsString = function(num){ if (_.isNumber(num)){ num = num.toString(); } return num.split(".")[1]; }; - + var fixDecimalNotation = function(numStr){ return numStr.replace(',','.'); }; - + var checkDecimalDegrees = function(dd, geomCoord){ //src dd filter var numerical = parseFloat(fixDecimalNotation(dd)); var decimals = getNumDecimals(numerical); - + var resp = false; if (Math.sign(geomCoord) === Math.sign(numerical)){ if (decimals === 0){ @@ -61,23 +61,23 @@ angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, u resp = Math.abs(Math.trunc(numerical)) === Math.abs(Math.trunc(geomCoord)) && getDecimalsAsString(geomCoord).indexOf(getDecimalsAsString(numerical)) === 0; } } - + return resp; }; - + var getMinutesFromDD = function(dd){ var num = dd.toString(); var numSplit = num.split('.'); - + var minutes; if (angular.isDefined(numSplit[1])){ var decimals = numSplit[1].length; minutes = parseInt(numSplit[1]) / Math.pow(10, decimals) * 60; } - + return minutes; }; - + var checkDecimalMinutes = function(minutes, geomCoord){ var decimals = getNumDecimals(minutes); minutes = parseFloat(minutes).toString(); @@ -87,15 +87,15 @@ angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, u } else { coordMin = coordMin.toFixed(decimals); } - + var resp = false; if (coordMin.indexOf(minutes) === 0){ resp = true; } - + return resp; }; - + //Function to calculate upper boundary when filtering fields with duration/time var dehumanizeTimeAndCalculateUpBoundary = function(time){ var parsedStr = time.match(/([0-9]+[dhms]{1})/ig); @@ -126,10 +126,10 @@ angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, u } //seconds if (parsedStr[i].toUpperCase().indexOf('S') !== -1){ - fixedSeconds += parseInt(parsedStr[i]); + fixedSeconds += parseInt(parsedStr[i]); } } - + //return converted input and seconds as miliseconds to add for upper boundary return [fixedSeconds * 1000, secondsToAdd * 1000]; } @@ -237,6 +237,10 @@ angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, u keyIn = true; additionalFilters['tripId'] = srcObject[searchableKeys[i]]; additionalFilters.doSearch = true; + } else if (searchableKeys[i] === 'tripIds') { + keyIn = true; + additionalFilters['tripIds'] = srcObject[searchableKeys[i]]; + additionalFilters.doSearch = true; } } } @@ -433,6 +437,12 @@ angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, u } } + + if (angular.isDefined(this.tripIds)) { + temp = rec.tripIds.includes(this.tripIds); + include = updateInclude(temp, include); + } + if (include){ this.recs.push(rec); } @@ -461,7 +471,7 @@ angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, u } } } - + return filteredRecs; }; }); diff --git a/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html b/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html index b09dd1954..66a85a36f 100644 --- a/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html +++ b/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html @@ -142,6 +142,10 @@ +
+ + +
@@ -290,6 +294,10 @@ +
+ + +
diff --git a/unionvms-web/app/service/reporting/reportService.js b/unionvms-web/app/service/reporting/reportService.js index 84524a54f..55e73f5db 100644 --- a/unionvms-web/app/service/reporting/reportService.js +++ b/unionvms-web/app/service/reporting/reportService.js @@ -16,7 +16,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp name: undefined, isReportExecuting: false, isReportRefreshing: false, - hasAlert: false, + hasAlert: false, hideCatchDetails : false, message: undefined, alertType: undefined, @@ -35,7 +35,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp getConfigsTime: undefined, getReportTime: undefined }; - + rep.clearVmsData = function(){ rep.id = undefined; rep.positions = []; @@ -45,23 +45,23 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp rep.trips = []; rep.activities = []; }; - + rep.resetReport = function(){ rep.name = locale.getString('spatial.header_live_view'); rep.refresh.status = false; rep.refresh.rate = undefined; rep.getConfigsTime = undefined; rep.getReportTime = undefined; - + //Clear data used in tables rep.clearVmsData(); - + //Reset labels mapService.resetLabelContainers(); - + //Clear report form service reportFormService.resetLiveView(); - + //Reset map projection if (angular.isDefined(mapService.map)){ mapService.updateMapView({ @@ -71,17 +71,17 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp axis: 'enu', extent: '-20026376.39;-20048966.10;20026376.39;20048966.10' }); - + //Reset layer tree layerPanelService.updateLayerTreeSource([]); } }; - + rep.stopRunInterval = function(){ $interval.cancel(rep.runInterval); rep.runInterval = undefined; }; - + var runSummaryReport = function(){ $modalStack.dismissAll(); @@ -93,7 +93,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp spatialHelperService.fromFAView = false; tripReportsTimeline.reset(); - + if(angular.isDefined(report)){ rep.reportType = report.reportType; } @@ -102,27 +102,27 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp if (angular.isDefined(rep.autoRefreshInterval)){ rep.stopAutoRefreshInterval(); } - + rep.isReportExecuting = true; var prevRepId, prevRepEditable; if (angular.isDefined(reportFormService.liveView.currentReport)){ prevRepId = reportFormService.liveView.currentReport.id; prevRepEditable = reportFormService.liveView.editable; } - + if (!angular.isDefined(report) && !angular.isDefined(reportFormService.liveView.currentReport)){ prevRepId = rep.id; prevRepEditable = reportFormService.liveView.editable; } - + reportFormService.resetLiveView(); - + var editable = false; if (angular.isDefined(report)){ if (angular.isDefined(report.editable)){ editable = report.editable; - } - + } + if (angular.isDefined(prevRepId) && prevRepId === report.id && !angular.isDefined(report.editable)){ editable = prevRepEditable; } @@ -130,15 +130,15 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp //here we are always refreshing a report editable = prevRepEditable; } - + reportFormService.liveView.editable = editable; - + rep.runInterval = $interval(function(){ var mapContainer = angular.element('#map'); if (mapContainer.length > 0){ prepareReportToRun(report); rep.getConfigsTime = moment.utc().format('YYYY-MM-DDTHH:mm:ss'); - + if ((report && report.withMap) || rep.isReportRefreshing){ tripSummaryService.withMap = true; spatialRestService.getConfigsForReport(rep.id, rep.getConfigsTime).then(getConfigSuccess, getConfigError); @@ -156,12 +156,12 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp } loadingStatus.isLoading('InitialReporting', false); } - + rep.stopRunInterval(); } }, 10); }; - + rep.runReportWithoutSaving = function(report, preserveMapState){ if (angular.isDefined(preserveMapState) && preserveMapState === true){ setStateProperties(); @@ -176,7 +176,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp rep.stopAutoRefreshInterval(); } rep.isReportExecuting = true; - rep.mergedReport = angular.copy(report); + rep.mergedReport = angular.copy(report); if(rep.mergedReport.withMap && rep.mergedReport.reportType === 'standard'){ spatialConfigRestService.getUserConfigs().then(getUserConfigsSuccess, getUserConfigsFailure); reportingNavigatorService.goToView('liveViewPanel','mapPanel'); @@ -184,10 +184,10 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp }else{ if(rep.reportType === 'summary'){ prepareReportToRun(rep.mergedReport); - + rep.getReportTime = moment.utc().format('YYYY-MM-DDTHH:mm:ss'); rep.mergedReport.additionalProperties = getUnitSettings(); - + reportRestService.executeWithoutSaving(rep.mergedReport).then(getVmsDataSuccess, getVmsDataError); tripSummaryService.trip = undefined; rep.hideCatchDetails = true; @@ -199,11 +199,11 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp loadingStatus.isLoading('InitialReporting', false); } }; - + rep.clearMapOverlays = function(){ //Check for measuring overlays rep.untoggleToolbarBtns(); - + //Deactivate labels if (mapService .vmsposLabels.active === true){ mapService.deactivateVectorLabels('vmspos'); @@ -213,7 +213,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp } mapService.resetLabelContainers(); - + //Deactivate popups if (mapService.popupRecContainer.records.length > 0){ mapService.closePopup(); @@ -231,7 +231,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp }; mapStateService.toStorage(state); }; - + rep.refreshReport = function(){ if (angular.isDefined(rep.id)){ setStateProperties(); @@ -249,19 +249,19 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp $interval.cancel(rep.autoRefreshInterval); rep.autoRefreshInterval = undefined; }; - + rep.setAutoRefresh = function() { if (angular.isDefined(rep.autoRefreshInterval)){ rep.stopAutoRefreshInterval(); } - + rep.autoRefreshInterval = $interval(function() { if (rep.isReportExecuting === false && rep.refresh.status === true && reportingNavigatorService.isViewVisible('mapPanel')) { rep.refreshReport(); } }, rep.refresh.rate*60*1000); //timeout in minutes }; - + rep.getAlarms = function(){ loadingStatus.isLoading('LiveviewMap',true,1); var payload = mapAlarmsService.prepareDataForRequest(); @@ -274,7 +274,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp loadingStatus.isLoading('LiveviewMap', false); } }; - + var getUnitSettings = function(){ return { speedUnit: unitConversionService.speed.getUnit(), @@ -282,7 +282,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp timestamp: rep.getReportTime }; }; - + //Get Spatial config Success callback var getConfigSuccess = function(data){ if(!angular.equals(rep.lastMapConfigs, data)){ @@ -290,10 +290,10 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp configureMap(data); } var repConfig = getRepConfig(); - + reportRestService.executeReport(rep.id,repConfig).then(getVmsDataSuccess, getVmsDataError); }; - + //Get Spatial config Error callback var getConfigError = function(error){ rep.loadReportHistory(); @@ -306,7 +306,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp loadingStatus.isLoading('LiveviewMap', false); mapStateService.clearState(); }; - + var getRepConfig = function(){ var unitSettings = getUnitSettings(); return { @@ -317,12 +317,12 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp } }; }; - + //Get config without map Success callback var getConfigWithoutMapSuccess = function(data){ //Set vms table attribute visibility visibilityService.setVisibility(data.visibilitySettings); - + rep.getReportTime = moment.utc().format('YYYY-MM-DDTHH:mm:ss'); var repConfig = getRepConfig(); reportRestService.executeReport(rep.id,repConfig).then(getVmsDataSuccess, getVmsDataError); @@ -330,7 +330,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp if(rep.reportType === 'summary'){ var elems = angular.element('[ng-controller="VmspanelCtrl"] .modal-body input'); angular.forEach(elems,function(el){ - var elem = $(el); + var elem = $(el); elem.val(''); if(elem.hasClass('hidden-st-control')){ elem.trigger('input'); @@ -338,7 +338,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp }); } }; - + //Get config without map Success callback var getConfigWithoutMapError = function(error){ rep.isReportExecuting = false; @@ -346,7 +346,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp rep.alertType = 'danger'; rep.message = locale.getString('spatial.map_error_loading_report'); }; - + //Get Alarms data Success callback var getAlarmsSuccess = function(response){ if (angular.isDefined(response.data)){ @@ -373,7 +373,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp } loadingStatus.isLoading('LiveviewMap', false); }; - + var getAlarmsError = function(error){ rep.hasAlert = true; rep.alertType = 'danger'; @@ -414,6 +414,29 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp rep.activities = data.activities.features; rep.criteria = data.criteria; + //add tripIds to positions + rep.positions.forEach(pos => { + pos.tripIds = []; + let dtList = []; + data.trips.forEach(dt => { + if (dt.EXT_MARK === pos.properties.externalMarking && moment(pos.properties.positionTime).isBetween(dt.firstFishingActivityDateTime, dt.lastFishingActivityDateTime)) { + dtList.push(dt.tripId); + } + }) + pos.tripIds = dtList; + }) + + //add tripIds to segments + rep.segments.forEach(seg => { + seg.tripIds = [] + rep.positions.forEach(pos => { + seg.geometry.coordinates.forEach(c => { + if (JSON.stringify(c) === JSON.stringify(pos.geometry.coordinates)) + seg.tripIds = pos.tripIds; + }) + }) + }) + if(rep.reportType === 'standard'){ rep.loadReportHistory(); @@ -422,11 +445,11 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp if (mapService.styles.positions.attribute === 'countryCode'){ mapService.setDisplayedFlagStateCodes('positions', rep.positions); } - + if (mapService.styles.segments.attribute === 'countryCode'){ mapService.setDisplayedFlagStateCodes('segments', rep.segments); } - + //Add nodes to the tree and layers to the map if (rep.positions.length > 0 || rep.segments.length > 0 || rep.activities.length > 0){ var vectorNodeSource = new TreeModel(); @@ -448,9 +471,9 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp } }); } - + layerPanelService.addLayerTreeNode(vectorNodeSource); - + if (reportingNavigatorService.isViewVisible('mapPanel') && angular.isUndefined(previousLayerState)){ mapService.zoomToPositionsLayer(); } @@ -467,23 +490,23 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp mapStateService.clearState(); }else{ - if(!angular.isDefined(rep.criteria.recordDTOs) || rep.criteria.recordDTOs.length === 0){ + if(!angular.isDefined(rep.criteria.recordDTOs) || rep.criteria.recordDTOs.length === 0){ rep.hasAlert = true; rep.alertType = 'warning'; rep.hideCatchDetails = false; rep.message = locale.getString('spatial.report_no_ers_data'); - }else{ + }else{ tripSummaryService.trip = undefined; rep.hideCatchDetails = true; - reportingNavigatorService.goToView('liveViewPanel','catchDetails'); + reportingNavigatorService.goToView('liveViewPanel','catchDetails'); } } - + loadingStatus.isLoading('LiveviewMap', false); rep.isReportExecuting = false; rep.isReportRefreshing = false; }; - + //Get VMS data Failure callback var getVmsDataError = function(error){ rep.loadReportHistory(); @@ -500,7 +523,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp loadingStatus.isLoading('LiveviewMap', false); mapStateService.clearState(); }; - + //Refresh report success callback var updateVmsDataSuccess = function(data){ layerPanelService.removeVmsNodes(); @@ -509,10 +532,10 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp rep.tracks = data.tracks; rep.activities = data.activities.features; //TODO activities - + //Remove existing vms vector layers from the map mapService.clearVectorLayers(); - + //Add nodes to the tree and layers to the map if (rep.positions.length > 0 || rep.segments.length > 0){ var vectorNodeSource = new TreeModel(); @@ -525,7 +548,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp } rep.isReportExecuting = false; }; - + //Refresh report failure callback var updateVmsDataError = function(error){ rep.isReportExecuting = false; @@ -533,7 +556,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp rep.alertType = 'danger'; rep.message = locale.getString('spatial.map_error_loading_report'); }; - + var prepareReportToRun = function(report){ rep.id = rep.isReportRefreshing ? rep.id : report.id; rep.name = rep.isReportRefreshing ? rep.name : report.name; @@ -542,32 +565,32 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp rep.tracks = []; rep.activities = []; //TODO activities - + mapService.resetLabelContainers(); - + //This gets executed on initial loading when we have a default report if (!angular.isDefined(mapService.map) && report.withMap && report.reportType === 'standard'){ mapService.setMap(defaultMapConfigs); } else if (angular.isDefined(mapService.map)) { mapService.clearVectorLayers(); - + //Reset history control var history = mapService.getControlsByType('HistoryControl')[0]; if (angular.isDefined(history)){ history.resetHistory(); } - + //Close overlays if (angular.isDefined(mapService.overlay)){ mapService.closePopup(); } - + if (mapService.vmsposLabels.active === true){ mapService.deactivateVectorLabels('vmspos'); } - + if (mapService.vmssegLabels.active === true){ - mapService.deactivateVectorLabels('vmsseg'); + mapService.deactivateVectorLabels('vmsseg'); } } }; @@ -613,38 +636,38 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp return newTreeSource; }; - + var configureMap = function(data){ //Change map ol.View configuration if (mapService.getMapProjectionCode() !== 'EPSG:' + data.map.projection.epsgCode){ mapService.updateMapView(data.map.projection); } - + //Set map controls mapService.updateMapControls(data.map.control); - + //Set toolbar controls spatialHelperService.setToolbarControls(data); - + //Set the styles for vector layers and legend - mapService.setPositionStylesObj(data.vectorStyles.positions); + mapService.setPositionStylesObj(data.vectorStyles.positions); mapService.setSegmentStylesObj(data.vectorStyles.segments); mapService.setAlarmsStylesObj(data.vectorStyles.alarms); // mapService.setActivityStylesObj(data.vectorStyles.activities); Uncomment when activity settings are added in spatial - + //Set vms table attribute visibility visibilityService.setVisibility(data.visibilitySettings); - + //Set popup visibility settings mapService.setPopupVisibility('positions', data.visibilitySettings.positions.popup); mapService.setPopupVisibility('segments', data.visibilitySettings.segments.popup); //mapService.setPopupVisibility('activities', data.visibilitySettings.activities.popup); FIXME - + //Set label visibility mapService.setLabelVisibility('positions', data.visibilitySettings.positions.labels); mapService.setLabelVisibility('segments', data.visibilitySettings.segments.labels); //mapService.setLabelVisibility('activities', data.visibilitySettings.activities.labels); FIXME - + //Build tree object and update layer panel var treeSource = new TreeModel(); @@ -659,31 +682,31 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp $timeout(function() { layerPanelService.updateLayerTreeSource(treeSource); }); - + //map refresh configs if (reportingNavigatorService.isViewVisible('mapPanel') && angular.isDefined(data.map.refresh)){ if(rep.isReportRefreshing === false){ rep.refresh.status = data.map.refresh.status; } - rep.refresh.rate = data.map.refresh.rate; + rep.refresh.rate = data.map.refresh.rate; } - + mapService.updateMapSize(); - + rep.getReportTime = moment.utc().format('YYYY-MM-DDTHH:mm:ss'); }; - + var getUserConfigsSuccess = function(response){ rep.lastMapConfigs = response; - + var model = new SpatialConfig(); var userConfig = model.forUserPrefFromJson(response); - + mergeSettings(userConfig); spatialConfigRestService.getMapConfigsFromReport(getMapConfigs(userConfig)).then(getMapConfigsFromReportSuccess, getMapConfigsFromReportFailure); }; - + var getUserConfigsFailure = function(error){ $anchorScroll(); rep.hasAlert = true; @@ -693,28 +716,28 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp rep.isReportExecuting = false; loadingStatus.isLoading('LiveviewMap', false); }; - + var mergeSettings = function(userConfig){ - if(!angular.isDefined(rep.mergedReport.currentMapConfig.mapConfiguration.mapProjectionId) && - !angular.isDefined(rep.mergedReport.currentMapConfig.mapConfiguration.displayProjectionId) && !angular.isDefined(rep.mergedReport.currentMapConfig.mapConfiguration.coordinatesFormat) && + if(!angular.isDefined(rep.mergedReport.currentMapConfig.mapConfiguration.mapProjectionId) && + !angular.isDefined(rep.mergedReport.currentMapConfig.mapConfiguration.displayProjectionId) && !angular.isDefined(rep.mergedReport.currentMapConfig.mapConfiguration.coordinatesFormat) && !angular.isDefined(rep.mergedReport.currentMapConfig.mapConfiguration.scaleBarUnits)){ - + rep.mergedReport.currentMapConfig.mapConfiguration.spatialConnectId = userConfig.mapSettings.spatialConnectId; rep.mergedReport.currentMapConfig.mapConfiguration.mapProjectionId = userConfig.mapSettings.mapProjectionId; rep.mergedReport.currentMapConfig.mapConfiguration.displayProjectionId = userConfig.mapSettings.displayProjectionId; rep.mergedReport.currentMapConfig.mapConfiguration.coordinatesFormat = userConfig.mapSettings.coordinatesFormat; rep.mergedReport.currentMapConfig.mapConfiguration.scaleBarUnits = userConfig.mapSettings.scaleBarUnits; } - + if(!angular.isDefined(rep.mergedReport.currentMapConfig.mapConfiguration.stylesSettings)){ rep.mergedReport.currentMapConfig.mapConfiguration.stylesSettings = userConfig.stylesSettings; } - + if(!angular.isDefined(rep.mergedReport.currentMapConfig.mapConfiguration.layerSettings)){ rep.mergedReport.currentMapConfig.mapConfiguration.layerSettings = userConfig.layerSettings; } rep.mergedReport.currentMapConfig.mapConfiguration.layerSettings = reportFormService.checkLayerSettings(rep.mergedReport.currentMapConfig.mapConfiguration.layerSettings); - + if(!angular.isDefined(rep.mergedReport.currentMapConfig.mapConfiguration.visibilitySettings)){ rep.mergedReport.currentMapConfig.mapConfiguration.visibilitySettings = userConfig.visibilitySettings; } @@ -722,9 +745,9 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp if(!angular.isDefined(rep.mergedReport.currentMapConfig.mapConfiguration.referenceDataSettings)){ rep.mergedReport.currentMapConfig.mapConfiguration.referenceDataSettings = userConfig.referenceDataSettings; } - + }; - + var getMapConfigs = function(userConfig){ return { toolSettings: { @@ -772,17 +795,17 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp } }; }; - + var getMapConfigsFromReportSuccess = function(data){ prepareReportToRun(rep.mergedReport); configureMap(data[0]); - + rep.getReportTime = moment.utc().format('YYYY-MM-DDTHH:mm:ss'); rep.mergedReport.additionalProperties = getUnitSettings(); - + reportRestService.executeWithoutSaving(rep.mergedReport).then(getVmsDataSuccess, getVmsDataError); }; - + var getMapConfigsFromReportFailure = function(error){ rep.loadReportHistory(); $anchorScroll(); @@ -836,7 +859,7 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp rep.reportsHistory.push(sectionShared); } }; - + $rootScope.$on('$stateChangeStart', function() { rep.hasAlert = false; }); From 8c3163c97ae608559cf8f0505681a7a8eb8f957e Mon Sep 17 00:00:00 2001 From: Nikos Paraskevopoulos Date: Wed, 21 Oct 2020 23:03:21 +0300 Subject: [PATCH 08/33] [UNIONVMS-4854] Corrections - we are in ES5 - and performance improvements --- .../app/service/reporting/reportService.js | 61 ++++++++++++------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/unionvms-web/app/service/reporting/reportService.js b/unionvms-web/app/service/reporting/reportService.js index 55e73f5db..84a63cc74 100644 --- a/unionvms-web/app/service/reporting/reportService.js +++ b/unionvms-web/app/service/reporting/reportService.js @@ -404,6 +404,17 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp return rep.positions; }; + function coordsEqual(c1, c2) { + return c1[0] === c2[0] && c1[1] === c2[1]; + } + + function mergeTrips(t1, t2) { + t2.forEach(function(tripId) { + if (t1.indexOf(tripId) < 0) { + t1.push(tripId); + } + }); + } //Get VMS data Success callback var getVmsDataSuccess = function(data){ @@ -415,27 +426,35 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp rep.criteria = data.criteria; //add tripIds to positions - rep.positions.forEach(pos => { - pos.tripIds = []; - let dtList = []; - data.trips.forEach(dt => { - if (dt.EXT_MARK === pos.properties.externalMarking && moment(pos.properties.positionTime).isBetween(dt.firstFishingActivityDateTime, dt.lastFishingActivityDateTime)) { - dtList.push(dt.tripId); - } - }) - pos.tripIds = dtList; - }) - - //add tripIds to segments - rep.segments.forEach(seg => { - seg.tripIds = [] - rep.positions.forEach(pos => { - seg.geometry.coordinates.forEach(c => { - if (JSON.stringify(c) === JSON.stringify(pos.geometry.coordinates)) - seg.tripIds = pos.tripIds; - }) - }) - }) + var tripsMap = data.trips.reduce(function(acc, trip) { + var key = trip.CFR + '|' + trip.EXT_MARK + '|' + trip.IRCS + '|' + trip.flagState; + acc[key] = (acc[key] || []); + acc[key].push(trip); + return acc; + }, {}); + var emptyArray = []; + rep.positions.forEach(function(pos) { + var p = pos.properties; + var key = p.cfr + '|' + p.externalMarking + '|' + p.ircs + '|' + p.countryCode; + var pTime = moment(pos.properties.positionTime); + pos.tripIds = (tripsMap[key] || emptyArray).reduce(function(acc, trip) { + if (pTime.isBetween(trip.firstFishingActivityDateTime, trip.lastFishingActivityDateTime)) { + acc.push(trip.tripId); + } + return acc; + }, []); + }); + + //add tripIds to segments + rep.segments.forEach(function(seg) { + seg.tripIds = []; + rep.positions.forEach(function(pos) { + seg.geometry.coordinates.forEach(function(c) { + if (coordsEqual(c, pos.geometry.coordinates)) + mergeTrips(seg.tripIds, pos.tripIds); + }); + }); + }); if(rep.reportType === 'standard'){ rep.loadReportHistory(); From 1b8ab6c66c0d4dbdc1395f5c912f9e6c0ae773df Mon Sep 17 00:00:00 2001 From: cpapatheodorou Date: Thu, 22 Oct 2020 12:00:23 +0300 Subject: [PATCH 09/33] [UNIONVMS-4725] Fix spatial server url --- .../configurations/spatialConfigModel.js | 945 +++++++++--------- .../app/service/spatial/mapFishModel.js | 24 +- 2 files changed, 493 insertions(+), 476 deletions(-) diff --git a/unionvms-web/app/partial/spatial/configurations/spatialConfigModel.js b/unionvms-web/app/partial/spatial/configurations/spatialConfigModel.js index 85ae70252..10e5ae35c 100644 --- a/unionvms-web/app/partial/spatial/configurations/spatialConfigModel.js +++ b/unionvms-web/app/partial/spatial/configurations/spatialConfigModel.js @@ -1,472 +1,473 @@ -/* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . -*/ -angular.module('unionvmsWeb').factory('SpatialConfig',function() { - - function SpatialConfig(){ - this.toolSettings = { - control: [], - tbControl: [] - }; - this.stylesSettings = { - positions: { - attribute: undefined, - style: {} - }, - segments: { - attribute: undefined, - style: {} - }, - alarms: { - size: undefined, - open: undefined, - closed: undefined, - pending: undefined, - none: undefined - } - }; - this.systemSettings = { - geoserverUrl: undefined, - bingApiKey: undefined - }; - this.layerSettings = { - additionalLayers: [], - areaLayers: [], - baseLayers: [], - portLayers: [] - - }; - this.mapSettings = { - mapProjectionId: undefined, - displayProjectionId: undefined, - coordinatesFormat: undefined, - scaleBarUnits: undefined, - refreshStatus: false, - refreshRate: undefined - }; - this.visibilitySettings = { - positions: { - table: {}, - popup: {}, - labels: {} - }, - segments: { - table: {}, - popup: {}, - labels: {} - }, - tracks: { - table: {} - } - }; - this.referenceDataSettings = {}; - } - - //Admin level configs - SpatialConfig.prototype.forAdminConfigFromJson = function(data, ports){ - var config = new SpatialConfig(); - - config.systemSettings = data.systemSettings; - config.mapSettings = data.mapSettings; - config.visibilitySettings = data.visibilitySettings; - config.stylesSettings = data.stylesSettings; - config.toolSettings = data.toolSettings; - config.layerSettings = data.layerSettings; - config.referenceDataSettings = data.referenceDataSettings; - - return config; - }; - - SpatialConfig.prototype.forAdminConfigToJson = function(form){ - var config = new SpatialConfig(); - - config = checkSystemSettings(this,config); - config = checkMapSettings(this,'admin',config,form.mapSettingsForm.$dirty); - config = checkStylesSettings(this,'admin',config,form.stylesSettingsForm.$dirty); - config = checkVisibilitySettings(this,'admin',config,form.visibilitySettingsForm.$dirty); - config = checkLayerSettings(this,'admin',config,form.layerSettingsForm.$dirty); - config = checkReferenceDataSettings(this,'admin',config,form.referenceDataSettingsForm.$dirty); - config.toolSettings = this.toolSettings; - - return angular.toJson(config); - }; - - //User level configs - SpatialConfig.prototype.forUserPrefFromJson = function(data){ - var config = new SpatialConfig(); - config.toolSettings = undefined; - config.systemSettings = undefined; - - if (angular.isDefined(data.mapSettings)){ - config.mapSettings = data.mapSettings; - } - - if (angular.isDefined(data.stylesSettings)){ - config.stylesSettings = data.stylesSettings; - } - - if (angular.isDefined(data.visibilitySettings)){ - config.visibilitySettings = data.visibilitySettings; - } - - if (angular.isDefined(data.layerSettings)){ - config.layerSettings = data.layerSettings; - } - - if (angular.isDefined(data.referenceDataSettings)){ - config.referenceDataSettings = data.referenceDataSettings; - } - - return config; - }; - - SpatialConfig.prototype.forUserPrefToServer = function(form){ - var config = new SpatialConfig(); - config.toolSettings = undefined; - config.systemSettings = undefined; - - config = checkMapSettings(this,'user',config,form.mapSettingsForm.$dirty); - config = checkStylesSettings(this,'user',config,form.stylesSettingsForm.$dirty); - config = checkVisibilitySettings(this,'user',config,form.visibilitySettingsForm.$dirty); - config = checkLayerSettings(this,'user',config,form.layerSettingsForm.$dirty); - config = checkReferenceDataSettings(this,'user',config,form.referenceDataSettingsForm.$dirty); - - return angular.toJson(config); - }; - - //Report level configs - SpatialConfig.prototype.forReportConfig = function(form,userConfig){ - var config = {}; - var formStatus = { - mapSettingsForm: angular.isDefined(form.mapSettingsForm) ? form.mapSettingsForm.$dirty : false, - stylesSettingsForm: angular.isDefined(form.stylesSettingsForm) ? form.stylesSettingsForm.$dirty : false, - visibilitySettings: angular.isDefined(form.visibilitySettings) ? form.visibilitySettings.$dirty : false, - layerSettingsForm: angular.isDefined(form.layerSettingsForm) ? form.layerSettingsForm.$dirty : false, - referenceDataSettingsForm: angular.isDefined(form.referenceDataSettingsForm) ? form.referenceDataSettingsForm.$dirty : false - }; - - if(userConfig.mapSettings.spatialConnectId !== this.mapSettings.spatialConnectId || userConfig.mapSettings.mapProjectionId !== this.mapSettings.mapProjectionId || - userConfig.mapSettings.displayProjectionId !== this.mapSettings.displayProjectionId || userConfig.mapSettings.coordinatesFormat !== this.mapSettings.coordinatesFormat || - userConfig.mapSettings.scaleBarUnits !== this.mapSettings.scaleBarUnits || formStatus.mapSettingsForm){ - config = checkMapSettings(this,'report',config,formStatus.mapSettingsForm); - }else{ - config.mapSettings = {}; - } - - if(!angular.equals(userConfig.stylesSettings,this.stylesSettings) || formStatus.stylesSettingsForm){ - config.mapSettings = checkStylesSettings(this,'report',config.mapSettings,formStatus.stylesSettingsForm); - } - - if(!angular.equals(userConfig.visibilitySettings.positions,this.visibilitySettings.positions) || - !angular.equals(userConfig.visibilitySettings.segments,this.visibilitySettings.segments) || - !angular.equals(userConfig.visibilitySettings.tracks,this.visibilitySettings.tracks) || - formStatus.visibilitySettingsForm){ - config.mapSettings = checkVisibilitySettings(this,'report',config.mapSettings,formStatus.visibilitySettingsForm); - } - - removeLayerHashKeys(this.layerSettings); - fixIndividualUserAreas(userConfig.layerSettings); - fixIndividualUserAreas(this.layerSettings); - if((!angular.equals(userConfig.layerSettings,this.layerSettings) || formStatus.layerSettingsForm) && !this.layerSettings.reseted){ - config.mapSettings = checkLayerSettings(this,'report',config.mapSettings,formStatus.layerSettingsForm); - } - - if(!angular.equals(userConfig.referenceDataSettings,this.referenceDataSettings) || formStatus.referenceDataSettingsForm){ - config.mapSettings = checkReferenceDataSettings(this,'report',config.mapSettings,formStatus.referenceDataSettingsForm); - } - - return config; - }; - - //Used in the report form map configuration modal - SpatialConfig.prototype.forReportConfigFromJson = function(data){ - var config = new SpatialConfig(); - config.toolSettings = undefined; - config.systemSettings = undefined; - - if (angular.isDefined(data)){ - config.mapSettings = {}; - config.mapSettings.spatialConnectId = data.spatialConnectId; - config.mapSettings.mapProjectionId = data.mapProjectionId; - config.mapSettings.displayProjectionId = data.displayProjectionId; - config.mapSettings.coordinatesFormat = data.coordinatesFormat; - config.mapSettings.scaleBarUnits = data.scaleBarUnits; - - if (angular.isDefined(data.stylesSettings)){ - config.stylesSettings = data.stylesSettings; - } - - if (angular.isDefined(data.visibilitySettings)){ - config.visibilitySettings = data.visibilitySettings; - } - - if (angular.isDefined(data.layerSettings)){ - config.layerSettings = data.layerSettings; - } - - if (angular.isDefined(data.referenceDataSettings)){ - config.referenceDataSettings = data.referenceDataSettings; - } - } - - return config; - }; - - var checkSystemSettings = function(model,config){ - //Validate geoserver URL - if (angular.isDefined(model.systemSettings.geoserverUrl)){ - var lastLetter = model.systemSettings.geoserverUrl.substr(model.systemSettings.geoserverUrl.length - 1); - if (lastLetter !== '/'){ - model.systemSettings.geoserverUrl += '/'; - } - } - config.systemSettings = model.systemSettings; - return config; - }; - - var checkMapSettings = function(model,settingsLevel,config,changed){ - if(!changed && model.mapSettings && model.mapSettings.reseted){ - config.mapSettings = undefined; - }else if(changed && model.mapSettings){ - config.mapSettings = {}; - if(settingsLevel !== 'report'){ - config.mapSettings.refreshStatus = model.mapSettings.refreshStatus; - config.mapSettings.refreshRate = model.mapSettings.refreshRate; - } - config.mapSettings.spatialConnectId = model.mapSettings.spatialConnectId; - config.mapSettings.mapProjectionId = model.mapSettings.mapProjectionId; - config.mapSettings.displayProjectionId = model.mapSettings.displayProjectionId; - config.mapSettings.coordinatesFormat = model.mapSettings.coordinatesFormat; - config.mapSettings.scaleBarUnits = model.mapSettings.scaleBarUnits; - }else if(!changed){ - if(settingsLevel === 'user'){ - config.mapSettings = undefined; - }else{ - config.mapSettings = {}; - if(settingsLevel === 'admin'){ - config.mapSettings.refreshStatus = model.mapSettings.refreshStatus; - config.mapSettings.refreshRate = model.mapSettings.refreshRate; - } - config.mapSettings.spatialConnectId = model.mapSettings.spatialConnectId; - config.mapSettings.mapProjectionId = model.mapSettings.mapProjectionId; - config.mapSettings.displayProjectionId = model.mapSettings.displayProjectionId; - config.mapSettings.coordinatesFormat = model.mapSettings.coordinatesFormat; - config.mapSettings.scaleBarUnits = model.mapSettings.scaleBarUnits; - } - } - - if(settingsLevel === 'report' && !angular.isDefined(config.mapSettings)){ - config.mapSettings = {}; - } - - return config; - }; - - var checkStylesSettings = function(model,settingsLevel,config,changed){ - if(!changed && model.stylesSettings && model.stylesSettings.reseted){ - config.stylesSettings = undefined; - }else if(changed && model.stylesSettings){ - config.stylesSettings = {}; - var styleTypes = ['position','segment','alarm']; - - angular.forEach(styleTypes,function(item){ - if (angular.isDefined(model[item + 'Style'])){ - var properties = {}; - - if(item==='alarm'){ - properties.size = model.alarmStyle.size; - for (var i = 0; i < model.alarmStyle.style.length; i++){ - properties[model.alarmStyle.style[i].id] = model.alarmStyle.style[i].color; - } - }else{ - properties.attribute = model[item + 'Style'].attribute; - properties.style = {}; - - if(item==='segment'){ - properties.style.lineStyle = model.segmentStyle.lineStyle; - properties.style.lineWidth = model.segmentStyle.lineWidth; - } - - switch (properties.attribute) { - case "speedOverGround": - case "distance": - case "duration": - case "courseOverGround": - case "reportedSpeed": - case "calculatedSpeed": - case "reportedCourse": - angular.forEach(model[item + 'Style'].style, function(item){ - properties.style[item.propertyFrom + "-" + item.propertyTo] = item.color; - }); - properties.style["default"] = model[item + 'Style'].defaultColor; - break; - case "countryCode": - angular.forEach(model[item + 'Style'].style, function(item){ - properties.style[item.code] = item.color; - }); - break; - case "activity": - case "type": - case "segmentCategory": - angular.forEach(model[item + 'Style'].style, function(item){ - properties.style[item.code] = item.color; - }); - properties.style["default"] = model[item + 'Style'].defaultColor; - break; - default: - break; - } - } - config.stylesSettings[item + 's'] = properties; - } - }); - }else if(!changed){ - if(settingsLevel === 'user'){ - config.stylesSettings = undefined; - }else{ - config.stylesSettings = model.stylesSettings; - delete config.stylesSettings.positionStyle; - delete config.stylesSettings.segmentStyle; - delete config.stylesSettings.alarmStyle; - } - } - - return config; - }; - - var checkVisibilitySettings = function(model,settingsLevel,config,changed){ - var visibilityTypes = ['position','segment','track']; - var contentTypes = ['Table','Popup','Label']; - if(!changed && (model.visibilitySettings && model.visibilitySettings.reseted || settingsLevel === 'user')){ - config.visibilitySettings = undefined; - }else if((changed && model.visibilitySettings) || (!changed && settingsLevel !== 'user')){ - config.visibilitySettings = {}; - angular.forEach(visibilityTypes, function(visibType) { - config.visibilitySettings[visibType + 's'] = {}; - angular.forEach(contentTypes, function(contentType) { - config.visibilitySettings[visibType + 's'][contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()] = []; - if(visibType !== 'track' || visibType === 'track' && contentType === 'Table'){ - var visibilityCurrentSettings = model.visibilitySettings[visibType + 's'][contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; - var visibilityCurrentAttrs = model.visibilitySettings[visibType + contentType + 'Attrs']; - var visibilities = {}; - visibilities.values = []; - visibilities.order = []; - visibilities.isAttributeVisible = visibilityCurrentSettings.isAttributeVisible; - var content; - for(var i = 0; i < visibilityCurrentAttrs.length; i++){ - visibilities.order.push(visibilityCurrentAttrs[i].value); - } - - if(angular.isDefined(visibilityCurrentSettings.values)){ - for(var j = 0; j < visibilities.order.length; j++){ - if(visibilityCurrentSettings.values.indexOf(visibilities.order[j]) !== -1){ - visibilities.values.push(visibilities.order[j]); - } - } - angular.copy(visibilities,visibilityCurrentSettings); - } - } - config.visibilitySettings[visibType + 's'][contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()] = - model.visibilitySettings[visibType + 's'][contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; - //delete config.visibilitySettings[visibType + contentType + 'Attrs']; - }); - }); - } - - if (angular.isDefined(config.visibilitySettings)){ - angular.forEach(visibilityTypes, function(visibType){ - angular.forEach(contentTypes, function(contentType){ - delete config.visibilitySettings[visibType + contentType + 'Attrs']; - }); - }); - } - - return config; - }; - - - var checkLayerSettings = function(model,settingsLevel,config,changed){ - if(settingsLevel === 'report'){ - config.layerSettings = model.layerSettings; - }else if(!changed && (model.layerSettings && model.layerSettings.reseted || settingsLevel === 'user')){ - config.layerSettings = undefined; - }else if((changed && model.layerSettings) || (!changed && settingsLevel !== 'user')){ - config.layerSettings = {}; - var layerTypes = ['port','area','additional','base']; - - angular.forEach(layerTypes,function(item){ - if(angular.isDefined(model.layerSettings[item + 'Layers']) && !_.isEmpty(model.layerSettings[item + 'Layers'])){ - var layers = []; - angular.forEach(model.layerSettings[item + 'Layers'], function(value,key) { - var layer; - if(item === 'area'){ - switch (value.areaType) { - case 'sysarea': - layer = {'serviceLayerId': value.serviceLayerId, 'areaType': value.areaType, 'order': key}; - break; - case 'userarea': - layer = {'serviceLayerId': value.serviceLayerId, 'areaType': value.areaType, 'gid': value.gid, 'order': key}; - break; - case 'areagroup': - layer = {'serviceLayerId': value.serviceLayerId, 'areaType': value.areaType, 'areaGroupName': value.name, 'order': key}; - break; - } - }else{ - layer = {'serviceLayerId': value.serviceLayerId, 'order': key}; - } - layers.push(layer); - }); - config.layerSettings[item + 'Layers'] = []; - angular.copy(layers,config.layerSettings[item + 'Layers']); - }else{ - config.layerSettings[item + 'Layers'] = undefined; - } - }); - } - return config; - }; - - var checkReferenceDataSettings = function(model,settingsLevel,config,changed){ - if(!changed && (model.referenceDataSettings && model.referenceDataSettings.reseted || settingsLevel === 'user')){ - config.referenceDataSettings = undefined; - }else if((changed && model.referenceDataSettings) || (!changed && settingsLevel !== 'user')){ - config.referenceDataSettings = model.referenceDataSettings; - } - return config; - }; - - var sortArray = function(data){ - var temp = _.clone(data); - temp.sort(); - - return temp; - }; - - var fixIndividualUserAreas = function (layerSettings){ - if (angular.isDefined(layerSettings.areaLayers) && layerSettings.areaLayers.length > 0){ - angular.forEach(layerSettings.areaLayers, function(item) { - if (item.areaType === 'userarea'){ - item.name = item.areaName; - } - }, layerSettings.areaLayers); - } - }; - - var removeLayerHashKeys = function(obj){ - angular.forEach(obj, function(type) { - angular.forEach(type, function(item) { - delete item.$$hashKey; - }); - }); - }; - - return SpatialConfig; -}); +/* +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . +*/ +angular.module('unionvmsWeb').factory('SpatialConfig',function() { + + function SpatialConfig(){ + this.toolSettings = { + control: [], + tbControl: [] + }; + this.stylesSettings = { + positions: { + attribute: undefined, + style: {} + }, + segments: { + attribute: undefined, + style: {} + }, + alarms: { + size: undefined, + open: undefined, + closed: undefined, + pending: undefined, + none: undefined + } + }; + this.systemSettings = { + geoserverUrl: undefined, + bingApiKey: undefined, + spatialServerUrl: undefined + }; + this.layerSettings = { + additionalLayers: [], + areaLayers: [], + baseLayers: [], + portLayers: [] + + }; + this.mapSettings = { + mapProjectionId: undefined, + displayProjectionId: undefined, + coordinatesFormat: undefined, + scaleBarUnits: undefined, + refreshStatus: false, + refreshRate: undefined + }; + this.visibilitySettings = { + positions: { + table: {}, + popup: {}, + labels: {} + }, + segments: { + table: {}, + popup: {}, + labels: {} + }, + tracks: { + table: {} + } + }; + this.referenceDataSettings = {}; + } + + //Admin level configs + SpatialConfig.prototype.forAdminConfigFromJson = function(data, ports){ + var config = new SpatialConfig(); + + config.systemSettings = data.systemSettings; + config.mapSettings = data.mapSettings; + config.visibilitySettings = data.visibilitySettings; + config.stylesSettings = data.stylesSettings; + config.toolSettings = data.toolSettings; + config.layerSettings = data.layerSettings; + config.referenceDataSettings = data.referenceDataSettings; + + return config; + }; + + SpatialConfig.prototype.forAdminConfigToJson = function(form){ + var config = new SpatialConfig(); + + config = checkSystemSettings(this,config); + config = checkMapSettings(this,'admin',config,form.mapSettingsForm.$dirty); + config = checkStylesSettings(this,'admin',config,form.stylesSettingsForm.$dirty); + config = checkVisibilitySettings(this,'admin',config,form.visibilitySettingsForm.$dirty); + config = checkLayerSettings(this,'admin',config,form.layerSettingsForm.$dirty); + config = checkReferenceDataSettings(this,'admin',config,form.referenceDataSettingsForm.$dirty); + config.toolSettings = this.toolSettings; + + return angular.toJson(config); + }; + + //User level configs + SpatialConfig.prototype.forUserPrefFromJson = function(data){ + var config = new SpatialConfig(); + config.toolSettings = undefined; + config.systemSettings = undefined; + + if (angular.isDefined(data.mapSettings)){ + config.mapSettings = data.mapSettings; + } + + if (angular.isDefined(data.stylesSettings)){ + config.stylesSettings = data.stylesSettings; + } + + if (angular.isDefined(data.visibilitySettings)){ + config.visibilitySettings = data.visibilitySettings; + } + + if (angular.isDefined(data.layerSettings)){ + config.layerSettings = data.layerSettings; + } + + if (angular.isDefined(data.referenceDataSettings)){ + config.referenceDataSettings = data.referenceDataSettings; + } + + return config; + }; + + SpatialConfig.prototype.forUserPrefToServer = function(form){ + var config = new SpatialConfig(); + config.toolSettings = undefined; + config.systemSettings = undefined; + + config = checkMapSettings(this,'user',config,form.mapSettingsForm.$dirty); + config = checkStylesSettings(this,'user',config,form.stylesSettingsForm.$dirty); + config = checkVisibilitySettings(this,'user',config,form.visibilitySettingsForm.$dirty); + config = checkLayerSettings(this,'user',config,form.layerSettingsForm.$dirty); + config = checkReferenceDataSettings(this,'user',config,form.referenceDataSettingsForm.$dirty); + + return angular.toJson(config); + }; + + //Report level configs + SpatialConfig.prototype.forReportConfig = function(form,userConfig){ + var config = {}; + var formStatus = { + mapSettingsForm: angular.isDefined(form.mapSettingsForm) ? form.mapSettingsForm.$dirty : false, + stylesSettingsForm: angular.isDefined(form.stylesSettingsForm) ? form.stylesSettingsForm.$dirty : false, + visibilitySettings: angular.isDefined(form.visibilitySettings) ? form.visibilitySettings.$dirty : false, + layerSettingsForm: angular.isDefined(form.layerSettingsForm) ? form.layerSettingsForm.$dirty : false, + referenceDataSettingsForm: angular.isDefined(form.referenceDataSettingsForm) ? form.referenceDataSettingsForm.$dirty : false + }; + + if(userConfig.mapSettings.spatialConnectId !== this.mapSettings.spatialConnectId || userConfig.mapSettings.mapProjectionId !== this.mapSettings.mapProjectionId || + userConfig.mapSettings.displayProjectionId !== this.mapSettings.displayProjectionId || userConfig.mapSettings.coordinatesFormat !== this.mapSettings.coordinatesFormat || + userConfig.mapSettings.scaleBarUnits !== this.mapSettings.scaleBarUnits || formStatus.mapSettingsForm){ + config = checkMapSettings(this,'report',config,formStatus.mapSettingsForm); + }else{ + config.mapSettings = {}; + } + + if(!angular.equals(userConfig.stylesSettings,this.stylesSettings) || formStatus.stylesSettingsForm){ + config.mapSettings = checkStylesSettings(this,'report',config.mapSettings,formStatus.stylesSettingsForm); + } + + if(!angular.equals(userConfig.visibilitySettings.positions,this.visibilitySettings.positions) || + !angular.equals(userConfig.visibilitySettings.segments,this.visibilitySettings.segments) || + !angular.equals(userConfig.visibilitySettings.tracks,this.visibilitySettings.tracks) || + formStatus.visibilitySettingsForm){ + config.mapSettings = checkVisibilitySettings(this,'report',config.mapSettings,formStatus.visibilitySettingsForm); + } + + removeLayerHashKeys(this.layerSettings); + fixIndividualUserAreas(userConfig.layerSettings); + fixIndividualUserAreas(this.layerSettings); + if((!angular.equals(userConfig.layerSettings,this.layerSettings) || formStatus.layerSettingsForm) && !this.layerSettings.reseted){ + config.mapSettings = checkLayerSettings(this,'report',config.mapSettings,formStatus.layerSettingsForm); + } + + if(!angular.equals(userConfig.referenceDataSettings,this.referenceDataSettings) || formStatus.referenceDataSettingsForm){ + config.mapSettings = checkReferenceDataSettings(this,'report',config.mapSettings,formStatus.referenceDataSettingsForm); + } + + return config; + }; + + //Used in the report form map configuration modal + SpatialConfig.prototype.forReportConfigFromJson = function(data){ + var config = new SpatialConfig(); + config.toolSettings = undefined; + config.systemSettings = undefined; + + if (angular.isDefined(data)){ + config.mapSettings = {}; + config.mapSettings.spatialConnectId = data.spatialConnectId; + config.mapSettings.mapProjectionId = data.mapProjectionId; + config.mapSettings.displayProjectionId = data.displayProjectionId; + config.mapSettings.coordinatesFormat = data.coordinatesFormat; + config.mapSettings.scaleBarUnits = data.scaleBarUnits; + + if (angular.isDefined(data.stylesSettings)){ + config.stylesSettings = data.stylesSettings; + } + + if (angular.isDefined(data.visibilitySettings)){ + config.visibilitySettings = data.visibilitySettings; + } + + if (angular.isDefined(data.layerSettings)){ + config.layerSettings = data.layerSettings; + } + + if (angular.isDefined(data.referenceDataSettings)){ + config.referenceDataSettings = data.referenceDataSettings; + } + } + + return config; + }; + + var checkSystemSettings = function(model,config){ + //Validate geoserver URL + if (angular.isDefined(model.systemSettings.geoserverUrl)){ + var lastLetter = model.systemSettings.geoserverUrl.substr(model.systemSettings.geoserverUrl.length - 1); + if (lastLetter !== '/'){ + model.systemSettings.geoserverUrl += '/'; + } + } + config.systemSettings = model.systemSettings; + return config; + }; + + var checkMapSettings = function(model,settingsLevel,config,changed){ + if(!changed && model.mapSettings && model.mapSettings.reseted){ + config.mapSettings = undefined; + }else if(changed && model.mapSettings){ + config.mapSettings = {}; + if(settingsLevel !== 'report'){ + config.mapSettings.refreshStatus = model.mapSettings.refreshStatus; + config.mapSettings.refreshRate = model.mapSettings.refreshRate; + } + config.mapSettings.spatialConnectId = model.mapSettings.spatialConnectId; + config.mapSettings.mapProjectionId = model.mapSettings.mapProjectionId; + config.mapSettings.displayProjectionId = model.mapSettings.displayProjectionId; + config.mapSettings.coordinatesFormat = model.mapSettings.coordinatesFormat; + config.mapSettings.scaleBarUnits = model.mapSettings.scaleBarUnits; + }else if(!changed){ + if(settingsLevel === 'user'){ + config.mapSettings = undefined; + }else{ + config.mapSettings = {}; + if(settingsLevel === 'admin'){ + config.mapSettings.refreshStatus = model.mapSettings.refreshStatus; + config.mapSettings.refreshRate = model.mapSettings.refreshRate; + } + config.mapSettings.spatialConnectId = model.mapSettings.spatialConnectId; + config.mapSettings.mapProjectionId = model.mapSettings.mapProjectionId; + config.mapSettings.displayProjectionId = model.mapSettings.displayProjectionId; + config.mapSettings.coordinatesFormat = model.mapSettings.coordinatesFormat; + config.mapSettings.scaleBarUnits = model.mapSettings.scaleBarUnits; + } + } + + if(settingsLevel === 'report' && !angular.isDefined(config.mapSettings)){ + config.mapSettings = {}; + } + + return config; + }; + + var checkStylesSettings = function(model,settingsLevel,config,changed){ + if(!changed && model.stylesSettings && model.stylesSettings.reseted){ + config.stylesSettings = undefined; + }else if(changed && model.stylesSettings){ + config.stylesSettings = {}; + var styleTypes = ['position','segment','alarm']; + + angular.forEach(styleTypes,function(item){ + if (angular.isDefined(model[item + 'Style'])){ + var properties = {}; + + if(item==='alarm'){ + properties.size = model.alarmStyle.size; + for (var i = 0; i < model.alarmStyle.style.length; i++){ + properties[model.alarmStyle.style[i].id] = model.alarmStyle.style[i].color; + } + }else{ + properties.attribute = model[item + 'Style'].attribute; + properties.style = {}; + + if(item==='segment'){ + properties.style.lineStyle = model.segmentStyle.lineStyle; + properties.style.lineWidth = model.segmentStyle.lineWidth; + } + + switch (properties.attribute) { + case "speedOverGround": + case "distance": + case "duration": + case "courseOverGround": + case "reportedSpeed": + case "calculatedSpeed": + case "reportedCourse": + angular.forEach(model[item + 'Style'].style, function(item){ + properties.style[item.propertyFrom + "-" + item.propertyTo] = item.color; + }); + properties.style["default"] = model[item + 'Style'].defaultColor; + break; + case "countryCode": + angular.forEach(model[item + 'Style'].style, function(item){ + properties.style[item.code] = item.color; + }); + break; + case "activity": + case "type": + case "segmentCategory": + angular.forEach(model[item + 'Style'].style, function(item){ + properties.style[item.code] = item.color; + }); + properties.style["default"] = model[item + 'Style'].defaultColor; + break; + default: + break; + } + } + config.stylesSettings[item + 's'] = properties; + } + }); + }else if(!changed){ + if(settingsLevel === 'user'){ + config.stylesSettings = undefined; + }else{ + config.stylesSettings = model.stylesSettings; + delete config.stylesSettings.positionStyle; + delete config.stylesSettings.segmentStyle; + delete config.stylesSettings.alarmStyle; + } + } + + return config; + }; + + var checkVisibilitySettings = function(model,settingsLevel,config,changed){ + var visibilityTypes = ['position','segment','track']; + var contentTypes = ['Table','Popup','Label']; + if(!changed && (model.visibilitySettings && model.visibilitySettings.reseted || settingsLevel === 'user')){ + config.visibilitySettings = undefined; + }else if((changed && model.visibilitySettings) || (!changed && settingsLevel !== 'user')){ + config.visibilitySettings = {}; + angular.forEach(visibilityTypes, function(visibType) { + config.visibilitySettings[visibType + 's'] = {}; + angular.forEach(contentTypes, function(contentType) { + config.visibilitySettings[visibType + 's'][contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()] = []; + if(visibType !== 'track' || visibType === 'track' && contentType === 'Table'){ + var visibilityCurrentSettings = model.visibilitySettings[visibType + 's'][contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; + var visibilityCurrentAttrs = model.visibilitySettings[visibType + contentType + 'Attrs']; + var visibilities = {}; + visibilities.values = []; + visibilities.order = []; + visibilities.isAttributeVisible = visibilityCurrentSettings.isAttributeVisible; + var content; + for(var i = 0; i < visibilityCurrentAttrs.length; i++){ + visibilities.order.push(visibilityCurrentAttrs[i].value); + } + + if(angular.isDefined(visibilityCurrentSettings.values)){ + for(var j = 0; j < visibilities.order.length; j++){ + if(visibilityCurrentSettings.values.indexOf(visibilities.order[j]) !== -1){ + visibilities.values.push(visibilities.order[j]); + } + } + angular.copy(visibilities,visibilityCurrentSettings); + } + } + config.visibilitySettings[visibType + 's'][contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()] = + model.visibilitySettings[visibType + 's'][contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; + //delete config.visibilitySettings[visibType + contentType + 'Attrs']; + }); + }); + } + + if (angular.isDefined(config.visibilitySettings)){ + angular.forEach(visibilityTypes, function(visibType){ + angular.forEach(contentTypes, function(contentType){ + delete config.visibilitySettings[visibType + contentType + 'Attrs']; + }); + }); + } + + return config; + }; + + + var checkLayerSettings = function(model,settingsLevel,config,changed){ + if(settingsLevel === 'report'){ + config.layerSettings = model.layerSettings; + }else if(!changed && (model.layerSettings && model.layerSettings.reseted || settingsLevel === 'user')){ + config.layerSettings = undefined; + }else if((changed && model.layerSettings) || (!changed && settingsLevel !== 'user')){ + config.layerSettings = {}; + var layerTypes = ['port','area','additional','base']; + + angular.forEach(layerTypes,function(item){ + if(angular.isDefined(model.layerSettings[item + 'Layers']) && !_.isEmpty(model.layerSettings[item + 'Layers'])){ + var layers = []; + angular.forEach(model.layerSettings[item + 'Layers'], function(value,key) { + var layer; + if(item === 'area'){ + switch (value.areaType) { + case 'sysarea': + layer = {'serviceLayerId': value.serviceLayerId, 'areaType': value.areaType, 'order': key}; + break; + case 'userarea': + layer = {'serviceLayerId': value.serviceLayerId, 'areaType': value.areaType, 'gid': value.gid, 'order': key}; + break; + case 'areagroup': + layer = {'serviceLayerId': value.serviceLayerId, 'areaType': value.areaType, 'areaGroupName': value.name, 'order': key}; + break; + } + }else{ + layer = {'serviceLayerId': value.serviceLayerId, 'order': key}; + } + layers.push(layer); + }); + config.layerSettings[item + 'Layers'] = []; + angular.copy(layers,config.layerSettings[item + 'Layers']); + }else{ + config.layerSettings[item + 'Layers'] = undefined; + } + }); + } + return config; + }; + + var checkReferenceDataSettings = function(model,settingsLevel,config,changed){ + if(!changed && (model.referenceDataSettings && model.referenceDataSettings.reseted || settingsLevel === 'user')){ + config.referenceDataSettings = undefined; + }else if((changed && model.referenceDataSettings) || (!changed && settingsLevel !== 'user')){ + config.referenceDataSettings = model.referenceDataSettings; + } + return config; + }; + + var sortArray = function(data){ + var temp = _.clone(data); + temp.sort(); + + return temp; + }; + + var fixIndividualUserAreas = function (layerSettings){ + if (angular.isDefined(layerSettings.areaLayers) && layerSettings.areaLayers.length > 0){ + angular.forEach(layerSettings.areaLayers, function(item) { + if (item.areaType === 'userarea'){ + item.name = item.areaName; + } + }, layerSettings.areaLayers); + } + }; + + var removeLayerHashKeys = function(obj){ + angular.forEach(obj, function(type) { + angular.forEach(type, function(item) { + delete item.$$hashKey; + }); + }); + }; + + return SpatialConfig; +}); diff --git a/unionvms-web/app/service/spatial/mapFishModel.js b/unionvms-web/app/service/spatial/mapFishModel.js index e098eb6ba..7ca8f3989 100644 --- a/unionvms-web/app/service/spatial/mapFishModel.js +++ b/unionvms-web/app/service/spatial/mapFishModel.js @@ -13,6 +13,8 @@ angular.module('unionvmsWeb').factory('MapFish',function() { var model = { + spatialServerUrl: undefined, + isDeployed : false, jobStatusData : { @@ -52,6 +54,10 @@ angular.module('unionvmsWeb').factory('MapFish',function() { printMapSize: [], + initSpatialServerUrl: function(spatialServerUrl) { + model.spatialServerUrl = spatialServerUrl; + }, + reset: function(){ model.templates = []; model.layouts = []; @@ -126,7 +132,12 @@ angular.module('unionvmsWeb').factory('MapFish',function() { return model; }) -.factory('MapFishPayload',function(locale, $location, Color, MapFish, mapService, mapFishPrintRestService, unitConversionService, projectionService, coordinateFormatService){ +.factory('MapFishPayload',function(locale, $location, Color, MapFish, mapService, mapFishPrintRestService, unitConversionService, projectionService, coordinateFormatService, spatialConfigRestService){ + + spatialConfigRestService.getAdminConfigs().then(function(configs) { + this.spatialServerUrl = configs.systemSettings.spatialServerUrl; + }); + function mapFishPayload(){ this.layout = undefined; this.attributes = {}; @@ -334,9 +345,14 @@ angular.module('unionvmsWeb').factory('MapFish',function() { }; var getUrl = function(){ - var url = $location.protocol() + '://' + $location.host(); - if ($location.port() !== 80){ - url += ':' + $location.port(); + var url = null; + if (this.spatialServerUrl) { + url = this.spatialServerUrl; + } else { + var url = $location.protocol() + '://' + $location.host(); + if ($location.port() !== 80){ + url += ':' + $location.port(); + } } return url; From 932c03c79ad5603906d0375ff361b6d4dc426550 Mon Sep 17 00:00:00 2001 From: gmanifavas Date: Mon, 28 Sep 2020 14:05:25 +0300 Subject: [PATCH 10/33] [UNIONVMS-4738] Import area from gml file. --- unionvms-web/app/i18n/en-gb/areas.lang.json | 1 + .../areas/uploadAreaModal/uploadAreaModal.js | 602 +++++++++--------- 2 files changed, 319 insertions(+), 284 deletions(-) diff --git a/unionvms-web/app/i18n/en-gb/areas.lang.json b/unionvms-web/app/i18n/en-gb/areas.lang.json index 0ec2d9c50..e0dd3ef44 100644 --- a/unionvms-web/app/i18n/en-gb/areas.lang.json +++ b/unionvms-web/app/i18n/en-gb/areas.lang.json @@ -84,6 +84,7 @@ "area_upload_modal_parsing_error": "There was an error while parsing your file. Please check if your file and settings are correct and try again.", "area_upload_modal_invalid_polygon": "Your uploaded polygon is not valid. Please fix your data and try to upload again.", "area_upload_modal_parsing_error_wkt": "There was an error while parsing your file. Please check that your WKT file is valid.", + "area_upload_modal_parsing_error_gml": "There was an error while parsing your file. Please check that your GML file is valid.", "area_upload_modal_wkt_no_polygon": "Only POLYGON geometries are supported.", "area_upload_modal_wkt_no_multipolygon": "You have provided a MULTIPOLYGON geometry. Parsing this is possible but it will only extract the first POLYGON geometry.", "area_upload_modal_form_errors": "There are errors in your settings. Please fix them and try again.", diff --git a/unionvms-web/app/partial/areas/uploadAreaModal/uploadAreaModal.js b/unionvms-web/app/partial/areas/uploadAreaModal/uploadAreaModal.js index 01ce55906..ffb1e1cbf 100644 --- a/unionvms-web/app/partial/areas/uploadAreaModal/uploadAreaModal.js +++ b/unionvms-web/app/partial/areas/uploadAreaModal/uploadAreaModal.js @@ -1,285 +1,319 @@ /* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . -*/ -angular.module('unionvmsWeb').controller('UploadareamodalCtrl',function($scope, $modalInstance, locale, FileUploader, projectionService, srcProjections, defaultProjection, $timeout){ - $scope.hasError = false; - $scope.hasWarning = false; - $scope.errorMessage = undefined; - $scope.isMulti = false; - - $scope.uploader = new FileUploader(); - $scope.reader = new FileReader(); - $scope.srcProjections = srcProjections; - $scope.projections = projectionService; - $scope.defaultProjection = defaultProjection; //This is an array like [1, 'EPSG:4326'] - - if ($scope.projections.items.length > 0){ - $scope.selProjection = defaultProjection[0]; - } - - //Uploader Filters and events - $scope.uploader.filters.push({ - name: 'singleUpload', - fn: function(item){ - if (this.queue.length > 0){ - this.queue.pop(); - } - return item; - } - }); - - $scope.uploader.filters.push({ - name: 'fileExtension', - fn: function(item){ - var supportedTypes = ['csv', 'txt', 'wkt']; - var splitedItemName = item.name.split('.'); - - for (var i = 0; i < supportedTypes.length; i++){ - if (supportedTypes[i].toLowerCase() === splitedItemName[splitedItemName.length - 1].toLowerCase()){ - return item; - } - } - } - }); - - //Read uploaded file contents - $scope.uploader.onAfterAddingFile = function(item) { - $scope.isFileLoading = true; - try { - $scope.reader.readAsText(item._file); - } catch (e) { - $scope.fileCommitted = true; - $scope.fileReadingSuccess = false; - $scope.isFileLoading = false; - } - }; - - //Set intial status - $scope.setStatus = function(){ - $scope.fileCommitted = false; - $scope.isFileLoading = false; - $scope.fileReadingSuccess = true; - if ($scope.uploader.queue.length > 0){ - $scope.uploader.clearQueue(); - $scope.fileContent = undefined; - } - }; - $scope.setStatus(); - - //Reader events - $scope.reader.onloadend = function(){ - $scope.fileContent = $scope.reader.result; - $scope.isFileLoading = false; - $scope.fileReadingSuccess = true; - $scope.fileCommitted = true; - }; - - //Format combobox - $scope.format = 'csv'; - $scope.formatItems = []; - $scope.formatItems.push({"text": locale.getString('areas.area_upload_modal_csv'), "code": "csv"}); - $scope.formatItems.push({"text": locale.getString('areas.area_upload_modal_wkt'), "code": "wkt"}); - //$scope.formatItems.push({"text": locale.getString('areas.area_upload_modal_gml'), "code": "gml"}); - - //CSV stuff - $scope.containsFirstRow = false; - - //CSV delimiters combobox - $scope.delimiter = ','; - $scope.delimiterItems = []; - $scope.delimiterItems.push({"text": locale.getString('areas.area_upload_modal_comma'), "code": ","}); - $scope.delimiterItems.push({"text": locale.getString('areas.area_upload_modal_semicolon'), "code": ";"}); - $scope.delimiterItems.push({"text": locale.getString('areas.area_upload_modal_colon'), "code": ":"}); - - //CSV parser - $scope.parseCSV = function(){ - var lines = $scope.fileContent.split('\n'); - var columns = lines[0].split($scope.delimiter).length; - - var start = 0; - var headers = []; - if ($scope.containsFirstRow){ - headers = lines[0].split($scope.delimiter); - start = 1; - } else { - if (columns !== 2){ - $scope.errorMessage = locale.getString('areas.area_upload_modal_only_two_columns'); - $scope.setError(); - return; - } - } - - var coords = []; - for (var i = start; i < lines.length; i++){ - var currentLine = lines[i].split(new RegExp($scope.delimiter+'(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)')); - if (currentLine.length === columns){ - var x,y; - if (!$scope.containsFirstRow){ - x = parseFloat(currentLine[0]); - y = parseFloat(currentLine[1]); - } else { - for (var j = 0; j < headers.length; j++){ - if (headers[j].trim() === $scope.xField.trim()){ - x = parseFloat(currentLine[j]); - } else if (headers[j].trim() === $scope.yField.trim()){ - y = parseFloat(currentLine[j]); - } - } - } - if (!isNaN(x) && !isNaN(y)){ - coords.push([x,y]); - } - } - } - - if (coords.length !== 0){ - //Lets validate if last pair of coordinates is the same as the first and if not we add it - var firstCoord = coords[0]; - var lastCoord = coords[coords.length - 1]; - var diff = _.difference(firstCoord, lastCoord); - - if (diff.length > 0){ - coords.push(firstCoord); - } - - //Build geometry - var geom = new ol.geom.Polygon(); - geom.setCoordinates([coords]); - - if (geom.getArea() === 0){ - $scope.errorMessage = locale.getString('areas.area_upload_modal_invalid_polygon'); - $scope.setError(); - return; - } else { - geom = $scope.checkAndWarpGeometry(geom); - return geom; - } - } else { - $scope.errorMessage = locale.getString('areas.area_upload_modal_parsing_error'); - $scope.setError(); - return; - } - }; - - //WKT Parser - $scope.parseWKT = function(){ - $scope.isMulti = false; - if ($scope.fileContent.indexOf('POLYGON') === -1){ - $scope.errorMessage = locale.getString('areas.area_upload_modal_wkt_no_polygon'); - $scope.setError(); - return; - } - - if ($scope.fileContent.indexOf('MULTIPOLYGON') !== -1){ - $scope.errorMessage = locale.getString('areas.area_upload_modal_wkt_no_multipolygon'); - $scope.setWarning(); - $scope.isMulti = true; - } - - if ($scope.isMulti){ - $timeout(function(){ - return $scope.buildGeometryFromWKT(); - }, 3000); - } else { - return $scope.buildGeometryFromWKT(); - } - }; - - $scope.buildGeometryFromWKT = function(){ - var geomFormat = new ol.format.WKT(); - var srcProj = 'EPSG:' + $scope.projections.getProjectionEpsgById($scope.selProjection); - - try { - var geom = geomFormat.readGeometry($scope.fileContent, { - dataProjection: srcProj, - featureProjection: $scope.defaultProjection[1] - }); - - if ($scope.isMulti){ - geom = geom.getPolygon(0); - $modalInstance.close(geom); - } - - var firstCoord = geom.getFirstCoordinate(); - var lastCoord = geom.getLastCoordinate(); - - if (geom.getArea() === 0){ - $scope.errorMessage = locale.getString('areas.area_upload_modal_invalid_polygon'); - $scope.setError(); - return; - } else { - if (!(firstCoord[0] === lastCoord[0] && firstCoord[1] === lastCoord[1])){ - var coords = geom.getCoordinates(); - coords[0].push(firstCoord); - geom.setCoordinates(coords); - } - return geom; - } - } catch (e) { - $scope.errorMessage = locale.getString('areas.area_upload_modal_parsing_error_wkt'); - $scope.setError(); - return; - } - }; - - //Check if selected projection differs from that of the map and, if so, warp it - $scope.checkAndWarpGeometry = function(geom){ - var sourceProj = 'EPSG:' + $scope.projections.getProjectionEpsgById($scope.selProjection); - if (sourceProj !== $scope.defaultProjection[1]){ - geom.transform(sourceProj, $scope.defaultProjection[1]); - } - return geom; - }; - - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); - }; - - $scope.upload = function(){ - $scope.uploaded = true; - if ($scope.uploadAreaForm.$valid && $scope.fileCommitted && $scope.fileReadingSuccess){ - var geom; - if ($scope.format === 'csv'){ - geom = $scope.parseCSV(); - } else if ($scope.format === 'wkt'){ - geom = $scope.parseWKT(); - } - - if (angular.isDefined(geom)){ - $modalInstance.close(geom); - } - } else { - $scope.setError(); - $scope.errorMessage = locale.getString('areas.area_upload_modal_form_errors'); - } - }; - - //Error functions - $scope.setError = function(){ - $scope.hasWarning = false; - $scope.hasError = true; - $scope.hideError(); - }; - - $scope.setWarning = function(){ - $scope.hasWarning = true; - $scope.hasError = true; - $scope.hideError(); - }; - - $scope.hideError = function(){ - $timeout(function(){ - $scope.hasError = false; - $scope.hasWarning = false; - }, 3000); - }; - -}); +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . +*/ +angular.module('unionvmsWeb').controller('UploadareamodalCtrl',function($scope, $modalInstance, locale, FileUploader, projectionService, srcProjections, defaultProjection, $timeout){ + $scope.hasError = false; + $scope.hasWarning = false; + $scope.errorMessage = undefined; + $scope.isMulti = false; + + $scope.uploader = new FileUploader(); + $scope.reader = new FileReader(); + $scope.srcProjections = srcProjections; + $scope.projections = projectionService; + $scope.defaultProjection = defaultProjection; //This is an array like [1, 'EPSG:4326'] + + if ($scope.projections.items.length > 0){ + $scope.selProjection = defaultProjection[0]; + } + + //Uploader Filters and events + $scope.uploader.filters.push({ + name: 'singleUpload', + fn: function(item){ + if (this.queue.length > 0){ + this.queue.pop(); + } + return item; + } + }); + + $scope.uploader.filters.push({ + name: 'fileExtension', + fn: function(item){ + var supportedTypes = ['csv', 'txt', 'wkt', "gml", "xml"]; + var splitedItemName = item.name.split('.'); + + for (var i = 0; i < supportedTypes.length; i++){ + if (supportedTypes[i].toLowerCase() === splitedItemName[splitedItemName.length - 1].toLowerCase()){ + return item; + } + } + } + }); + + //Read uploaded file contents + $scope.uploader.onAfterAddingFile = function(item) { + $scope.isFileLoading = true; + try { + $scope.reader.readAsText(item._file); + } catch (e) { + $scope.fileCommitted = true; + $scope.fileReadingSuccess = false; + $scope.isFileLoading = false; + } + }; + + //Set intial status + $scope.setStatus = function(){ + $scope.fileCommitted = false; + $scope.isFileLoading = false; + $scope.fileReadingSuccess = true; + if ($scope.uploader.queue.length > 0){ + $scope.uploader.clearQueue(); + $scope.fileContent = undefined; + } + }; + $scope.setStatus(); + + //Reader events + $scope.reader.onloadend = function(){ + $scope.fileContent = $scope.reader.result; + $scope.isFileLoading = false; + $scope.fileReadingSuccess = true; + $scope.fileCommitted = true; + }; + + //Format combobox + $scope.format = 'csv'; + $scope.formatItems = []; + $scope.formatItems.push({"text": locale.getString('areas.area_upload_modal_csv'), "code": "csv"}); + $scope.formatItems.push({"text": locale.getString('areas.area_upload_modal_wkt'), "code": "wkt"}); + $scope.formatItems.push({"text": locale.getString('areas.area_upload_modal_gml'), "code": "gml"}); + + //CSV stuff + $scope.containsFirstRow = false; + + //CSV delimiters combobox + $scope.delimiter = ','; + $scope.delimiterItems = []; + $scope.delimiterItems.push({"text": locale.getString('areas.area_upload_modal_comma'), "code": ","}); + $scope.delimiterItems.push({"text": locale.getString('areas.area_upload_modal_semicolon'), "code": ";"}); + $scope.delimiterItems.push({"text": locale.getString('areas.area_upload_modal_colon'), "code": ":"}); + + //CSV parser + $scope.parseCSV = function(){ + var lines = $scope.fileContent.split('\n'); + var columns = lines[0].split($scope.delimiter).length; + + var start = 0; + var headers = []; + if ($scope.containsFirstRow){ + headers = lines[0].split($scope.delimiter); + start = 1; + } else { + if (columns !== 2){ + $scope.errorMessage = locale.getString('areas.area_upload_modal_only_two_columns'); + $scope.setError(); + return; + } + } + + var coords = []; + for (var i = start; i < lines.length; i++){ + var currentLine = lines[i].split(new RegExp($scope.delimiter+'(?![^"]*"(?:(?:[^"]*"){2})*[^"]*$)')); + if (currentLine.length === columns){ + var x,y; + if (!$scope.containsFirstRow){ + x = parseFloat(currentLine[0]); + y = parseFloat(currentLine[1]); + } else { + for (var j = 0; j < headers.length; j++){ + if (headers[j].trim() === $scope.xField.trim()){ + x = parseFloat(currentLine[j]); + } else if (headers[j].trim() === $scope.yField.trim()){ + y = parseFloat(currentLine[j]); + } + } + } + if (!isNaN(x) && !isNaN(y)){ + coords.push([x,y]); + } + } + } + + if (coords.length !== 0){ + //Lets validate if last pair of coordinates is the same as the first and if not we add it + var firstCoord = coords[0]; + var lastCoord = coords[coords.length - 1]; + var diff = _.difference(firstCoord, lastCoord); + + if (diff.length > 0){ + coords.push(firstCoord); + } + + //Build geometry + var geom = new ol.geom.Polygon(); + geom.setCoordinates([coords]); + + if (geom.getArea() === 0){ + $scope.errorMessage = locale.getString('areas.area_upload_modal_invalid_polygon'); + $scope.setError(); + return; + } else { + geom = $scope.checkAndWarpGeometry(geom); + return geom; + } + } else { + $scope.errorMessage = locale.getString('areas.area_upload_modal_parsing_error'); + $scope.setError(); + return; + } + }; + + $scope.parseGML = function() { + try { + var srcProj = 'EPSG:' + $scope.projections.getProjectionEpsgById($scope.selProjection); + var wfsFormat = new ol.format.WFS(); + var geometries = wfsFormat.readFeatures($scope.fileContent, { + defaultProjection: srcProj, + featureProjection: $scope.defaultProjection[1] + }); + + var geom = geometries[0].getGeometry(); + var firstCoord = geom.getFirstCoordinate(); + var lastCoord = geom.getLastCoordinate(); + + if (geom.getArea() === 0){ + $scope.errorMessage = locale.getString('areas.area_upload_modal_invalid_polygon'); + $scope.setError(); + return; + } else { + if (!(firstCoord[0] === lastCoord[0] && firstCoord[1] === lastCoord[1])){ + var coords = geom.getCoordinates(); + coords[0].push(firstCoord); + geom.setCoordinates(coords); + } + return $scope.checkAndWarpGeometry(geom); + } + } catch (e) { + $scope.errorMessage = locale.getString('areas.area_upload_modal_parsing_error_gml'); + $scope.setError(); + return; + } + }; + + //WKT Parser + $scope.parseWKT = function(){ + $scope.isMulti = false; + if ($scope.fileContent.indexOf('POLYGON') === -1){ + $scope.errorMessage = locale.getString('areas.area_upload_modal_wkt_no_polygon'); + $scope.setError(); + return; + } + + if ($scope.fileContent.indexOf('MULTIPOLYGON') !== -1){ + $scope.errorMessage = locale.getString('areas.area_upload_modal_wkt_no_multipolygon'); + $scope.setWarning(); + $scope.isMulti = true; + } + + if ($scope.isMulti){ + $timeout(function(){ + return $scope.buildGeometryFromWKT(); + }, 3000); + } else { + return $scope.buildGeometryFromWKT(); + } + }; + + $scope.buildGeometryFromWKT = function(){ + var geomFormat = new ol.format.WKT(); + var srcProj = 'EPSG:' + $scope.projections.getProjectionEpsgById($scope.selProjection); + + try { + var geom = geomFormat.readGeometry($scope.fileContent, { + dataProjection: srcProj, + featureProjection: $scope.defaultProjection[1] + }); + + if ($scope.isMulti){ + geom = geom.getPolygon(0); + $modalInstance.close(geom); + } + + var firstCoord = geom.getFirstCoordinate(); + var lastCoord = geom.getLastCoordinate(); + + if (geom.getArea() === 0){ + $scope.errorMessage = locale.getString('areas.area_upload_modal_invalid_polygon'); + $scope.setError(); + return; + } else { + if (!(firstCoord[0] === lastCoord[0] && firstCoord[1] === lastCoord[1])){ + var coords = geom.getCoordinates(); + coords[0].push(firstCoord); + geom.setCoordinates(coords); + } + return geom; + } + } catch (e) { + $scope.errorMessage = locale.getString('areas.area_upload_modal_parsing_error_wkt'); + $scope.setError(); + return; + } + }; + + //Check if selected projection differs from that of the map and, if so, warp it + $scope.checkAndWarpGeometry = function(geom){ + var sourceProj = 'EPSG:' + $scope.projections.getProjectionEpsgById($scope.selProjection); + if (sourceProj !== $scope.defaultProjection[1]){ + geom.transform(sourceProj, $scope.defaultProjection[1]); + } + return geom; + }; + + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + + $scope.upload = function(){ + $scope.uploaded = true; + if ($scope.uploadAreaForm.$valid && $scope.fileCommitted && $scope.fileReadingSuccess){ + var geom; + if ($scope.format === 'csv'){ + geom = $scope.parseCSV(); + } else if ($scope.format === 'wkt'){ + geom = $scope.parseWKT(); + } else if ($scope.format === 'gml'){ + geom = $scope.parseGML(); + } + + if (angular.isDefined(geom)){ + $modalInstance.close(geom); + } + } else { + $scope.setError(); + $scope.errorMessage = locale.getString('areas.area_upload_modal_form_errors'); + } + }; + + //Error functions + $scope.setError = function(){ + $scope.hasWarning = false; + $scope.hasError = true; + $scope.hideError(); + }; + + $scope.setWarning = function(){ + $scope.hasWarning = true; + $scope.hasError = true; + $scope.hideError(); + }; + + $scope.hideError = function(){ + $timeout(function(){ + $scope.hasError = false; + $scope.hasWarning = false; + }, 3000); + }; + +}); From cfeee3ef65ff2978e1a6ff06bfb5457b91b02fe6 Mon Sep 17 00:00:00 2001 From: lsotiriadis Date: Mon, 24 Aug 2020 16:31:37 +0300 Subject: [PATCH 11/33] [UNIONVMS-4751] Made attribute names individually hideable in the map info popup and labels Signed-off-by: lsotiriadis --- unionvms-web/app/i18n/bg-bg/spatial.lang.json | 9 +- unionvms-web/app/i18n/cs-cz/spatial.lang.json | 9 +- unionvms-web/app/i18n/da-dk/spatial.lang.json | 9 +- unionvms-web/app/i18n/de-at/spatial.lang.json | 9 +- unionvms-web/app/i18n/de-de/spatial.lang.json | 9 +- unionvms-web/app/i18n/de-lu/spatial.lang.json | 9 +- unionvms-web/app/i18n/el-cy/spatial.lang.json | 9 +- unionvms-web/app/i18n/el-gr/spatial.lang.json | 9 +- unionvms-web/app/i18n/en-gb/spatial.lang.json | 4 + unionvms-web/app/i18n/en-ie/spatial.lang.json | 34 +- unionvms-web/app/i18n/es-es/spatial.lang.json | 34 +- unionvms-web/app/i18n/et-ee/spatial.lang.json | 34 +- unionvms-web/app/i18n/fi-fi/spatial.lang.json | 34 +- unionvms-web/app/i18n/fr-fr/spatial.lang.json | 34 +- unionvms-web/app/i18n/fr-lu/spatial.lang.json | 34 +- unionvms-web/app/i18n/hr-hr/spatial.lang.json | 34 +- unionvms-web/app/i18n/hu-hu/spatial.lang.json | 34 +- unionvms-web/app/i18n/im-im/spatial.lang.json | 34 +- unionvms-web/app/i18n/it-it/spatial.lang.json | 34 +- unionvms-web/app/i18n/lt-lt/spatial.lang.json | 34 +- unionvms-web/app/i18n/lv-lv/spatial.lang.json | 34 +- unionvms-web/app/i18n/mt/spatial.lang.json | 9 +- unionvms-web/app/i18n/nl-be/spatial.lang.json | 34 +- unionvms-web/app/i18n/nl-nl/spatial.lang.json | 34 +- unionvms-web/app/i18n/nl/spatial.lang.json | 34 +- unionvms-web/app/i18n/pl/spatial.lang.json | 34 +- unionvms-web/app/i18n/pt-pt/spatial.lang.json | 34 +- unionvms-web/app/i18n/ro-ro/spatial.lang.json | 34 +- unionvms-web/app/i18n/si-si/spatial.lang.json | 34 +- unionvms-web/app/i18n/sk-sk/spatial.lang.json | 34 +- unionvms-web/app/i18n/sv/spatial.lang.json | 34 +- unionvms-web/app/i18n/tr-cy/spatial.lang.json | 34 +- .../configurations/spatialConfigModel.js | 51 ++- .../positionsVisibility.html | 190 ++++----- .../positionsVisibility.js | 393 +++++++++--------- .../positionsVisibility.less | 75 ++-- .../segmentsVisibility.html | 182 ++++---- .../segmentsVisibility/segmentsVisibility.js | 298 ++++++------- .../segmentsVisibility.less | 75 ++-- .../tracksVisibility/tracksVisibility.html | 90 ++-- .../tracksVisibility/tracksVisibility.js | 256 ++++++------ .../visibilitySettings/visibilitySettings.js | 300 +++++++------ .../app/partial/spatial/templates/label.html | 54 +-- .../app/partial/spatial/templates/vmspos.html | 60 +-- .../app/partial/spatial/templates/vmsseg.html | 60 +-- .../app/service/spatial/mapService.js | 78 +++- 46 files changed, 1619 insertions(+), 1376 deletions(-) diff --git a/unionvms-web/app/i18n/bg-bg/spatial.lang.json b/unionvms-web/app/i18n/bg-bg/spatial.lang.json index 5a5d86227..d22d9f769 100644 --- a/unionvms-web/app/i18n/bg-bg/spatial.lang.json +++ b/unionvms-web/app/i18n/bg-bg/spatial.lang.json @@ -317,7 +317,6 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -380,7 +379,6 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -390,6 +388,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -411,7 +413,6 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -443,7 +444,6 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -475,7 +475,6 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - "previous": "Previous", "next": "Next", "more_details": "More...", diff --git a/unionvms-web/app/i18n/cs-cz/spatial.lang.json b/unionvms-web/app/i18n/cs-cz/spatial.lang.json index 5a5d86227..d22d9f769 100644 --- a/unionvms-web/app/i18n/cs-cz/spatial.lang.json +++ b/unionvms-web/app/i18n/cs-cz/spatial.lang.json @@ -317,7 +317,6 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -380,7 +379,6 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -390,6 +388,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -411,7 +413,6 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -443,7 +444,6 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -475,7 +475,6 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - "previous": "Previous", "next": "Next", "more_details": "More...", diff --git a/unionvms-web/app/i18n/da-dk/spatial.lang.json b/unionvms-web/app/i18n/da-dk/spatial.lang.json index 5a5d86227..d22d9f769 100644 --- a/unionvms-web/app/i18n/da-dk/spatial.lang.json +++ b/unionvms-web/app/i18n/da-dk/spatial.lang.json @@ -317,7 +317,6 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -380,7 +379,6 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -390,6 +388,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -411,7 +413,6 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -443,7 +444,6 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -475,7 +475,6 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - "previous": "Previous", "next": "Next", "more_details": "More...", diff --git a/unionvms-web/app/i18n/de-at/spatial.lang.json b/unionvms-web/app/i18n/de-at/spatial.lang.json index 5a5d86227..d22d9f769 100644 --- a/unionvms-web/app/i18n/de-at/spatial.lang.json +++ b/unionvms-web/app/i18n/de-at/spatial.lang.json @@ -317,7 +317,6 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -380,7 +379,6 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -390,6 +388,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -411,7 +413,6 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -443,7 +444,6 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -475,7 +475,6 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - "previous": "Previous", "next": "Next", "more_details": "More...", diff --git a/unionvms-web/app/i18n/de-de/spatial.lang.json b/unionvms-web/app/i18n/de-de/spatial.lang.json index 5a5d86227..d22d9f769 100644 --- a/unionvms-web/app/i18n/de-de/spatial.lang.json +++ b/unionvms-web/app/i18n/de-de/spatial.lang.json @@ -317,7 +317,6 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -380,7 +379,6 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -390,6 +388,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -411,7 +413,6 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -443,7 +444,6 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -475,7 +475,6 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - "previous": "Previous", "next": "Next", "more_details": "More...", diff --git a/unionvms-web/app/i18n/de-lu/spatial.lang.json b/unionvms-web/app/i18n/de-lu/spatial.lang.json index 5a5d86227..d22d9f769 100644 --- a/unionvms-web/app/i18n/de-lu/spatial.lang.json +++ b/unionvms-web/app/i18n/de-lu/spatial.lang.json @@ -317,7 +317,6 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -380,7 +379,6 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -390,6 +388,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -411,7 +413,6 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -443,7 +444,6 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -475,7 +475,6 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - "previous": "Previous", "next": "Next", "more_details": "More...", diff --git a/unionvms-web/app/i18n/el-cy/spatial.lang.json b/unionvms-web/app/i18n/el-cy/spatial.lang.json index 5a5d86227..d22d9f769 100644 --- a/unionvms-web/app/i18n/el-cy/spatial.lang.json +++ b/unionvms-web/app/i18n/el-cy/spatial.lang.json @@ -317,7 +317,6 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -380,7 +379,6 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -390,6 +388,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -411,7 +413,6 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -443,7 +444,6 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -475,7 +475,6 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - "previous": "Previous", "next": "Next", "more_details": "More...", diff --git a/unionvms-web/app/i18n/el-gr/spatial.lang.json b/unionvms-web/app/i18n/el-gr/spatial.lang.json index 5a5d86227..d22d9f769 100644 --- a/unionvms-web/app/i18n/el-gr/spatial.lang.json +++ b/unionvms-web/app/i18n/el-gr/spatial.lang.json @@ -317,7 +317,6 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -380,7 +379,6 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -390,6 +388,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -411,7 +413,6 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -443,7 +444,6 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -475,7 +475,6 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - "previous": "Previous", "next": "Next", "more_details": "More...", diff --git a/unionvms-web/app/i18n/en-gb/spatial.lang.json b/unionvms-web/app/i18n/en-gb/spatial.lang.json index 69c320514..1d3ac749f 100644 --- a/unionvms-web/app/i18n/en-gb/spatial.lang.json +++ b/unionvms-web/app/i18n/en-gb/spatial.lang.json @@ -402,6 +402,10 @@ "visibility_configuration_label": "Map Labels", "visibility_configuration_table": "VMS Table", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "catch_figures_tresholds":"Catch Figures Thresholds", "general_configuration_geoserver_url": "Geoserver URL", diff --git a/unionvms-web/app/i18n/en-ie/spatial.lang.json b/unionvms-web/app/i18n/en-ie/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/en-ie/spatial.lang.json +++ b/unionvms-web/app/i18n/en-ie/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/es-es/spatial.lang.json b/unionvms-web/app/i18n/es-es/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/es-es/spatial.lang.json +++ b/unionvms-web/app/i18n/es-es/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/et-ee/spatial.lang.json b/unionvms-web/app/i18n/et-ee/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/et-ee/spatial.lang.json +++ b/unionvms-web/app/i18n/et-ee/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/fi-fi/spatial.lang.json b/unionvms-web/app/i18n/fi-fi/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/fi-fi/spatial.lang.json +++ b/unionvms-web/app/i18n/fi-fi/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/fr-fr/spatial.lang.json b/unionvms-web/app/i18n/fr-fr/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/fr-fr/spatial.lang.json +++ b/unionvms-web/app/i18n/fr-fr/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/fr-lu/spatial.lang.json b/unionvms-web/app/i18n/fr-lu/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/fr-lu/spatial.lang.json +++ b/unionvms-web/app/i18n/fr-lu/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/hr-hr/spatial.lang.json b/unionvms-web/app/i18n/hr-hr/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/hr-hr/spatial.lang.json +++ b/unionvms-web/app/i18n/hr-hr/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/hu-hu/spatial.lang.json b/unionvms-web/app/i18n/hu-hu/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/hu-hu/spatial.lang.json +++ b/unionvms-web/app/i18n/hu-hu/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/im-im/spatial.lang.json b/unionvms-web/app/i18n/im-im/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/im-im/spatial.lang.json +++ b/unionvms-web/app/i18n/im-im/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/it-it/spatial.lang.json b/unionvms-web/app/i18n/it-it/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/it-it/spatial.lang.json +++ b/unionvms-web/app/i18n/it-it/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/lt-lt/spatial.lang.json b/unionvms-web/app/i18n/lt-lt/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/lt-lt/spatial.lang.json +++ b/unionvms-web/app/i18n/lt-lt/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/lv-lv/spatial.lang.json b/unionvms-web/app/i18n/lv-lv/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/lv-lv/spatial.lang.json +++ b/unionvms-web/app/i18n/lv-lv/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/mt/spatial.lang.json b/unionvms-web/app/i18n/mt/spatial.lang.json index 212e83cfc..120f8cf60 100644 --- a/unionvms-web/app/i18n/mt/spatial.lang.json +++ b/unionvms-web/app/i18n/mt/spatial.lang.json @@ -317,7 +317,6 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -380,7 +379,6 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -390,6 +388,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -411,7 +413,6 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -443,7 +444,6 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -475,7 +475,6 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - "previous": "Previous", "next": "Next", "more_details": "More...", diff --git a/unionvms-web/app/i18n/nl-be/spatial.lang.json b/unionvms-web/app/i18n/nl-be/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/nl-be/spatial.lang.json +++ b/unionvms-web/app/i18n/nl-be/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/nl-nl/spatial.lang.json b/unionvms-web/app/i18n/nl-nl/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/nl-nl/spatial.lang.json +++ b/unionvms-web/app/i18n/nl-nl/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/nl/spatial.lang.json b/unionvms-web/app/i18n/nl/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/nl/spatial.lang.json +++ b/unionvms-web/app/i18n/nl/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/pl/spatial.lang.json b/unionvms-web/app/i18n/pl/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/pl/spatial.lang.json +++ b/unionvms-web/app/i18n/pl/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/pt-pt/spatial.lang.json b/unionvms-web/app/i18n/pt-pt/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/pt-pt/spatial.lang.json +++ b/unionvms-web/app/i18n/pt-pt/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/ro-ro/spatial.lang.json b/unionvms-web/app/i18n/ro-ro/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/ro-ro/spatial.lang.json +++ b/unionvms-web/app/i18n/ro-ro/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/si-si/spatial.lang.json b/unionvms-web/app/i18n/si-si/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/si-si/spatial.lang.json +++ b/unionvms-web/app/i18n/si-si/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/sk-sk/spatial.lang.json b/unionvms-web/app/i18n/sk-sk/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/sk-sk/spatial.lang.json +++ b/unionvms-web/app/i18n/sk-sk/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/sv/spatial.lang.json b/unionvms-web/app/i18n/sv/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/sv/spatial.lang.json +++ b/unionvms-web/app/i18n/sv/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/i18n/tr-cy/spatial.lang.json b/unionvms-web/app/i18n/tr-cy/spatial.lang.json index c863c7a5d..83609f152 100644 --- a/unionvms-web/app/i18n/tr-cy/spatial.lang.json +++ b/unionvms-web/app/i18n/tr-cy/spatial.lang.json @@ -72,7 +72,7 @@ "map_export_filename": "map_export", "map_export_title_label": "Title", "map_export_layout_portrait": "Portrait", - "map_export_layout_landscape": "Landscape", + "map_export_layout_landscape": "Landscape", "map_export_copyright": "Generated by", "map_speed_label": "Speed", "map_start_date_label": "Start date", @@ -295,10 +295,10 @@ "area_selection_modal_area_is_selected_warning": "This area is already added to you current selection", "area_selection_modal_get_sys_layers_error": "There was an error while getting the list of available system areas. Please try again.", "area_selection_modal_get_sys_area_details_error": "There was an error while getting the details for the selected area. Please try again.", - "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", + "area_selection_modal_get_sys_area_details_empty_result": "There is no selectable area on the specified location.", "area_selection_modal_get_selected_sys_area_details_error": "There was an error while getting the details of previously selected areas. Please try again.", "area_selection_modal_get_selected_area_search_error": "There was an error while searching for areas. Please try again.", - + "area_selection_type_label": "Selection", "area_selection_type_all_areas": "All", "area_selection_type_custom": "Custom", @@ -316,7 +316,7 @@ "gfcm_config_modal_title": "GFCM settings", "fao_config_modal_title": "FAO settings", "fmz_config_modal_title": "FMZ settings", - + "save_as_modal_title": "Save report as...", "map_configuration_map_projection": "Map projection", "map_configuration_display_projection": "Display projection", @@ -332,9 +332,9 @@ "map_configuration_scale_bar_units_degrees": "Degrees", "map_configuration_scale_bar_units_nautical": "Nautical miles", "map_configuration_scale_bar_units_imperial": "Miles", - + "map_configuration_error_loading_configs": "There was an error while loading available map configurations. Please try again.", - + "layer_panel_layers": "Layers", "layer_panel_legend": "Legend", "layer_panel_copyright": "Copyright", @@ -379,7 +379,7 @@ "preferences_auto_refresh_status": "Auto refresh status", "preferences_alarm_status_category_title": "Alert status", "tab_config_table_header_vessel_color": "Asset color", - + "settings_reset_btn": "Reset to defaults", "map_settings": "Map settings", "style_settings": "Style settings", @@ -389,6 +389,10 @@ "visibility_configuration_label": "Label contents", "visibility_configuration_table": "Table contents", "visibility_show_attr_names": "Show attribute names", + "visibility_show_attr_name": "Show this attribute name", + "visibility_show_all_attr_name": "Show all attribute names", + "visibility_show_all_attr": "Show all attributes", + "visibility_show_attr_val": "Show this attribute value", "general_settings": "General settings", "general_configuration_geoserver_url": "Geoserver URL", "general_configuration_bing_api_key": "Bing Maps Api Key", @@ -401,7 +405,7 @@ "layer_settings_user_areas": "User areas", "layer_settings_group_areas": "Area groups", "layer_settings_port": "Ports", - "layer_tree": "Layer Tree", + "layer_tree": "Layer Tree", "base_layers_error": "There must be at least one background layer", "segment_property": "Segment property", "position_property": "Position property", @@ -410,7 +414,7 @@ "property_add_rule": "Add rule", "property_rm_rule": "Remove rule", "default_color": "Default color", - + "user_preferences_error_saving": "There was an error while saving your preferences. Please try again.", "user_preferences_success_saving": "Your preferences were successfuly saved. Please re-run your report, in order to reflect the changes onto the report result. Be aware that some of the settings might be overridden by report level preferences.", "user_preferences_reset_map_settings_success": "Your map settings were successfuly reset.", @@ -442,7 +446,7 @@ "invalid_range_error_message_2": "Must be between 1 and 6", "not_numeric_error_message": "Value shall be numeric", "base_list_error": "There should be at least one selected background layer", - + "styles_attr_countryCode": "F.S", "styles_attr_type": "Msg. Type", "styles_attr_activity": "Act. Type", @@ -454,11 +458,11 @@ "styles_attr_speedOverGround": "Speed", "styles_attr_courseOverGround": "Course", "styles_attr_status": "Status", - + "line_style": "Line style", "line_width": "Line width", "size": "Size", - + "ref_data_label": "Reference data", "ref_data_type_label": "Data type", "ref_data_group_selection": "Group selection", @@ -474,7 +478,7 @@ "ref_data_group_already_added_msg": "This group is already selected.", "ref_data_empty_search_by_click_msg": "There is no data at the selected location.", "ref_data_empty_search_by_prop_msg": "There is no data that matches your search criteria.", - + "previous": "Previous", "next": "Next", "more_details": "More...", @@ -491,11 +495,11 @@ "loading_preferences": "Loading preferences", "saving_preferences": "Saving preferences", "reseting_preferences": "Reseting preferences", - + "reset": "Reset", "clear_all_btn": "Clear all", "add_all_btn": "Add all", - + "saving_report_message": "Saving report", "reseting_report_message": "Reseting report", diff --git a/unionvms-web/app/partial/spatial/configurations/spatialConfigModel.js b/unionvms-web/app/partial/spatial/configurations/spatialConfigModel.js index 10e5ae35c..e5dce1fcb 100644 --- a/unionvms-web/app/partial/spatial/configurations/spatialConfigModel.js +++ b/unionvms-web/app/partial/spatial/configurations/spatialConfigModel.js @@ -10,7 +10,6 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more d copy of the GNU General Public License along with the IFDM Suite. If not, see . */ angular.module('unionvmsWeb').factory('SpatialConfig',function() { - function SpatialConfig(){ this.toolSettings = { control: [], @@ -43,7 +42,6 @@ angular.module('unionvmsWeb').factory('SpatialConfig',function() { areaLayers: [], baseLayers: [], portLayers: [] - }; this.mapSettings = { mapProjectionId: undefined, @@ -55,17 +53,35 @@ angular.module('unionvmsWeb').factory('SpatialConfig',function() { }; this.visibilitySettings = { positions: { - table: {}, - popup: {}, - labels: {} + table: { + values:{} + }, + popup: { + names:{}, + values:{} + }, + labels: { + names:{}, + values:{} + } }, segments: { - table: {}, - popup: {}, - labels: {} + table: { + values:{} + }, + popup: { + names:{}, + values:{} + }, + labels: { + names:{}, + values:{} + } }, tracks: { - table: {} + table: { + values:{} + } } }; this.referenceDataSettings = {}; @@ -105,7 +121,6 @@ angular.module('unionvmsWeb').factory('SpatialConfig',function() { var config = new SpatialConfig(); config.toolSettings = undefined; config.systemSettings = undefined; - if (angular.isDefined(data.mapSettings)){ config.mapSettings = data.mapSettings; } @@ -133,7 +148,6 @@ angular.module('unionvmsWeb').factory('SpatialConfig',function() { var config = new SpatialConfig(); config.toolSettings = undefined; config.systemSettings = undefined; - config = checkMapSettings(this,'user',config,form.mapSettingsForm.$dirty); config = checkStylesSettings(this,'user',config,form.stylesSettingsForm.$dirty); config = checkVisibilitySettings(this,'user',config,form.visibilitySettingsForm.$dirty); @@ -153,7 +167,6 @@ angular.module('unionvmsWeb').factory('SpatialConfig',function() { layerSettingsForm: angular.isDefined(form.layerSettingsForm) ? form.layerSettingsForm.$dirty : false, referenceDataSettingsForm: angular.isDefined(form.referenceDataSettingsForm) ? form.referenceDataSettingsForm.$dirty : false }; - if(userConfig.mapSettings.spatialConnectId !== this.mapSettings.spatialConnectId || userConfig.mapSettings.mapProjectionId !== this.mapSettings.mapProjectionId || userConfig.mapSettings.displayProjectionId !== this.mapSettings.displayProjectionId || userConfig.mapSettings.coordinatesFormat !== this.mapSettings.coordinatesFormat || userConfig.mapSettings.scaleBarUnits !== this.mapSettings.scaleBarUnits || formStatus.mapSettingsForm){ @@ -186,7 +199,6 @@ angular.module('unionvmsWeb').factory('SpatialConfig',function() { return config; }; - //Used in the report form map configuration modal SpatialConfig.prototype.forReportConfigFromJson = function(data){ var config = new SpatialConfig(); @@ -290,7 +302,6 @@ angular.module('unionvmsWeb').factory('SpatialConfig',function() { }else{ properties.attribute = model[item + 'Style'].attribute; properties.style = {}; - if(item==='segment'){ properties.style.lineStyle = model.segmentStyle.lineStyle; properties.style.lineWidth = model.segmentStyle.lineWidth; @@ -358,6 +369,7 @@ angular.module('unionvmsWeb').factory('SpatialConfig',function() { var visibilityCurrentSettings = model.visibilitySettings[visibType + 's'][contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; var visibilityCurrentAttrs = model.visibilitySettings[visibType + contentType + 'Attrs']; var visibilities = {}; + visibilities.names = []; visibilities.values = []; visibilities.order = []; visibilities.isAttributeVisible = visibilityCurrentSettings.isAttributeVisible; @@ -368,10 +380,15 @@ angular.module('unionvmsWeb').factory('SpatialConfig',function() { if(angular.isDefined(visibilityCurrentSettings.values)){ for(var j = 0; j < visibilities.order.length; j++){ - if(visibilityCurrentSettings.values.indexOf(visibilities.order[j]) !== -1){ - visibilities.values.push(visibilities.order[j]); + var attr = visibilities.order[j]; + if(visibilityCurrentSettings.values.indexOf(attr) !== -1){ + visibilities.values.push(attr); + } + if(angular.isDefined(visibilityCurrentSettings.names) && visibilityCurrentSettings.names.indexOf(attr) !== -1){ + visibilities.names.push(attr); } } + angular.copy(visibilities,visibilityCurrentSettings); } } @@ -381,7 +398,6 @@ angular.module('unionvmsWeb').factory('SpatialConfig',function() { }); }); } - if (angular.isDefined(config.visibilitySettings)){ angular.forEach(visibilityTypes, function(visibType){ angular.forEach(contentTypes, function(contentType){ @@ -389,7 +405,6 @@ angular.module('unionvmsWeb').factory('SpatialConfig',function() { }); }); } - return config; }; diff --git a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.html b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.html index 967b661e3..d6f2d5fa3 100644 --- a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.html +++ b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.html @@ -1,93 +1,97 @@ - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
- {{'spatial.visibility_configuration_table' | i18n}} - - - {{'spatial.visibility_configuration_popup' | i18n}} - - - {{'spatial.visibility_configuration_label' | i18n}} - -
-
    -
  • -
    :::
    - {{attr.title}} - -
  • -
-
-
    -
  • -
    :::
    - {{attr.title}} - -
  • -
-
-
    -
  • -
    :::
    - {{attr.title}} - -
  • -
-
- {{'spatial.visibility_show_attr_names' | i18n}} - - - {{'spatial.visibility_show_attr_names' | i18n}} - -
-
-
-
- + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{'spatial.visibility_configuration_table' | i18n}} + + + {{'spatial.visibility_configuration_popup' | i18n}} + + + + {{'spatial.visibility_configuration_label' | i18n}} + + +
+
    +
  • +
    :::
    + {{attr.title}} + +
  • +
+
+
    +
  • +
    :::
    + {{attr.title}} + + +
  • +
+
+
    +
  • +
    :::
    + {{attr.title}} + + +
  • +
+
+
+
+
+ diff --git a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.js b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.js index e8a85d8f0..3b83fd585 100644 --- a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.js +++ b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.js @@ -1,195 +1,200 @@ /* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . -*/ -angular.module('unionvmsWeb').controller('PositionsvisibilityCtrl',function($scope, locale){ - $scope.isPositionVisLoading = false; - - $scope.$watch('configModel.visibilitySettings.positions', function(newVal) { - $scope.isPositionVisLoading = false; - if(newVal){ - - $scope.configModel.visibilitySettings.positionTableAttrs = [{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), - value: 'fs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), - value: 'extMark' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), - value: 'ircs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), - value: 'cfr' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), - value: 'name' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_date'), - value: 'posTime' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_lon'), - value: 'lon' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_lat'), - value: 'lat' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_status'), - value: 'stat' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_measured_speed'), - value: 'm_spd' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_calculated_speed'), - value: 'c_spd' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_course'), - value: 'crs' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_msg_type'), - value: 'msg_tp' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_activity_type'), - value: 'act_tp' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_source'), - value: 'source' - }]; - - $scope.configModel.visibilitySettings.positionPopupAttrs = [{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), - value: 'fs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), - value: 'extMark' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), - value: 'ircs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), - value: 'cfr' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), - value: 'name' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_date'), - value: 'posTime' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_lon'), - value: 'lon' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_lat'), - value: 'lat' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_status'), - value: 'stat' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_measured_speed'), - value: 'm_spd' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_calculated_speed'), - value: 'c_spd' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_course'), - value: 'crs' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_msg_type'), - value: 'msg_tp' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_activity_type'), - value: 'act_tp' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_source'), - value: 'source' - }]; - - $scope.configModel.visibilitySettings.positionLabelAttrs = [{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), - value: 'fs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), - value: 'extMark' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), - value: 'ircs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), - value: 'cfr' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), - value: 'name' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_date'), - value: 'posTime' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_lon'), - value: 'lon' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_lat'), - value: 'lat' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_status'), - value: 'stat' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_measured_speed'), - value: 'm_spd' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_calculated_speed'), - value: 'c_spd' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_course'), - value: 'crs' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_msg_type'), - value: 'msg_tp' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_activity_type'), - value: 'act_tp' - },{ - title: locale.getString('spatial.tab_vms_pos_table_header_source'), - value: 'source' - }]; - - var contentTypes = ['Table','Popup','Label']; - angular.forEach(contentTypes, function(contentType) { - var positions = []; - var positionVisibilitySettings = $scope.configModel.visibilitySettings.positions[contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; - var positionVisibilityAttrs = $scope.configModel.visibilitySettings['position' + contentType + 'Attrs']; - - if(positionVisibilitySettings.order && positionVisibilitySettings.order.length > 0){ - angular.forEach(positionVisibilitySettings.order, function(item) { - for(var i=0;i. +*/ +angular.module('unionvmsWeb').controller('PositionsvisibilityCtrl',function($scope, locale){ + $scope.isPositionVisLoading = false; + + $scope.$watch('configModel.visibilitySettings.positions', function(newVal) { + $scope.isPositionVisLoading = false; + if(newVal){ + + $scope.configModel.visibilitySettings.positionTableAttrs = [{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), + value: 'fs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), + value: 'extMark' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + value: 'ircs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + value: 'cfr' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + value: 'name' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_date'), + value: 'posTime' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_lon'), + value: 'lon' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_lat'), + value: 'lat' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_status'), + value: 'stat' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_measured_speed'), + value: 'm_spd' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_calculated_speed'), + value: 'c_spd' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_course'), + value: 'crs' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_msg_type'), + value: 'msg_tp' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_activity_type'), + value: 'act_tp' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_source'), + value: 'source' + }]; + + $scope.configModel.visibilitySettings.positionPopupAttrs = [{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), + value: 'fs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), + value: 'extMark' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + value: 'ircs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + value: 'cfr' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + value: 'name' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_date'), + value: 'posTime' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_lon'), + value: 'lon' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_lat'), + value: 'lat' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_status'), + value: 'stat' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_measured_speed'), + value: 'm_spd' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_calculated_speed'), + value: 'c_spd' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_course'), + value: 'crs' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_msg_type'), + value: 'msg_tp' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_activity_type'), + value: 'act_tp' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_source'), + value: 'source' + }]; + + $scope.configModel.visibilitySettings.positionLabelAttrs = [{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), + value: 'fs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), + value: 'extMark' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + value: 'ircs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + value: 'cfr' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + value: 'name' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_date'), + value: 'posTime' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_lon'), + value: 'lon' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_lat'), + value: 'lat' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_status'), + value: 'stat' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_measured_speed'), + value: 'm_spd' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_calculated_speed'), + value: 'c_spd' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_course'), + value: 'crs' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_msg_type'), + value: 'msg_tp' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_activity_type'), + value: 'act_tp' + },{ + title: locale.getString('spatial.tab_vms_pos_table_header_source'), + value: 'source' + }]; + + var contentTypes = ['Table','Popup','Label']; + angular.forEach(contentTypes, function(contentType) { + var positions = []; + var positionVisibilitySettings = $scope.configModel.visibilitySettings.positions[contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; + var positionVisibilityAttrs = $scope.configModel.visibilitySettings['position' + contentType + 'Attrs']; + + if(positionVisibilitySettings.order && positionVisibilitySettings.order.length > 0){ + angular.forEach(positionVisibilitySettings.order, function(item) { + for(var i=0;i. -*/ -.positionsVisiblity { - .table-no-border { - border: 0; - th { - border-bottom: 0; - text-align: center; - text-transform: uppercase; - color: #777; - } - td { - text-align: center; - } - td:first-child { - text-align: justify; - font-weight: bold; - color: #777; - } - } - .noPadding { - padding: 0px !important; - } - .form-group { - margin-bottom: 0px; - } -} +/* +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . +*/ +.positionsVisiblity { + .table-no-border { + border: 0; + th { + border-bottom: 0; + text-align: center; + text-transform: uppercase; + color: #777; + } + td { + text-align: center; + } + td:first-child { + text-align: justify; + font-weight: bold; + color: #777; + } + } + .noPadding { + padding: 0px !important; + } + .form-group { + margin-bottom: 0px; + } + .lb-name { + right: 30px !important; + } +} diff --git a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.html b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.html index eab6ba9bc..8144ae9fb 100644 --- a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.html +++ b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.html @@ -1,89 +1,93 @@ - -
-
-
- - - - - - - - - - - - - - - - - - - - -
- {{'spatial.visibility_configuration_table' | i18n}} - - - {{'spatial.visibility_configuration_popup' | i18n}} - - - {{'spatial.visibility_configuration_label' | i18n}} - -
-
    -
  • -
    :::
    - {{attr.title}} - -
  • -
-
-
    -
  • -
    :::
    - {{attr.title}} - -
  • -
-
-
    -
  • -
    :::
    - {{attr.title}} - -
  • -
-
- {{'spatial.visibility_show_attr_names' | i18n}} - - - {{'spatial.visibility_show_attr_names' | i18n}} - -
-
-
-
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{'spatial.visibility_configuration_table' | i18n}} + + + {{'spatial.visibility_configuration_popup' | i18n}} + + + + {{'spatial.visibility_configuration_label' | i18n}} + + +
+
    +
  • +
    :::
    + {{attr.title}} + +
  • +
+
+
    +
  • +
    :::
    + {{attr.title}} + + +
  • +
+
+
    +
  • +
    :::
    + {{attr.title}} + + +
  • +
+
+
+
+
diff --git a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.js b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.js index 048f4e894..c0c62c6ff 100644 --- a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.js +++ b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.js @@ -1,147 +1,153 @@ /* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . -*/ -angular.module('unionvmsWeb').controller('SegmentsvisibilityCtrl',function($scope, locale){ - - $scope.$watch('configModel.visibilitySettings.segments', function(newVal) { - if(newVal){ - $scope.configModel.visibilitySettings.segmentTableAttrs = [{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), - value: 'fs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), - value: 'extMark' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), - value: 'ircs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), - value: 'cfr' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), - value: 'name' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_distance'), - value: 'dist' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_duration'), - value: 'dur' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_speed_ground'), - value: 'spd' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_course_ground'), - value: 'crs' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_category'), - value: 'cat' - }]; - - $scope.configModel.visibilitySettings.segmentPopupAttrs = [{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), - value: 'fs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), - value: 'extMark' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), - value: 'ircs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), - value: 'cfr' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), - value: 'name' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_distance'), - value: 'dist' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_duration'), - value: 'dur' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_speed_ground'), - value: 'spd' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_course_ground'), - value: 'crs' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_category'), - value: 'cat' - }]; - - $scope.configModel.visibilitySettings.segmentLabelAttrs = [{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), - value: 'fs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), - value: 'extMark' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), - value: 'ircs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), - value: 'cfr' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), - value: 'name' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_distance'), - value: 'dist' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_duration'), - value: 'dur' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_speed_ground'), - value: 'spd' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_course_ground'), - value: 'crs' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_category'), - value: 'cat' - }]; - - var contentTypes = ['Table','Popup','Label']; - angular.forEach(contentTypes, function(contentType) { - var segments = []; - var segmentVisibilitySettings = $scope.configModel.visibilitySettings.segments[contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; - var segmentVisibilityAttrs = $scope.configModel.visibilitySettings['segment' + contentType + 'Attrs']; - - if(segmentVisibilitySettings.order && segmentVisibilitySettings.order.length > 0){ - angular.forEach(segmentVisibilitySettings.order, function(item) { - for(var i=0;i. +*/ +angular.module('unionvmsWeb').controller('SegmentsvisibilityCtrl',function($scope, locale){ + + $scope.$watch('configModel.visibilitySettings.segments', function(newVal) { + if(newVal){ + $scope.configModel.visibilitySettings.segmentTableAttrs = [{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), + value: 'fs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), + value: 'extMark' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + value: 'ircs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + value: 'cfr' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + value: 'name' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_distance'), + value: 'dist' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_duration'), + value: 'dur' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_speed_ground'), + value: 'spd' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_course_ground'), + value: 'crs' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_category'), + value: 'cat' + }]; + + $scope.configModel.visibilitySettings.segmentPopupAttrs = [{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), + value: 'fs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), + value: 'extMark' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + value: 'ircs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + value: 'cfr' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + value: 'name' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_distance'), + value: 'dist' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_duration'), + value: 'dur' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_speed_ground'), + value: 'spd' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_course_ground'), + value: 'crs' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_category'), + value: 'cat' + }]; + + $scope.configModel.visibilitySettings.segmentLabelAttrs = [{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), + value: 'fs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), + value: 'extMark' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + value: 'ircs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + value: 'cfr' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + value: 'name' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_distance'), + value: 'dist' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_duration'), + value: 'dur' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_speed_ground'), + value: 'spd' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_course_ground'), + value: 'crs' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_category'), + value: 'cat' + }]; + + var contentTypes = ['Table','Popup','Label']; + angular.forEach(contentTypes, function(contentType) { + var segments = []; + var segmentVisibilitySettings = $scope.configModel.visibilitySettings.segments[contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; + var segmentVisibilityAttrs = $scope.configModel.visibilitySettings['segment' + contentType + 'Attrs']; + + if(segmentVisibilitySettings.order && segmentVisibilitySettings.order.length > 0){ + angular.forEach(segmentVisibilitySettings.order, function(item) { + for(var i=0;i. -*/ -.segmentsVisiblity { - .table-no-border { - border: 0; - th { - border-bottom: 0; - text-align: center; - text-transform: uppercase; - color: #777; - } - td { - text-align: center; - } - td:first-child { - text-align: justify; - font-weight: bold; - color: #777; - } - } - .noPadding { - padding: 0px !important; - } - .form-group { - margin-bottom: 0px; - } -} +/* +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . +*/ +.segmentsVisiblity { + .table-no-border { + border: 0; + th { + border-bottom: 0; + text-align: center; + text-transform: uppercase; + color: #777; + } + td { + text-align: center; + } + td:first-child { + text-align: justify; + font-weight: bold; + color: #777; + } + } + .noPadding { + padding: 0px !important; + } + .form-group { + margin-bottom: 0px; + } + .lb-name { + right: 30px !important; + } +} diff --git a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/tracksVisibility/tracksVisibility.html b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/tracksVisibility/tracksVisibility.html index dc6c18f0f..8b31a9b26 100644 --- a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/tracksVisibility/tracksVisibility.html +++ b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/tracksVisibility/tracksVisibility.html @@ -1,45 +1,45 @@ - -
-
-
- - - - - - - - - - - -
- {{'spatial.visibility_configuration_table' | i18n}} - -
-
    -
  • -
    :::
    - {{attr.title}} - -
  • -
-
-
-
-
- + +
+
+
+ + + + + + + + + + + +
+ {{'spatial.visibility_configuration_table' | i18n}} + +
+
    +
  • +
    :::
    + {{attr.title}} + +
  • +
+
+
+
+
+ diff --git a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/tracksVisibility/tracksVisibility.js b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/tracksVisibility/tracksVisibility.js index 1c5813f9a..c3a615db8 100644 --- a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/tracksVisibility/tracksVisibility.js +++ b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/tracksVisibility/tracksVisibility.js @@ -1,129 +1,129 @@ /* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . -*/ -angular.module('unionvmsWeb').controller('TracksvisibilityCtrl',function($scope, locale){ - - $scope.$watch('configModel.visibilitySettings.tracks', function(newVal) { - if(newVal){ - $scope.configModel.visibilitySettings.trackTableAttrs = [{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), - value: 'fs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), - value: 'extMark' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), - value: 'ircs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), - value: 'cfr' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), - value: 'name' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_distance'), - value: 'dist' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_duration'), - value: 'dur' - },{ - title: locale.getString('spatial.reports_form_vms_tracks_time_at_sea'), - value: 'timeSea' - }]; - - $scope.configModel.visibilitySettings.trackPopupAttrs = [{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), - value: 'fs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), - value: 'extMark' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), - value: 'ircs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), - value: 'cfr' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), - value: 'name' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_distance'), - value: 'dist' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_duration'), - value: 'dur' - },{ - title: locale.getString('spatial.reports_form_vms_tracks_time_at_sea'), - value: 'timeSea' - }]; - - $scope.configModel.visibilitySettings.trackLabelAttrs = [{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), - value: 'fs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), - value: 'extMark' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), - value: 'ircs' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), - value: 'cfr' - },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), - value: 'name' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_distance'), - value: 'dist' - },{ - title: locale.getString('spatial.tab_vms_seg_table_header_duration'), - value: 'dur' - },{ - title: locale.getString('spatial.reports_form_vms_tracks_time_at_sea'), - value: 'timeSea' - }]; - - var contentTypes = ['Table']; - angular.forEach(contentTypes, function(contentType) { - var tracks = []; - var trackVisibilitySettings = $scope.configModel.visibilitySettings.tracks[contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; - var trackVisibilityAttrs = $scope.configModel.visibilitySettings['track' + contentType + 'Attrs']; - - if(trackVisibilitySettings.order && trackVisibilitySettings.order.length > 0){ - angular.forEach(trackVisibilitySettings.order, function(item) { - for(var i=0;i. +*/ +angular.module('unionvmsWeb').controller('TracksvisibilityCtrl',function($scope, locale){ + + $scope.$watch('configModel.visibilitySettings.tracks', function(newVal) { + if(newVal){ + $scope.configModel.visibilitySettings.trackTableAttrs = [{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), + value: 'fs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), + value: 'extMark' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + value: 'ircs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + value: 'cfr' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + value: 'name' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_distance'), + value: 'dist' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_duration'), + value: 'dur' + },{ + title: locale.getString('spatial.reports_form_vms_tracks_time_at_sea'), + value: 'timeSea' + }]; + + $scope.configModel.visibilitySettings.trackPopupAttrs = [{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), + value: 'fs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), + value: 'extMark' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + value: 'ircs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + value: 'cfr' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + value: 'name' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_distance'), + value: 'dist' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_duration'), + value: 'dur' + },{ + title: locale.getString('spatial.reports_form_vms_tracks_time_at_sea'), + value: 'timeSea' + }]; + + $scope.configModel.visibilitySettings.trackLabelAttrs = [{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), + value: 'fs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), + value: 'extMark' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + value: 'ircs' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + value: 'cfr' + },{ + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + value: 'name' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_distance'), + value: 'dist' + },{ + title: locale.getString('spatial.tab_vms_seg_table_header_duration'), + value: 'dur' + },{ + title: locale.getString('spatial.reports_form_vms_tracks_time_at_sea'), + value: 'timeSea' + }]; + + var contentTypes = ['Table']; + angular.forEach(contentTypes, function(contentType) { + var tracks = []; + var trackVisibilitySettings = $scope.configModel.visibilitySettings.tracks[contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; + var trackVisibilityAttrs = $scope.configModel.visibilitySettings['track' + contentType + 'Attrs']; + + if(trackVisibilitySettings.order && trackVisibilitySettings.order.length > 0){ + angular.forEach(trackVisibilitySettings.order, function(item) { + for(var i=0;i. -*/ -angular.module('unionvmsWeb').controller('VisibilitysettingsCtrl',function($scope, locale, $anchorScroll, spatialConfigRestService, spatialConfigAlertService, SpatialConfig, $location, loadingStatus){ - - $scope.status = { - isOpen: false - }; - - $scope.selectedMenu = 'position'; - - var setMenus = function(){ - return [ - { - 'menu': 'position', - 'title': locale.getString('spatial.tab_movements') - }, - { - 'menu': 'segment', - 'title': locale.getString('spatial.tab_segments') - }, - { - 'menu': 'track', - 'title': locale.getString('spatial.tab_tracks') - } - ]; - }; - - $scope.checkComponents = function(){ - var status = false; - var menuToSelect = []; - var counter = 0; - angular.forEach($scope.components.visibility, function(value, key) { - if (!value){ - status = true; - } - menuToSelect.push(value); - counter += 1; - }); - - if (status){ - var states = _.countBy(menuToSelect, function(state){return state;}); - if (states.true === 1){ - var idx = _.indexOf(menuToSelect, true); - if (idx !== -1){ - $scope.selectedMenu = $scope.headerMenus[idx].menu; - } - } - } - - return status; - }; - - $scope.selectAll = { - positions: { - table: true, - popup: true, - label: true - }, - activity: { - table: true, - popup: true, - label: true - }, - segments: { - table: true, - popup: true, - label: true - }, - tracks: { - table: true - } - }; - - locale.ready('spatial').then(function(){ - $scope.headerMenus = setMenus(); - }); - - $scope.selectMenu = function(menu){ - $scope.selectedMenu = menu; - }; - - $scope.dropItem = function(item, list){ - var itemIndex = list.indexOf(item); - if(itemIndex !== 1){ - list.splice(itemIndex, 1); - } - return item; - }; - - $scope.selectAllChange = function(visibilityType,contentType,isListItem,newVal){ - var currentVisibilities = $scope.configModel.visibilitySettings[visibilityType][contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; - if(isListItem){ - var checked = this.checked === true ? 1 : -1; - if(angular.isDefined(currentVisibilities.values) && currentVisibilities.values.length + checked === currentVisibilities.order.length){ - $scope.selectAll[visibilityType][contentType] = true; - }else{ - $scope.selectAll[visibilityType][contentType] = false; - } - }else{ - currentVisibilities.values = []; - if($scope.selectAll[visibilityType][contentType]){ - angular.forEach(currentVisibilities.order, function(item) { - currentVisibilities.values.push(item); - }); - } - - } - }; -}); - +/* +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . +*/ +angular.module('unionvmsWeb').controller('VisibilitysettingsCtrl',function($scope, locale, $anchorScroll, spatialConfigRestService, spatialConfigAlertService, SpatialConfig, $location, loadingStatus){ + + $scope.status = { + isOpen: false + }; + + $scope.selectedMenu = 'position'; + + var setMenus = function(){ + return [ + { + 'menu': 'position', + 'title': locale.getString('spatial.tab_movements') + }, + { + 'menu': 'segment', + 'title': locale.getString('spatial.tab_segments') + }, + { + 'menu': 'track', + 'title': locale.getString('spatial.tab_tracks') + } + ]; + }; + + $scope.checkComponents = function(){ + var status = false; + var menuToSelect = []; + var counter = 0; + angular.forEach($scope.components.visibility, function(value, key) { + if (!value){ + status = true; + } + menuToSelect.push(value); + counter += 1; + }); + + if (status){ + var states = _.countBy(menuToSelect, function(state){return state;}); + if (states.true === 1){ + var idx = _.indexOf(menuToSelect, true); + if (idx !== -1){ + $scope.selectedMenu = $scope.headerMenus[idx].menu; + } + } + } + + return status; + }; + + $scope.selectAll = { + positions: { + table: { + values : true + }, + popup: { + names : true, + values : true + }, + label: { + names : true, + values : true + } + }, + segments: { + table: { + values : true + }, + popup: { + names : true, + values : true + }, + label: { + names : true, + values : true + } + }, + tracks: { + table: { + values : true + } + } + }; + + locale.ready('spatial').then(function(){ + $scope.headerMenus = setMenus(); + }); + + $scope.selectMenu = function(menu){ + $scope.selectedMenu = menu; + }; + + $scope.dropItem = function(item, list){ + var itemIndex = list.indexOf(item); + if(itemIndex !== 1){ + list.splice(itemIndex, 1); + } + return item; + }; + + $scope.isDisabledName = function(visibilityType,contentType,name) { + return !$scope.configModel.visibilitySettings[visibilityType][contentType].values.includes(name); + }; + + $scope.isAllNamesDisabled = function(visibilityType,contentType) { + return $scope.configModel.visibilitySettings[visibilityType][contentType].values.length === 0; + }; + + $scope.onListItemChange = function(columnType,visibilityType,contentType){ + var contentTypeLocal = contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase(); + var currentVisibilities = $scope.configModel.visibilitySettings[visibilityType][contentTypeLocal]; + var checked = this.checked === true ? 1 : -1; + + if(columnType === 'values'){ + if(angular.isDefined(currentVisibilities.values) && currentVisibilities.values.length + checked === currentVisibilities.order.length){ + $scope.selectAll[visibilityType][contentType].values = true; + }else{ + $scope.selectAll[visibilityType][contentType].values = false; + } + + if(angular.isDefined($scope.configModel.visibilitySettings[visibilityType][contentTypeLocal].names)){ + if(checked === -1) { + var itemIndex = $scope.configModel.visibilitySettings[visibilityType][contentTypeLocal].names.indexOf(this.$parent.attr.value); + if(itemIndex !== -1){ + $scope.configModel.visibilitySettings[visibilityType][contentTypeLocal].names.splice(itemIndex, 1); + } + } + var valuesLength = currentVisibilities.values.length + checked; + if(angular.isDefined(currentVisibilities.names) && currentVisibilities.names.length === valuesLength && valuesLength > 0){ + $scope.selectAll[visibilityType][contentType].names = true; + }else{ + $scope.selectAll[visibilityType][contentType].names = false; + } + } + } + else{ + if(angular.isDefined(currentVisibilities.names) && currentVisibilities.names.length + checked === currentVisibilities.values.length){ + $scope.selectAll[visibilityType][contentType].names = true; + }else{ + $scope.selectAll[visibilityType][contentType].names = false; + } + } + }; + + $scope.selectAllNamesChange = function(visibilityType,contentType,newVal){ + var contentTypeLocal = contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase(); + var currentVisibilities = $scope.configModel.visibilitySettings[visibilityType][contentTypeLocal]; + currentVisibilities.names = []; + if($scope.selectAll[visibilityType][contentType].names){ + angular.forEach(currentVisibilities.values, function(item) { + currentVisibilities.names.push(item); + }); + } + }; + $scope.selectAllChange = function(visibilityType,contentType,newVal){ + var contentTypeLocal = contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase(); + var currentVisibilities = $scope.configModel.visibilitySettings[visibilityType][contentTypeLocal]; + currentVisibilities.values = []; + if($scope.selectAll[visibilityType][contentType].values){ + angular.forEach(currentVisibilities.order, function(item) { + currentVisibilities.values.push(item); + }); + } + else{ + $scope.selectAll[visibilityType][contentType].names = this.checked; + $scope.configModel.visibilitySettings[visibilityType][contentTypeLocal].names = []; + } + }; +}); + diff --git a/unionvms-web/app/partial/spatial/templates/label.html b/unionvms-web/app/partial/spatial/templates/label.html index 5dc4f8fb7..83ef00635 100644 --- a/unionvms-web/app/partial/spatial/templates/label.html +++ b/unionvms-web/app/partial/spatial/templates/label.html @@ -1,25 +1,29 @@ - -
- - {{#data}} - - {{#includeTitles}} - - {{/includeTitles}} - - - {{/data}} -
{{getTitle}}: -
{{getValue}}
-
-
+ +
+ + {{#data}} + + {{#includeTitles}} + + {{/includeTitles}} + + + {{/data}} +
+ {{#includeTitle}} + {{getTitle}}: + {{/includeTitle}} + +
{{getValue}}
+
+
diff --git a/unionvms-web/app/partial/spatial/templates/vmspos.html b/unionvms-web/app/partial/spatial/templates/vmspos.html index 71a197165..046dee41a 100644 --- a/unionvms-web/app/partial/spatial/templates/vmspos.html +++ b/unionvms-web/app/partial/spatial/templates/vmspos.html @@ -1,28 +1,32 @@ - -
- - {{#position}} - - {{#showTitles}} - - - {{/showTitles}} - {{^showTitles}} - {{#doDisplay}} - - {{/doDisplay}} - {{/showTitles}} - - {{/position}} -
{{getTitle}}{{getValue}}{{getValue}}
-
+ +
+ + {{#position}} + + {{#showTitles}} + + + {{/showTitles}} + {{^showTitles}} + {{#doDisplay}} + + {{/doDisplay}} + {{/showTitles}} + + {{/position}} +
+ {{#showTitle}} + {{getTitle}} + {{/showTitle}} + {{getValue}}{{getValue}}
+
diff --git a/unionvms-web/app/partial/spatial/templates/vmsseg.html b/unionvms-web/app/partial/spatial/templates/vmsseg.html index d1ca1c716..a03e691f5 100644 --- a/unionvms-web/app/partial/spatial/templates/vmsseg.html +++ b/unionvms-web/app/partial/spatial/templates/vmsseg.html @@ -1,28 +1,32 @@ - -
- - {{#segment}} - - {{#showTitles}} - - - {{/showTitles}} - {{^showTitles}} - {{#doDisplay}} - - {{/doDisplay}} - {{/showTitles}} - - {{/segment}} -
{{getTitle}}{{getValue}}{{getValue}}
-
+ +
+ + {{#segment}} + + {{#showTitles}} + + + {{/showTitles}} + {{^showTitles}} + {{#doDisplay}} + + {{/doDisplay}} + {{/showTitles}} + + {{/segment}} +
+ {{#showTitle}} + {{getTitle}} + {{/showTitle}} + {{getValue}}{{getValue}}
+
diff --git a/unionvms-web/app/service/spatial/mapService.js b/unionvms-web/app/service/spatial/mapService.js index 19e88e6e8..d7ddb3e14 100644 --- a/unionvms-web/app/service/spatial/mapService.js +++ b/unionvms-web/app/service/spatial/mapService.js @@ -1045,7 +1045,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, /** * Set the displayed flag state codes in the styles object - * + * * @memberof mapService * @public * @alias setDisplayedFlagStateCodes @@ -1877,7 +1877,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, /** * Calculates the middle point between the first and last coordinate of a geometry. * To be used with linestring geometries representing segments. - * + * * @memberof mapService * @public * @alias getMiddlePoint @@ -2702,8 +2702,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, //label visibility settings object ms.labelVisibility = { positions: ['fs', 'extMark', 'ircs', 'cfr', 'name', 'posTime', 'lat', 'lon', 'stat', 'm_spd', 'c_spd', 'crs', 'msg_tp', 'act_tp', 'source'], + positionsNames: ['fs', 'extMark', 'ircs', 'cfr', 'name', 'posTime', 'lat', 'lon', 'stat', 'm_spd', 'c_spd', 'crs', 'msg_tp', 'act_tp', 'source'], positionsTitles: true, segments: ['fs', 'extMark', 'ircs', 'cfr', 'name', 'dist', 'dur', 'spd', 'crs', 'cat'], + segmentsNames: ['fs', 'extMark', 'ircs', 'cfr', 'name', 'dist', 'dur', 'spd', 'crs', 'cat'], segmentsTitles: true, activities: ['fs', 'ext_mark', 'ircs', 'cfr', 'gfcm', 'iccat', 'uvi', 'name', 'source', 'activityType', 'reportType', 'purposeCode', 'occurrence', 'areas', 'gears', 'species'], activitiesTitles: true @@ -2721,6 +2723,9 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.setLabelVisibility = function(type, config){ ms.labelVisibility[type] = config.values; ms.labelVisibility[type + 'Titles'] = angular.isDefined(config.isAttributeVisible) ? config.isAttributeVisible : false; + if(type !== 'activities'){ + ms.labelVisibility[type + 'Names'] = angular.isDefined(config.names) ? config.names : []; + } if (!angular.isDefined(ms.labelVisibility[type])){ ms.labelVisibility[type] = []; } @@ -2988,7 +2993,20 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, feature.set('overlayId', overlayId); feature.set('overlayHidden', false); }; - + ms.getLabelAttrName = function(titles,type,index){ + var name = ms.labelVisibility[type][index]; + var found = false; + for(var i =0; i < ms.labelVisibility[type+'Names'].length; i++){ + if(name === ms.labelVisibility[type+'Names'][i]){ + found = true; + break; + } + } + if(found) { + return titles[name]; + } + return ''; + }; /** * Build the label object that will be used with Mustache * @@ -3004,13 +3022,13 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var titles, srcData, showTitles, i; var data = []; if (type === 'vmspos'){ - showTitles = ms.labelVisibility.positionsTitles; + showTitles = ms.labelVisibility.positionsNames.length > 0; titles = ms.getPositionTitles(); srcData = ms.formatPositionDataForPopup(feature.getProperties()); for (i = 0; i < ms.labelVisibility.positions.length; i++){ data.push({ - title: titles[ms.labelVisibility.positions[i]], + title: ms.getLabelAttrName(titles,'positions',i), value: srcData[ms.labelVisibility.positions[i]] }); } @@ -3026,13 +3044,13 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, }); } } else { - showTitles = ms.labelVisibility.segmentsTitles; + showTitles = ms.labelVisibility.segmentsNames.length > 0; titles = ms.getSegmentTitles(); srcData = ms.formatSegmentDataForPopup(feature.getProperties()); for (i = 0; i < ms.labelVisibility.segments.length; i++){ data.push({ - title: titles[ms.labelVisibility.segments[i]], + title: ms.getLabelAttrName(titles,'segments',i), value: srcData[ms.labelVisibility.segments[i]] }); } @@ -3043,6 +3061,9 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, id: id, data: data, includeTitles: showTitles, + includeTitle: function(){ + return this.title !== ''; + }, getTitle: function(){ return this.title; }, @@ -3193,7 +3214,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, return overlay; }; - + /** * Close OL popup overlay * @@ -3211,8 +3232,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, //Popup visibility settings object ms.popupVisibility = { positions: ['fs', 'extMark', 'ircs', 'cfr', 'name', 'posTime', 'lat', 'lon', 'stat', 'm_spd', 'c_spd', 'crs', 'msg_tp', 'act_tp', 'source'], + positionsNames: ['fs', 'extMark', 'ircs', 'cfr', 'name', 'posTime', 'lat', 'lon', 'stat', 'm_spd', 'c_spd', 'crs', 'msg_tp', 'act_tp', 'source'], positionsTitles: true, segments: ['fs', 'extMark', 'ircs', 'cfr', 'name', 'dist', 'dur', 'spd', 'crs', 'cat'], + segmentsNames: ['fs', 'extMark', 'ircs', 'cfr', 'name', 'dist', 'dur', 'spd', 'crs', 'cat'], segmentsTitles: true, ers: ['fs', 'ext_mark', 'ircs', 'cfr', 'gfcm', 'iccat', 'uvi', 'name', 'source', 'activityType', 'reportType', 'purposeCode', 'occurrence', 'areas', 'gears', 'species'], ersTitles: true @@ -3221,6 +3244,9 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.setPopupVisibility = function(type, config){ ms.popupVisibility[type] = config.values; ms.popupVisibility[type + 'Titles'] = angular.isDefined(config.isAttributeVisible) ? config.isAttributeVisible: false; + if(type !== 'ers'){ + ms.popupVisibility[type + 'Names'] = angular.isDefined(config.names) ? config.names : []; + } if (!angular.isDefined(ms.popupVisibility[type])){ ms.popupVisibility[type] = []; } @@ -3270,6 +3296,20 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } }; + ms.getPopupAttrName = function(titles,type,index){ + var name = ms.popupVisibility[type][index]; + var found = false; + for(var i =0; i < ms.popupVisibility[type+'Names'].length; i++){ + if(name === ms.popupVisibility[type+'Names'][i]){ + found = true; + break; + } + } + if(found) { + return titles[name]; + } + return ''; + }; //POPUP - Define the object that will be used in the popup for vms positions /** * Create object containing all the necessary position information to be displayed in the popup @@ -3284,21 +3324,24 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.setPositionsObjPopup = function(feature, id){ var titles = ms.getPositionTitles(); var srcData = ms.formatPositionDataForPopup(feature); - + var showAttrNames = ms.popupVisibility.positions.length > 0; var data = []; for (var i = 0; i < ms.popupVisibility.positions.length; i++){ data.push({ - title: titles[ms.popupVisibility.positions[i]], + title: ms.getPopupAttrName(titles,'positions',i), value: srcData[ms.popupVisibility.positions[i]] }); } - + return { - showTitles: ms.popupVisibility.positionsTitles, + showTitles: showAttrNames, position: data, id: id, vesselName: feature.name, vesselId: feature.connectionId, + showTitle: function(){ + return this.title !== ''; + }, getTitle: function(){ return this.title; }, @@ -3455,18 +3498,21 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.setSegmentsObjPopup = function(feature){ var titles = ms.getSegmentTitles(); var srcData = ms.formatSegmentDataForPopup(feature); - + var showAttrNames = ms.popupVisibility.segmentsNames.length > 0; var data = []; for (var i = 0; i < ms.popupVisibility.segments.length; i++){ data.push({ - title: titles[ms.popupVisibility.segments[i]], + title: ms.getPopupAttrName(titles,'segments',i), value: srcData[ms.popupVisibility.segments[i]] }); } - + return { - showTitles: ms.popupVisibility.segmentsTitles, + showTitles: showAttrNames, segment: data, + showTitle: function(){ + return this.title !== ''; + }, getTitle: function(){ return this.title; }, From ce0541df3301ce0e5d2f167d79bd3647237aa0ea Mon Sep 17 00:00:00 2001 From: lsotiriadis Date: Mon, 24 Aug 2020 17:03:55 +0300 Subject: [PATCH 12/33] [UNIONVMS-4752] Added allowance in user config to add replacement attribute title Signed-off-by: lsotiriadis --- .../configurations/spatialConfigModel.js | 21 +++++-- .../positionsVisibility.html | 15 +---- .../positionsVisibility.js | 23 ++++++-- .../positionsVisibility.less | 7 +++ .../segmentsVisibility.html | 13 +---- .../segmentsVisibility/segmentsVisibility.js | 23 ++++++-- .../segmentsVisibility.less | 7 +++ .../visibilitySettings/visibilitySettings.js | 5 +- .../app/service/spatial/mapService.js | 58 +++++++++++++++---- 9 files changed, 123 insertions(+), 49 deletions(-) diff --git a/unionvms-web/app/partial/spatial/configurations/spatialConfigModel.js b/unionvms-web/app/partial/spatial/configurations/spatialConfigModel.js index e5dce1fcb..60220b071 100644 --- a/unionvms-web/app/partial/spatial/configurations/spatialConfigModel.js +++ b/unionvms-web/app/partial/spatial/configurations/spatialConfigModel.js @@ -63,7 +63,8 @@ angular.module('unionvmsWeb').factory('SpatialConfig',function() { labels: { names:{}, values:{} - } + }, + titles:{} }, segments: { table: { @@ -76,7 +77,8 @@ angular.module('unionvmsWeb').factory('SpatialConfig',function() { labels: { names:{}, values:{} - } + }, + titles:{} }, tracks: { table: { @@ -368,19 +370,28 @@ angular.module('unionvmsWeb').factory('SpatialConfig',function() { if(visibType !== 'track' || visibType === 'track' && contentType === 'Table'){ var visibilityCurrentSettings = model.visibilitySettings[visibType + 's'][contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; var visibilityCurrentAttrs = model.visibilitySettings[visibType + contentType + 'Attrs']; + var visibilityCurrentTitles = model.visibilitySettings[visibType + "s"]["form" + contentType + 'Titles']; var visibilities = {}; visibilities.names = []; visibilities.values = []; visibilities.order = []; + visibilities.titles = []; visibilities.isAttributeVisible = visibilityCurrentSettings.isAttributeVisible; - var content; + var attr; for(var i = 0; i < visibilityCurrentAttrs.length; i++){ - visibilities.order.push(visibilityCurrentAttrs[i].value); + var code = visibilityCurrentAttrs[i].value; + visibilities.order.push(code); + if(angular.isDefined(visibilityCurrentTitles)){ + attr = visibilityCurrentTitles[code]; + if(angular.isDefined(attr) && attr.trim().length > 0) { + visibilities.titles.push({"code":code,"title":attr}); + } + } } if(angular.isDefined(visibilityCurrentSettings.values)){ for(var j = 0; j < visibilities.order.length; j++){ - var attr = visibilities.order[j]; + attr = visibilities.order[j]; if(visibilityCurrentSettings.values.indexOf(attr) !== -1){ visibilities.values.push(attr); } diff --git a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.html b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.html index d6f2d5fa3..3ab46fb10 100644 --- a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.html +++ b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.html @@ -45,7 +45,7 @@ dnd-moved="configModel.visibilitySettings.positionTableAttrs.splice($index, 1);visibilitySettingsForm.$setDirty();">
:::
{{attr.title}} - + @@ -58,6 +58,7 @@ dnd-moved="configModel.visibilitySettings.positionPopupAttrs.splice($index, 1);visibilitySettingsForm.$setDirty();">
:::
{{attr.title}} + @@ -72,23 +73,13 @@ dnd-moved="configModel.visibilitySettings.positionLabelAttrs.splice($index, 1);visibilitySettingsForm.$setDirty();">
:::
{{attr.title}} + - - - - - - - - - - - diff --git a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.js b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.js index 3b83fd585..064545e3d 100644 --- a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.js +++ b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.js @@ -109,7 +109,8 @@ angular.module('unionvmsWeb').controller('PositionsvisibilityCtrl',function($sco title: locale.getString('spatial.tab_vms_pos_table_header_source'), value: 'source' }]; - + $scope.configModel.visibilitySettings.positions.formPopupTitles = {}; + $scope.configModel.visibilitySettings.positionLabelAttrs = [{ title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), value: 'fs' @@ -156,19 +157,31 @@ angular.module('unionvmsWeb').controller('PositionsvisibilityCtrl',function($sco title: locale.getString('spatial.tab_vms_pos_table_header_source'), value: 'source' }]; - + $scope.configModel.visibilitySettings.positions.formLabelTitles = {}; + var contentTypes = ['Table','Popup','Label']; angular.forEach(contentTypes, function(contentType) { var positions = []; - var positionVisibilitySettings = $scope.configModel.visibilitySettings.positions[contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; + var contentTypeLocal = contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase(); + var positionVisibilitySettings = $scope.configModel.visibilitySettings.positions[contentTypeLocal]; var positionVisibilityAttrs = $scope.configModel.visibilitySettings['position' + contentType + 'Attrs']; - + var positionVisibilityTitles = $scope.configModel.visibilitySettings.positions[contentTypeLocal].titles; + if(positionVisibilitySettings.order && positionVisibilitySettings.order.length > 0){ angular.forEach(positionVisibilitySettings.order, function(item) { for(var i=0;i tbody > tr > td > ul > li input.replacement { + width: auto; + right: initial; + margin-left: 10px; + top: 5px; + height: 30px; + } } diff --git a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.html b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.html index 8144ae9fb..ae4ae3320 100644 --- a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.html +++ b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.html @@ -55,6 +55,7 @@ dnd-moved="configModel.visibilitySettings.segmentPopupAttrs.splice($index, 1);visibilitySettingsForm.$setDirty();">
:::
{{attr.title}} + @@ -69,23 +70,13 @@ dnd-moved="configModel.visibilitySettings.segmentLabelAttrs.splice($index, 1);visibilitySettingsForm.$setDirty();">
:::
{{attr.title}} + - - - - - - - - - - - diff --git a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.js b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.js index c0c62c6ff..489b3ed80 100644 --- a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.js +++ b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/segmentsVisibility/segmentsVisibility.js @@ -76,7 +76,8 @@ angular.module('unionvmsWeb').controller('SegmentsvisibilityCtrl',function($scop title: locale.getString('spatial.tab_vms_seg_table_header_category'), value: 'cat' }]; - + $scope.configModel.visibilitySettings.segments.formPopupTitles = {}; + $scope.configModel.visibilitySettings.segmentLabelAttrs = [{ title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), value: 'fs' @@ -108,19 +109,31 @@ angular.module('unionvmsWeb').controller('SegmentsvisibilityCtrl',function($scop title: locale.getString('spatial.tab_vms_seg_table_header_category'), value: 'cat' }]; - + $scope.configModel.visibilitySettings.segments.formLabelTitles = {}; + var contentTypes = ['Table','Popup','Label']; angular.forEach(contentTypes, function(contentType) { var segments = []; - var segmentVisibilitySettings = $scope.configModel.visibilitySettings.segments[contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; + var contentTypeLocal = contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase(); + var segmentVisibilitySettings = $scope.configModel.visibilitySettings.segments[contentTypeLocal]; var segmentVisibilityAttrs = $scope.configModel.visibilitySettings['segment' + contentType + 'Attrs']; - + var segmentVisibilityTitles = $scope.configModel.visibilitySettings.segments[contentTypeLocal].titles; + if(segmentVisibilitySettings.order && segmentVisibilitySettings.order.length > 0){ angular.forEach(segmentVisibilitySettings.order, function(item) { for(var i=0;i tbody > tr > td > ul > li input.replacement { + width: auto; + right: initial; + margin-left: 10px; + top: 5px; + height: 30px; + } } diff --git a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/visibilitySettings.js b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/visibilitySettings.js index ccdf2adee..5a935a556 100644 --- a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/visibilitySettings.js +++ b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/visibilitySettings.js @@ -110,7 +110,10 @@ angular.module('unionvmsWeb').controller('VisibilitysettingsCtrl',function($scop }; $scope.isDisabledName = function(visibilityType,contentType,name) { - return !$scope.configModel.visibilitySettings[visibilityType][contentType].values.includes(name); + if($scope.configModel.visibilitySettings[visibilityType][contentType].values.length > 0) { + return !$scope.configModel.visibilitySettings[visibilityType][contentType].values.includes(name); + } + return true; }; $scope.isAllNamesDisabled = function(visibilityType,contentType) { diff --git a/unionvms-web/app/service/spatial/mapService.js b/unionvms-web/app/service/spatial/mapService.js index d7ddb3e14..667875014 100644 --- a/unionvms-web/app/service/spatial/mapService.js +++ b/unionvms-web/app/service/spatial/mapService.js @@ -2723,6 +2723,17 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.setLabelVisibility = function(type, config){ ms.labelVisibility[type] = config.values; ms.labelVisibility[type + 'Titles'] = angular.isDefined(config.isAttributeVisible) ? config.isAttributeVisible : false; + ms.labelVisibility[type + 'ReplacementTitles'] = undefined; + + if(angular.isDefined(config.titles) && config.titles.length > 0){ + var replacements = {}; + angular.forEach(config.titles,function(item){ + var key = item.code; + replacements[key] = item.title; + }); + ms.labelVisibility[type + 'ReplacementTitles'] = replacements; + } + if(type !== 'activities'){ ms.labelVisibility[type + 'Names'] = angular.isDefined(config.names) ? config.names : []; } @@ -2993,7 +3004,8 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, feature.set('overlayId', overlayId); feature.set('overlayHidden', false); }; - ms.getLabelAttrName = function(titles,type,index){ + + ms.getLabelAttrName = function(titles,replacementTitles,type,index){ var name = ms.labelVisibility[type][index]; var found = false; for(var i =0; i < ms.labelVisibility[type+'Names'].length; i++){ @@ -3003,7 +3015,14 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } } if(found) { - return titles[name]; + var title ; + if(angular.isDefined(replacementTitles)){ + title = replacementTitles[name]; + } + if(!angular.isDefined(title)){ + title = titles[name]; + } + return title; } return ''; }; @@ -3019,16 +3038,17 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, * @returns {Object} The object containing all the necessary data for the label */ ms.setLabelObj = function(feature, type, id){ - var titles, srcData, showTitles, i; + var titles, replacementTitles, srcData, showTitles, i; var data = []; if (type === 'vmspos'){ showTitles = ms.labelVisibility.positionsNames.length > 0; titles = ms.getPositionTitles(); + replacementTitles = ms.labelVisibility.positionsReplacementTitles; srcData = ms.formatPositionDataForPopup(feature.getProperties()); for (i = 0; i < ms.labelVisibility.positions.length; i++){ data.push({ - title: ms.getLabelAttrName(titles,'positions',i), + title: ms.getLabelAttrName(titles,replacementTitles,'positions',i), value: srcData[ms.labelVisibility.positions[i]] }); } @@ -3045,12 +3065,13 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } } else { showTitles = ms.labelVisibility.segmentsNames.length > 0; + replacementTitles = ms.labelVisibility.segmentsReplacementTitles; titles = ms.getSegmentTitles(); srcData = ms.formatSegmentDataForPopup(feature.getProperties()); for (i = 0; i < ms.labelVisibility.segments.length; i++){ data.push({ - title: ms.getLabelAttrName(titles,'segments',i), + title: ms.getLabelAttrName(titles,replacementTitles,'segments',i), value: srcData[ms.labelVisibility.segments[i]] }); } @@ -3244,6 +3265,15 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.setPopupVisibility = function(type, config){ ms.popupVisibility[type] = config.values; ms.popupVisibility[type + 'Titles'] = angular.isDefined(config.isAttributeVisible) ? config.isAttributeVisible: false; + ms.popupVisibility[type + 'ReplacementTitles'] = undefined; + if(angular.isDefined(config.titles) && config.titles.length > 0){ + var replacements = {}; + angular.forEach(config.titles,function(item){ + var key = item.code; + replacements[key] = item.title; + }); + ms.popupVisibility[type + 'ReplacementTitles'] = replacements; + } if(type !== 'ers'){ ms.popupVisibility[type + 'Names'] = angular.isDefined(config.names) ? config.names : []; } @@ -3296,7 +3326,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } }; - ms.getPopupAttrName = function(titles,type,index){ + ms.getPopupAttrName = function(titles,replacementTitles,type,index){ var name = ms.popupVisibility[type][index]; var found = false; for(var i =0; i < ms.popupVisibility[type+'Names'].length; i++){ @@ -3305,10 +3335,16 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, break; } } + var title = ''; if(found) { - return titles[name]; + if(angular.isDefined(replacementTitles)){ + title = replacementTitles[name]; + } + if(!angular.isDefined(title)){ + title = titles[name]; + } } - return ''; + return title; }; //POPUP - Define the object that will be used in the popup for vms positions /** @@ -3325,10 +3361,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var titles = ms.getPositionTitles(); var srcData = ms.formatPositionDataForPopup(feature); var showAttrNames = ms.popupVisibility.positions.length > 0; + var replacementTitles = ms.popupVisibility.positionsReplacementTitles; var data = []; for (var i = 0; i < ms.popupVisibility.positions.length; i++){ data.push({ - title: ms.getPopupAttrName(titles,'positions',i), + title: ms.getPopupAttrName(titles,replacementTitles,'positions',i), value: srcData[ms.popupVisibility.positions[i]] }); } @@ -3499,10 +3536,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var titles = ms.getSegmentTitles(); var srcData = ms.formatSegmentDataForPopup(feature); var showAttrNames = ms.popupVisibility.segmentsNames.length > 0; + var replacementTitles = ms.popupVisibility.segmentsReplacementTitles; var data = []; for (var i = 0; i < ms.popupVisibility.segments.length; i++){ data.push({ - title: ms.getPopupAttrName(titles,'segments',i), + title: ms.getPopupAttrName(titles,replacementTitles,'segments',i), value: srcData[ms.popupVisibility.segments[i]] }); } From e34f163fb000732c2392da9996ab8fb541fdd0df Mon Sep 17 00:00:00 2001 From: lsotiriadis Date: Tue, 25 Aug 2020 12:05:28 +0300 Subject: [PATCH 13/33] Refactoring: Removed trailing white spaces Signed-off-by: lsotiriadis --- .../positionsVisibility.js | 52 +- .../segmentsVisibility/segmentsVisibility.js | 44 +- .../tracksVisibility/tracksVisibility.js | 44 +- .../app/service/spatial/mapService.js | 931 +++++++++--------- 4 files changed, 535 insertions(+), 536 deletions(-) diff --git a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.js b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.js index 064545e3d..bab9ee128 100644 --- a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.js +++ b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/positionsVisibility/positionsVisibility.js @@ -11,11 +11,11 @@ copy of the GNU General Public License along with the IFDM Suite. If not, see . */ angular.module('unionvmsWeb').controller('SegmentsvisibilityCtrl',function($scope, locale){ - + $scope.$watch('configModel.visibilitySettings.segments', function(newVal) { if(newVal){ $scope.configModel.visibilitySettings.segmentTableAttrs = [{ @@ -20,31 +20,31 @@ angular.module('unionvmsWeb').controller('SegmentsvisibilityCtrl',function($scop title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), value: 'extMark' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), value: 'ircs' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), value: 'cfr' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), value: 'name' },{ title: locale.getString('spatial.tab_vms_seg_table_header_distance'), value: 'dist' },{ - title: locale.getString('spatial.tab_vms_seg_table_header_duration'), + title: locale.getString('spatial.tab_vms_seg_table_header_duration'), value: 'dur' },{ - title: locale.getString('spatial.tab_vms_seg_table_header_speed_ground'), + title: locale.getString('spatial.tab_vms_seg_table_header_speed_ground'), value: 'spd' },{ - title: locale.getString('spatial.tab_vms_seg_table_header_course_ground'), + title: locale.getString('spatial.tab_vms_seg_table_header_course_ground'), value: 'crs' },{ title: locale.getString('spatial.tab_vms_seg_table_header_category'), value: 'cat' }]; - + $scope.configModel.visibilitySettings.segmentPopupAttrs = [{ title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), value: 'fs' @@ -52,25 +52,25 @@ angular.module('unionvmsWeb').controller('SegmentsvisibilityCtrl',function($scop title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), value: 'extMark' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), value: 'ircs' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), value: 'cfr' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), value: 'name' },{ title: locale.getString('spatial.tab_vms_seg_table_header_distance'), value: 'dist' },{ - title: locale.getString('spatial.tab_vms_seg_table_header_duration'), + title: locale.getString('spatial.tab_vms_seg_table_header_duration'), value: 'dur' },{ - title: locale.getString('spatial.tab_vms_seg_table_header_speed_ground'), + title: locale.getString('spatial.tab_vms_seg_table_header_speed_ground'), value: 'spd' },{ - title: locale.getString('spatial.tab_vms_seg_table_header_course_ground'), + title: locale.getString('spatial.tab_vms_seg_table_header_course_ground'), value: 'crs' },{ title: locale.getString('spatial.tab_vms_seg_table_header_category'), @@ -85,25 +85,25 @@ angular.module('unionvmsWeb').controller('SegmentsvisibilityCtrl',function($scop title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), value: 'extMark' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), value: 'ircs' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), value: 'cfr' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), value: 'name' },{ title: locale.getString('spatial.tab_vms_seg_table_header_distance'), value: 'dist' },{ - title: locale.getString('spatial.tab_vms_seg_table_header_duration'), + title: locale.getString('spatial.tab_vms_seg_table_header_duration'), value: 'dur' },{ - title: locale.getString('spatial.tab_vms_seg_table_header_speed_ground'), + title: locale.getString('spatial.tab_vms_seg_table_header_speed_ground'), value: 'spd' },{ - title: locale.getString('spatial.tab_vms_seg_table_header_course_ground'), + title: locale.getString('spatial.tab_vms_seg_table_header_course_ground'), value: 'crs' },{ title: locale.getString('spatial.tab_vms_seg_table_header_category'), @@ -143,11 +143,11 @@ angular.module('unionvmsWeb').controller('SegmentsvisibilityCtrl',function($scop segmentVisibilitySettings.order.push(segmentVisibilityAttrs[i].value); } } - + angular.forEach(segmentVisibilityAttrs, function(item) { item.type = contentType; }); - + if(!angular.isDefined(segmentVisibilitySettings.values) || segmentVisibilitySettings.order.length !== segmentVisibilitySettings.values.length){ $scope.selectAll.segments[contentType.toLowerCase()].values = false; }else{ diff --git a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/tracksVisibility/tracksVisibility.js b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/tracksVisibility/tracksVisibility.js index c3a615db8..789b023d0 100644 --- a/unionvms-web/app/partial/spatial/configurations/visibilitySettings/tracksVisibility/tracksVisibility.js +++ b/unionvms-web/app/partial/spatial/configurations/visibilitySettings/tracksVisibility/tracksVisibility.js @@ -10,7 +10,7 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more d copy of the GNU General Public License along with the IFDM Suite. If not, see . */ angular.module('unionvmsWeb').controller('TracksvisibilityCtrl',function($scope, locale){ - + $scope.$watch('configModel.visibilitySettings.tracks', function(newVal) { if(newVal){ $scope.configModel.visibilitySettings.trackTableAttrs = [{ @@ -20,25 +20,25 @@ angular.module('unionvmsWeb').controller('TracksvisibilityCtrl',function($scope, title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), value: 'extMark' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), value: 'ircs' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), value: 'cfr' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), value: 'name' },{ title: locale.getString('spatial.tab_vms_seg_table_header_distance'), value: 'dist' },{ - title: locale.getString('spatial.tab_vms_seg_table_header_duration'), + title: locale.getString('spatial.tab_vms_seg_table_header_duration'), value: 'dur' },{ - title: locale.getString('spatial.reports_form_vms_tracks_time_at_sea'), + title: locale.getString('spatial.reports_form_vms_tracks_time_at_sea'), value: 'timeSea' }]; - + $scope.configModel.visibilitySettings.trackPopupAttrs = [{ title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), value: 'fs' @@ -46,25 +46,25 @@ angular.module('unionvmsWeb').controller('TracksvisibilityCtrl',function($scope, title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), value: 'extMark' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), value: 'ircs' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), value: 'cfr' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), value: 'name' },{ title: locale.getString('spatial.tab_vms_seg_table_header_distance'), value: 'dist' },{ - title: locale.getString('spatial.tab_vms_seg_table_header_duration'), + title: locale.getString('spatial.tab_vms_seg_table_header_duration'), value: 'dur' },{ - title: locale.getString('spatial.reports_form_vms_tracks_time_at_sea'), + title: locale.getString('spatial.reports_form_vms_tracks_time_at_sea'), value: 'timeSea' }]; - + $scope.configModel.visibilitySettings.trackLabelAttrs = [{ title: locale.getString('spatial.reports_form_vessel_search_table_header_flag_state'), value: 'fs' @@ -72,31 +72,31 @@ angular.module('unionvmsWeb').controller('TracksvisibilityCtrl',function($scope, title: locale.getString('spatial.reports_form_vessel_search_table_header_external_marking'), value: 'extMark' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_ircs'), value: 'ircs' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_cfr'), value: 'cfr' },{ - title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), + title: locale.getString('spatial.reports_form_vessel_search_table_header_name'), value: 'name' },{ title: locale.getString('spatial.tab_vms_seg_table_header_distance'), value: 'dist' },{ - title: locale.getString('spatial.tab_vms_seg_table_header_duration'), + title: locale.getString('spatial.tab_vms_seg_table_header_duration'), value: 'dur' },{ - title: locale.getString('spatial.reports_form_vms_tracks_time_at_sea'), + title: locale.getString('spatial.reports_form_vms_tracks_time_at_sea'), value: 'timeSea' }]; - + var contentTypes = ['Table']; angular.forEach(contentTypes, function(contentType) { var tracks = []; var trackVisibilitySettings = $scope.configModel.visibilitySettings.tracks[contentType.toLowerCase() === 'label' ? contentType.toLowerCase() + 's' : contentType.toLowerCase()]; var trackVisibilityAttrs = $scope.configModel.visibilitySettings['track' + contentType + 'Attrs']; - + if(trackVisibilitySettings.order && trackVisibilitySettings.order.length > 0){ angular.forEach(trackVisibilitySettings.order, function(item) { for(var i=0;i 0){ var positions = selInteraction.getFeatures().getArray()[0].get('features'); @@ -166,12 +166,12 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } } }); - + if (angular.isDefined(record)){ records.push(record); } } - + if (records.length > 0){ ms.popupRecContainer.reset(); var data = ms.setObjPopup(records[0]); @@ -181,15 +181,15 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } } }); - + var view = ms.createView(config.map.projection); map.setView(view); ms.map = map; ms.addBlankLayer(); - + //Remove display none of the popup on initial loading angular.element('#popup').css('display', 'block'); - + ms.map.getViewport().addEventListener('contextmenu', function(e){ e.preventDefault(); var select = ms.getInteractionsByType('Select')[0]; @@ -207,14 +207,14 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, if (selFeatures.getLength() > 0){ selFeatures.clear(); } - + if (feature.get('featNumber') > 1){ selFeatures.push(feature); foundedFeatures = true; } } }); - + if (foundedFeatures === false){ selFeatures.clear(); } else if (foundedFeatures === true && angular.isDefined(ms.overlay) && ms.overlay.get('fromCluster') === true){ @@ -223,22 +223,22 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } } }); - + ms.setDragBoxEvent(ms.map); }; - + /** * Create a OL map view from config object - * + * * @memberof mapService * @public * @alias createView * @param {Object} config - The map configuration object - * @returns {ol.View} The OL map view + * @returns {ol.View} The OL map view */ ms.createView = function(config){ var view = genericMapService.createView(config); - + view.on('change:resolution', function(evt){ //Clear features on expanded clusters when zooming var select = ms.getInteractionsByType('Select')[0]; @@ -248,17 +248,17 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.closePopup(); } } - + layerPanelService.reloadPanels(); //$rootScope.$broadcast('reloadLegend'); }); - + return view; }; - + /** * Update map view with new configuration object - * + * * @memberof mapService * @public * @alias updateMapView @@ -268,31 +268,31 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var view = ms.createView(config); ms.map.setView(view); }; - + /** * Remove all layers from the map - * + * * @memberof mapService * @public * @alias removeAllLayers */ ms.removeAllLayers = function(){ genericMapService.removeAllLayers(ms.map); - + //Always add blank layer ms.addBlankLayer(); }; - + //Add layers /** * Create and add a blank base layer to the map - * + * * @memberof mapService * @public * @alias addBlankLayers */ ms.addBlankLayer = function(){ - var proj = ms.map.getView().getProjection(); + var proj = ms.map.getView().getProjection(); var layer = new ol.layer.Image({ type: 'mapbackground', opacity: 1, @@ -303,14 +303,14 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, imageSize: [256,256] }) }); - + ms.map.addLayer(layer); }; - + //create layer, returns ol.layer.* or undefined /** * Generic function to create all types of layers - * + * * @memberof mapService * @public * @alias createLayer @@ -349,14 +349,14 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, return ( layer ); }; - + /** * Create OpenStreeMap layer - * + * * @memberof mapService * @public * @alias createOsm - * @param {Object} config - The layer configuration object + * @param {Object} config - The layer configuration object * @returns {ol.layer.Tile} The OSM layer */ ms.createOsm = function( config ){ @@ -366,7 +366,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, /** * Create OpenSeaMap layer - * + * * @memberof mapService * @public * @alias createOseam @@ -377,10 +377,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var layer = genericMapService.defineOseam(config); return (layer); }; - + /** * Create BING layers - * + * * @memberof mapService * @public * @alias createBing @@ -395,20 +395,20 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, //create WMS tile layer /** * Create WMS layers - * + * * @memberof mapService * @public * @alias createWms * @param {Object} config - The layer configuration object - * @returns {ol.layer.Tile} - The WMS layer + * @returns {ol.layer.Tile} - The WMS layer */ ms.createWms = function( config ){ var layer = genericMapService.defineWms(config); - layer.set('serverType', config.serverType); - + layer.set('serverType', config.serverType); + return ( layer ); }; - + //Map graticule ms.graticuleFormat = 'dms'; ms.mapGraticule = new ol.Graticule({ @@ -422,7 +422,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, }); /** * Set mapGraticule in the current map according to a specified visibility status - * + * * @memberof mapService * @public * @alias setGraticule @@ -435,11 +435,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.mapGraticule.setMap(ms.map); } }; - + //Add alarms layer /** * Create alarms layer - * + * * @memberof mapService * @public * @alias createAlarmsLayer @@ -450,27 +450,27 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var attribution = new ol.Attribution({ html: locale.getString('spatial.alarms_copyright') }); - + var source = new ol.source.Vector({ attributions: [attribution], features: (new ol.format.GeoJSON()).readFeatures(config.geoJson) }); - + var layer = new ol.layer.Vector({ title: config.title, type: config.type, longAttribution: config.longAttribution, isBaseLayer: false, source: source, - style: ms.setAlarmsStyle + style: ms.setAlarmsStyle }); - + return( layer ); }; - + /** * Create fishing activities layer - * + * * @memberof mapService * @public * @alias createActivityLayer @@ -481,17 +481,17 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var attribution = new ol.Attribution({ html: locale.getString('spatial.activities_copyright') }); - + var features = (new ol.format.GeoJSON()).readFeatures(config.geoJson, { dataProjection: 'EPSG:4326', featureProjection: ms.getMapProjectionCode() }); - + var source = new ol.source.Vector({ attributions: [attribution], features: features }); - + var layer = new ol.layer.Vector({ title: config.title, type: config.type, @@ -500,13 +500,13 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, source: source, style: ms.setActivitiesStyle }); - + return( layer ); }; /** * Create VMS positions layer - * + * * @memberof mapService * @public * @alias createPositionsLayer @@ -518,28 +518,28 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, dataProjection: 'EPSG:4326', featureProjection: ms.getMapProjectionCode() }); - + var count = 0; angular.forEach(features, function(feature) { count += 1; feature.setId(count); feature.set('isVisible', true); }); - + var source = new ol.source.Vector({ - features: features + features: features }); - + var attribution = new ol.Attribution({ html: locale.getString('spatial.vms_positions_copyright') }); - + var cluster = new ol.source.Cluster({ attributions: [attribution], distance: 20, source: source }); - + cluster.on('change', function(e){ //hide popup if position is clustered if (angular.isDefined(ms.overlay)){ @@ -554,14 +554,14 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, visible = true; } }); - + if (!visible){ ms.closePopup(); } } } }); - + var layer = new ol.layer.Vector({ title: config.title, type: config.type, @@ -570,15 +570,15 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, source: cluster, style: ms.setClusterStyle }); - + ms.addClusterExploder(layer); - + return( layer ); }; - + /** * Zoom to the extent containing all VMS positions - * + * * @memberof mapService * @public * @alias zoomToPositionsLayer @@ -599,10 +599,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, }); } }; - + /** * Create and add map interaction to explode the clusters (VMS positions) - * + * * @memberof mapService * @public * @alias addClusterExploder @@ -619,10 +619,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.map.addInteraction(exploder); }; - + /** * Collapse expanded clusters - * + * * @memberof mapService * @public */ @@ -632,10 +632,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, select.getFeatures().clear(); } }; - + /** * Create VMS segements layer - * + * * @memberof mapService * @public * @alias createSegmentsLayer @@ -646,7 +646,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var attribution = new ol.Attribution({ html: locale.getString('spatial.vms_segments_copyright') }); - + var layer = new ol.layer.Image({ title: config.title, type: config.type, @@ -663,14 +663,14 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, style: ms.setSegStyle }) }); - + return( layer ); }; - + //Clear vms data from layers /** * Clear vms data from vector layers (VMS positions and segments) - * + * * @memberof mapService * @public * @alias clearVmsLayers @@ -683,12 +683,12 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } } }; - + //MAPFISH PRINT //Add printing extent layer /** * Create and add map layer to show the printing extent supported by the mapfish print server - * + * * @memberof mapService * @public * @alias addPrintLayer @@ -705,24 +705,24 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.map.addLayer(layer); }; - + ms.mapPrintResolution = undefined; - + /** * Add print extent vector feature to the printing layer - * + * * @memberof mapService * @public * @alias addPrintExtent */ ms.addPrintExtent = function(){ ms.mapPrintResolution = ms.map.getView().getResolution(); - + var mapSize = ms.map.getSize(); var currentMapRatio = mapSize[0] / mapSize[1]; var scaleFactor = 0.9; var desiredPrintRatio = MapFish.printMapSize[0] / MapFish.printMapSize[1]; - + var targetWidth, targetHeight; if (desiredPrintRatio >= currentMapRatio){ targetWidth = mapSize[0] * scaleFactor; @@ -731,18 +731,18 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, targetHeight = mapSize[1] * scaleFactor; targetWidth = targetHeight * desiredPrintRatio; } - + var geomExtent = ms.map.getView().calculateExtent([targetWidth, targetHeight]); var printFeature = new ol.Feature(ol.geom.Polygon.fromExtent(geomExtent)); - + var layer = ms.getLayerByType('print').getSource(); layer.clear(true); layer.addFeature(printFeature); }; - + /** * Create and add a vector layer to display OSM Nominatim search results - * + * * @memberof mapService * @public * @alias addNominatimLayer @@ -757,15 +757,15 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, }), style: ms.setNominatimStyle }); - + ms.map.addLayer(layer); - + return layer; }; - + /** * Create and add vector layer used to highlight vector features in the map - * + * * @memberof mapService * @public * @alias addFeatureOverlay @@ -785,7 +785,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, /** * Highlight feature in the map - * + * * @memberof mapService * @public * @alias highlightFeature @@ -800,10 +800,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, layer.clear(true); layer.addFeature(feature); }; - + /** * Create and add a vector layer for measurement controls - * + * * @memberof mapService * @public * @alias addMeasureLayer @@ -816,14 +816,14 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, style: ms.setMeasureStyle }); ms.map.addLayer(layer); - + return layer; }; - + //STYLES /** * Set print style - * + * * @memberof mapService * @public * @alias setPrintStyle @@ -840,14 +840,14 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, color: 'rgba(255, 255, 255, 0.3)' }) }); - + return [style]; }; - + //Highlight styles /** * Set the highlight style - * + * * @memberof mapService * @public * @alias setHighlightStyle @@ -874,7 +874,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, if (angular.isDefined(ms.styles.segments.style.lineWidth)){ width = parseInt(ms.styles.segments.style.lineWidth) + 6; } - + style = new ol.style.Style({ stroke: new ol.style.Stroke({ color: color, @@ -885,11 +885,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, return [style]; }; - + //Measure styles /** * Set the measurement styles - * + * * @memberof mapService * @public * @alias setMeasureStyle @@ -901,7 +901,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var styles = []; var coords = feature.getGeometry().getCoordinates(); coords.shift(); - + var bufferLineStyle = new ol.style.Style({ stroke: new ol.style.Stroke({ color: 'rgba(255, 255, 255, 0.8)', @@ -909,15 +909,15 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, }) }); styles.push(bufferLineStyle); - + var lineStyle = new ol.style.Style({ stroke: new ol.style.Stroke({ color: 'rgba(120, 120, 120, 1)', width: 2 - }) + }) }); styles.push(lineStyle); - + var pointStyle = new ol.style.Style({ image: new ol.style.Circle({ radius: 5, @@ -934,13 +934,13 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } }); styles.push(pointStyle); - + return styles; }; - + /** * Set the Nominatim styles - * + * * @memberof mapService * @public * @alias setNominatimStyle @@ -980,11 +980,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, fillOpacity: 0.3, } }; - - + + /** * Calculate breaks for range classification on VMS data. Stores the breaks under each type style object - * + * * @memberof mapService * @public * @alias calculateBreaks @@ -996,7 +996,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, defaultColor: undefined, intervals: [] }; - + angular.forEach(style, function(value, key){ var gapNum = key.split('-'); var tempBreak = []; @@ -1013,36 +1013,36 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, breaks.intervals.push(tempBreak); } }); - + //Sort intervals if (breaks.intervals.length > 0){ breaks.intervals.sort(function(a,b){ return (a[0] < b[0]) ? -1 : 1; }); } - + if (type === 'positions'){ ms.styles.positions.breaks = breaks; } else { ms.styles.segments.breaks = breaks; } }; - + //COLORING BY ATTRIBUTES /** * Get color definition by Flag State - * + * * @memberof mapService * @public * @alias getColorByFlagState - * @param {Object} src - The source styles object containing all style definitions - * @param {String} fs - The countryCode of the desired Flag State - * @returns {String} The hexadecimal color code + * @param {Object} src - The source styles object containing all style definitions + * @param {String} fs - The countryCode of the desired Flag State + * @returns {String} The hexadecimal color code */ ms.getColorByFlagState = function(src, fs){ return src.style[fs.toUpperCase()]; }; - + /** * Set the displayed flag state codes in the styles object * @@ -1057,21 +1057,21 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, if (!angular.isDefined(src.displayedCodes)){ src.displayedCodes = []; } - + angular.forEach(data, function(item){ if (src.displayedCodes.indexOf(item.properties.countryCode) === -1){ src.displayedCodes.push(item.properties.countryCode); } }, src); }; - + /** - * Get color code for a specific value of a field that is classified by range - * + * Get color code for a specific value of a field that is classified by range + * * @memberof mapService * @public * @alias getColorByRange - * @param {Object} src - The source styles object containing all style definitions + * @param {Object} src - The source styles object containing all style definitions * @param {Number} value - The property value to match within an interval * @returns {String} The hexadecimal color code */ @@ -1084,17 +1084,17 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, break; } } - + if (angular.isDefined(color)){ return color; } else { return src.breaks.defaultColor; } }; - + /** * Get color code to style fields with discrete classification (such as MovementType, ActivityType, SegmentCategory) - * + * * @memberof mapService * @public * @alias getColorByStaticFields @@ -1109,10 +1109,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, return src.style[type]; } }; - + /** * Set the styles object for VMS positions - * + * * @memberof mapService * @public * @alias setPositionStylesObj @@ -1120,16 +1120,16 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, */ ms.setPositionStylesObj = function(styles){ ms.styles.positions = styles; - + var rangeFields = ['reportedSpeed', 'reportedCourse', 'calculatedSpeed']; if (_.indexOf(rangeFields, ms.styles.positions.attribute) !== -1){ ms.calculateBreaks('positions', ms.styles.positions.style); } }; - + /** * Get color code for each VMS position according to the styles definitions of report/user preferences - * + * * @memberof mapService * @public * @alias getColorForPosition @@ -1158,10 +1158,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, return 'rgba(0,0,0,0)'; } }; - + /** * Get color code for each VMS position according to the styles definitions of report/user preferences without depending on isVisible value. - * + * * @memberof mapService * @public * @alias getColorForPositionWithoutIsVisible @@ -1186,18 +1186,18 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, return '#0066FF'; //default color } }; - + //OL VMS positions cluster style ms.clusterStyles = {}; ms.currentResolution = undefined; ms.clusterMaxFeatureCount = 1; ms.clusterMinFeatureCount = 100000; ms.vmsSources = {}; - + //Calculate necessary max and min amount of features of the available map clusters at each resolution /** * Calculate the maximum and minimum cluster sizes (number of features inside clusters) at the current map resolution - * + * * @memberof mapService * @public * @alias calculateClusterInfo @@ -1205,13 +1205,13 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.calculateClusterInfo = function(){ var layer = ms.getLayerByType('vmspos'); var features = layer.getSource().getFeatures(); - + angular.forEach(features, function(clusterFeat) { var includedPositions = clusterFeat.get('features'); clusterFeat.set('featNumber', includedPositions.length); ms.clusterMaxFeatureCount = Math.max(ms.clusterMaxFeatureCount, includedPositions.length); ms.clusterMinFeatureCount = Math.min(ms.clusterMinFeatureCount, includedPositions.length); - + var counter = 0; var displayedFeature; if (includedPositions.length > 1){ @@ -1222,22 +1222,22 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } }); } - + if (counter === 1){ clusterFeat.set('featureToDisplay', displayedFeature); } else { clusterFeat.set('featureToDisplay', undefined); } - + if (clusterFeat.get('featNumber') !== counter && clusterFeat.get('featNumber') > 1){ clusterFeat.set('featNumber', counter); } }); }; - + /** * Builds the name of the cluster style - * + * * @memberof mapService * @private * @returns {String} The style name to be cached @@ -1249,14 +1249,14 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, name += key; } }); - + name.replace(/\s/g, ''); return name; }; - + /** * Set the cluster styles - * + * * @memberof mapService * @public * @alias setClusterStyle @@ -1271,7 +1271,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } var size = feature.get('featNumber'); var inFeatures = feature.get('features'); - + var style; if (inFeatures.length === 1){ //caso de um cluster so com uma feature style = ms.setPosStyle(inFeatures[0]); @@ -1293,7 +1293,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } else if (ms.clusterMaxFeatureCount > 50 && ms.clusterMaxFeatureCount <= 100){ maxRadius = 20; } - + //Normalize radius to scale between maxRadius and minRadius var radius = Math.round((maxRadius - minRadius) * (Math.abs(feature.get('featNumber') - ms.clusterMinFeatureCount)) / (ms.clusterMaxFeatureCount - ms.clusterMinFeatureCount)); if (isNaN(radius) || !isFinite(radius) || radius < 0){ @@ -1301,18 +1301,18 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } radius += minRadius; feature.set('radius', radius); - + if (!angular.isDefined(size)){ var a = 'test'; } - + //Apply cluster style style = new ol.style.Style({ image: new ol.style.Circle({ radius: radius, stroke: new ol.style.Stroke({ color: '#F7580D', - width: 2 + width: 2 }), fill: new ol.style.Fill({ color: 'rgba(255, 255, 255, 0.7)', @@ -1328,19 +1328,19 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, }) }) }); - + ms.clusterStyles[styleName] = style; } } } - + return [style]; }; - + //Set style for positons when cluster is expanded /** * Set the style for unclustered style - * + * * @memberof mapService * @public * @alias setUnclusteredStyle @@ -1351,16 +1351,16 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var positions = feature.get('features'); if (positions.length > 1){ var centerCoords = feature.getGeometry().getCoordinates(); - + var mapExtent = ms.map.getView().calculateExtent(ms.map.getSize()); var mapSize = Math.min(ol.extent.getWidth(mapExtent), ol.extent.getHeight(mapExtent)); - - + + var items = positions.length; if (positions.length !== feature.get('featNumber')){ items = feature.get('featNumber'); } - + var radius = mapSize / 10; if (items > 20){ radius = items * radius / 20; @@ -1368,15 +1368,15 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, radius = mapSize / 2.5; } } - + var circle = new ol.geom.Circle(centerCoords, radius); var circlePoly = ol.geom.Polygon.fromCircle(circle); circlePoly.transform(ms.getMapProjectionCode(), 'EPSG:4326'); - + var line = turf.linestring(circlePoly.getCoordinates()[0]); - + var length = turf.lineDistance(line, 'radians') / items; - + var styles = []; var j = 0; for (var i = 0; i < positions.length; i++){ @@ -1388,17 +1388,17 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, j += 1; } } - + return _.flatten(styles); } else { return [ms.setPosStyle(positions[0])]; } - + }; - + /** * Set the spider style for unclustered data - * + * * @memberof mapService * @public * @alias setSpiderStyle @@ -1422,7 +1422,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, return new ol.geom.Point(pointCoords); } }); - + var lineStyle = new ol.style.Style({ stroke: new ol.style.Stroke({ color: 'rgba(120, 120, 120, 0.7)', @@ -1432,13 +1432,13 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, return new ol.geom.LineString([pointCoords, feature.getGeometry().getCoordinates()]); } }); - + var centerStyle = new ol.style.Style({ image: new ol.style.Circle({ radius: 5, fill: new ol.style.Fill({ color: 'rgba(255, 255, 255, 0.7)', - + }), stroke: new ol.style.Stroke({ color: '#F7580D', @@ -1449,13 +1449,13 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } }) }); - + return [pointStyle, lineStyle, centerStyle]; }; - + /** * Set the style for VMS positions - * + * * @memberof mapService * @public * @alias setPosStyle @@ -1482,13 +1482,13 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } } }); - + return style; }; - + /** * Set the styles object for VMS segments - * + * * @memberof mapService * @public * @alias setSegmentStylesObj @@ -1496,16 +1496,16 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, */ ms.setSegmentStylesObj = function(styles){ ms.styles.segments = styles; - + var rangeFields = ['speedOverGround', 'distance', 'courseOverGround']; if (_.indexOf(rangeFields, ms.styles.segments.attribute) !== -1){ ms.calculateBreaks('segments', ms.styles.segments.style); } }; - + /** * Get color code for each VMS segment according to the styles definitions of report/user preferences - * + * * @memberof mapService * @public * @alias getColorForSegment @@ -1528,7 +1528,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, return '#0066FF'; //default color } }; - + // ms.calculateJenkinsIntervals = function(geoJson){ // var breaks = turf.jenks(geoJson, 'speedOverGround', 4); // if (breaks !== null){ @@ -1536,7 +1536,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, // ms.styles.speedBreaks[4] = ms.styles.speedBreaks[4] + 1; // } // }; -// +// // ms.getColorBySpeed = function(speed){ // for (var i = 1; i < ms.styles.speedBreaks.length; i++){ // if (speed >= ms.styles.speedBreaks[i-1] && speed < ms.styles.speedBreaks[i]){ @@ -1545,10 +1545,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, // } // } // }; - + /** * Set the style of VMS segments - * + * * @memberof mapService * @public * @alias setSegStyle @@ -1559,12 +1559,12 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.setSegStyle = function(feature, resolution){ var geometry = feature.getGeometry(); var color = ms.getColorForSegment(feature); - + var width = 2; if (angular.isDefined(ms.styles.segments.style.lineWidth)){ width = parseInt(ms.styles.segments.style.lineWidth); } - + var lineDash = null; if (angular.isDefined(ms.styles.segments.style.lineStyle)){ switch (ms.styles.segments.style.lineStyle) { @@ -1582,12 +1582,12 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, break; } } - + var fontSize = 10; if (width > 2){ fontSize = Math.round((width - 2) * 2.5 + 10); } - + var style; if (feature.getGeometry().getLength() > 0){ style = [ @@ -1625,10 +1625,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, return style; }; - + /** * Set the styles object for VMS alarms - * + * * @memberof mapService * @public * @alias setAlarmsStylesObj @@ -1637,10 +1637,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.setAlarmsStylesObj = function(styles){ ms.styles.alarms = styles; }; - + /** * Get color code by alarm status - * + * * @memberof mapService * @public * @alias getColorByStatus @@ -1651,10 +1651,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.getColorByStatus = function(src, status){ return src[status.toLowerCase()]; }; - + /** * Set the style for the alarms layer - * + * * @memberof mapService * @public * @alias setAlarmsStyle @@ -1675,7 +1675,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, }) }) }); - + return [style]; }; @@ -1687,10 +1687,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, fillOpacity: 0.3, }; }; - + /** * Set the style for the fishing activities layer - * + * * @memberof mapService * @public * @alias setActivitiesStyle @@ -1711,10 +1711,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, }) }) }); - + return [style]; }; - + //Buffering vector data /*ms.addVmsSelectCtrl = function(type){ //TODO Check if interaction is there @@ -1724,7 +1724,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, layers: [layer], condition: ol.events.condition.click }); - + ms.map.addInteraction(sel); } };*/ @@ -1733,7 +1733,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, /** * Clear and remove all vector layers from the map as well as reseting the cluster styles. * This function is used before running a new report. - * + * * @memberof mapService * @public * @alias clearVectorLayers @@ -1745,7 +1745,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.map.removeLayer(layers[i]); } } - + //Clear the cluster styles applied to vms positions ms.clusterStyles = {}; ms.currentResolution = undefined; @@ -1759,7 +1759,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, /** * Get the first layer with the specified title - * + * * @memberof mapService * @public * @alias getLayerByTitle @@ -1772,20 +1772,20 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, /** * Get the first layer with the specified type - * + * * @memberof mapService * @public - * @alias getLayerByType + * @alias getLayerByType * @param {String} type - The type of the layer to find * @returns {ol.layer} The OL layer */ ms.getLayerByType = function(type){ return genericMapService.getLayerByType(type, ms.map); }; - + /** * Calculates the numeric scale of the current view of the map - * + * * @memberof mapService * @public * @alias getCurrentScale @@ -1797,7 +1797,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, /** * Gets the base projection of the map - * + * * @memberof mapService * @public * @alias getMapProjectionCode @@ -1809,7 +1809,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, /** * Force a recalculation of the map viewport size - * + * * @memberof mapService * @public * @alias updateMapSize @@ -1818,40 +1818,40 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.updateMapSize = function(){ genericMapService.updateMapSize(ms.map); }; - + /** * Update map div container size - * + * * @memberof mapService * @public * @alias updateMapContainerSize * @param {Event} evt */ ms.updateMapContainerSize = function(evt) { - + setTimeout(function() { var w = angular.element(window); if(evt && (angular.element('.mapPanelContainer.fullscreen').length > 0 || (angular.element('.mapPanelContainer.fullscreen').length === 0 && evt.type.toUpperCase().indexOf("FULLSCREENCHANGE") !== -1))){ - - + + $('.map-container').css('height', w.height() + 'px'); $('#map').css('height', w.height() + 'px'); ms.updateMapSize(); return; } - + var minHeight = 400; var headerHeight = angular.element('header')[0].offsetHeight; var newHeight = w.height() - headerHeight; - + if (newHeight < minHeight) { newHeight = minHeight; } - + $('.map-container').css('height', newHeight); $('#map').css('height', newHeight + 'px'); - + ms.updateMapSize(); }, 100); }; @@ -1859,7 +1859,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, //GENERIC FUNCTIONS FOR CONTROLS AND STYLES /** * Convert degrees to radians - * + * * @memberof mapService * @public * @alias degToRad @@ -1881,27 +1881,27 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, * @memberof mapService * @public * @alias getMiddlePoint - * @param {ol.geom.Geometry} geometry - The OL geometry + * @param {ol.geom.Geometry} geometry - The OL geometry * @returns {ol.Coordinate} The coordinates of the middle point */ ms.getMiddlePoint = function(geometry){ var sourceProj = ms.getMapProjectionCode(); var p1 = ms.pointCoordsToTurf(ol.proj.transform(geometry.getFirstCoordinate(), sourceProj, 'EPSG:4326')); var p2 = ms.pointCoordsToTurf(ol.proj.transform(geometry.getLastCoordinate(), sourceProj, 'EPSG:4326')); - + var middlePoint = ms.turfToOlGeom(turf.midpoint(p1, p2)); - + return geometry.getClosestPoint(middlePoint.getCoordinates()); }; /** * Calculate the rotation of the arrows added in the segments symbology. Rotation is calculated taking into consideration * the linestring geometry direction - * + * * @memberof mapService * @public * @alias getRotationForArrow - * @param {ol.geom.Geometry} geometry - The OL geometry + * @param {ol.geom.Geometry} geometry - The OL geometry * @returns {Number} The rotation */ ms.getRotationForArrow = function(geometry){ @@ -1917,7 +1917,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, //SETTERS /** * Set map projection - * + * * @memberof mapService * @public * @alias setProjection @@ -1932,7 +1932,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.addedControls = []; //quick reference to added controls /** * Set the controls in the map - * + * * @memberof mapService * @public * @alias setControls @@ -1956,11 +1956,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, return [new ol.Collection(ms.controls), new ol.Collection(ms.interactions)]; }; - + //Update map controls according to configuration from server /** * Update all map controls using configurations from report/user preferences. - * + * * @memberof mapService * @public * @alias setControls @@ -1969,7 +1969,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.updateMapControls = function(controls){ var tempControls = []; var mousecoordsCtrl, scaleCtrl; - + angular.forEach(controls, function(ctrl){ tempControls.push(ctrl.type); if (ctrl.type === 'mousecoords'){ @@ -1979,11 +1979,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, scaleCtrl = ctrl; } }); - + var ctrlsToRemove = _.difference(ms.addedControls, tempControls); var ctrlsToAdd = _.difference(tempControls, ms.addedControls); var ctrlsToUpdate = _.intersection(ms.addedControls, tempControls); - + //Remove controls and interactions if (ctrlsToRemove.length > 0){ angular.forEach(ctrlsToRemove, function(ctrl){ @@ -1991,7 +1991,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms[fnName](); }, ms); } - + //Update controls if (ctrlsToUpdate.length > 0){ angular.forEach(ctrlsToUpdate, function(ctrl){ @@ -2002,14 +2002,14 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } else if (ctrl === 'scale'){ config = scaleCtrl; } - + if (angular.isDefined(config)){ var fnName = 'update' + ctrl.charAt(0).toUpperCase() + ctrl.slice(1); ms[fnName](config); } }, ms); } - + //Add controls if (ctrlsToAdd.length > 0){ angular.forEach(ctrlsToAdd, function(ctrl){ @@ -2020,15 +2020,15 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } else if (ctrl === 'scale'){ config = scaleCtrl; } - + var fnName = 'add' + ctrl.charAt(0).toUpperCase() + ctrl.slice(1); ms[fnName](config, false); }, ms); } - + ms.addedControls = _.union(ctrlsToAdd, ctrlsToUpdate); }; - + /** * Get list of controls by type * @@ -2041,7 +2041,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.getControlsByType = function(type){ return genericMapService.getControlsByType(type, ms.map); }; - + /** * Get list of interactions by type * @@ -2054,7 +2054,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.getInteractionsByType = function(type){ return genericMapService.getInteractionsByType(type, ms.map); }; - + //Get custom interactions by type /** * @memberof mapService @@ -2069,13 +2069,13 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var ints = interactions.filter(function(int){ return int instanceof ol.interaction[olType] === true && int instanceof ms[type]; }); - + return ints; }; /** * Add zoom controls and interactions to the map - * + * * @memberof mapService * @public * @alias addZoom @@ -2084,16 +2084,16 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, */ ms.addZoom = function(ctrl, initial){ var olCtrl = genericMapService.createZoomCtrl('ol-zoom-liveview'); - + var iconSpan = document.createElement('span'); iconSpan.className = 'fa fa-globe'; var fullExtent = new ol.control.ZoomToExtent({ label: iconSpan, tipLabel: locale.getString('spatial.map_tip_full_extent') }); - + var interactions = genericMapService.createZoomInteractions(); - + if (initial){ ms.controls.push(olCtrl); ms.controls.push(fullExtent); @@ -2103,13 +2103,13 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.map.addControl(fullExtent); for (var i = 0; i < interactions.length; i++){ ms.map.addInteraction(interactions[i]); - } + } } }; - + /** * Remove all zoom controls and interactions from map - * + * * @memberof mapService * @public * @alias removeZoom @@ -2126,10 +2126,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } ms.map.removeInteraction(ms.getInteractionsByType('PinchZoom')[0]); }; - + /** * Creates and adds the navigation history control to the map - * + * * @memberof mapService * @public * @alias addHistory @@ -2141,17 +2141,17 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, backLabel: locale.getString('spatial.map_tip_go_back'), forwardLabel: locale.getString('spatial.map_tip_go_forward') }); - + if (initial){ ms.controls.push(olCtrl); } else { ms.map.addControl(olCtrl); } }; - + /** * Removes the navigation history control from the map - * + * * @memberof mapService * @public * @alias removeHistory @@ -2159,10 +2159,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.removeHistory = function(){ ms.map.removeControl(ms.getControlsByType('HistoryControl')[0]); }; - + /** * Creates and adds the scale control to the map - * + * * @memberof mapService * @public * @alias addHistory @@ -2171,18 +2171,18 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, */ ms.addScale = function(ctrl, initial){ var olCtrl = genericMapService.addScale(ctrl); - + if (initial){ ms.controls.push(olCtrl); } else { ms.map.addControl(olCtrl); } }; - - + + /** * Updates the scale control of the map - * + * * @memberof mapService * @public * @alias updateScale @@ -2192,10 +2192,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.map.removeControl(ms.getControlsByType('ScaleLine')[0]); ms.addScale(config, false); }; - + /** * Removes the scale control from the map - * + * * @memberof mapService * @public * @alias removeScale @@ -2203,10 +2203,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.removeScale = function(){ ms.map.removeControl(ms.getControlsByType('ScaleLine')[0]); }; - + /** * Creates and adds all drag related interactions to the map - * + * * @memberof mapService * @public * @alias addDrag @@ -2222,12 +2222,12 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.map.addInteraction(interactions[i]); } } - + }; - + /** * Removes all drag related interactions from the map - * + * * @memberof mapService * @public * @alias removeDrag @@ -2236,10 +2236,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.map.removeInteraction(ms.getInteractionsByType('DragPan')[0]); ms.map.removeInteraction(ms.getInteractionsByType('KeyboardPan')[0]); }; - + /** * Create and add Mouse Coordinates control to the map - * + * * @memberof mapService * @public * @alias addMousecoords @@ -2248,17 +2248,17 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, */ ms.addMousecoords = function(ctrl, initial){ var olCtrl = genericMapService.addMousecoords(ctrl, 'map-coordinates'); - + if (initial){ ms.controls.push(olCtrl); } else { ms.map.addControl(olCtrl); } }; - + /** * Updates the mouse coordinates control of the map - * + * * @memberof mapService * @public * @alias updateMousecoords @@ -2268,10 +2268,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.map.removeControl(ms.getControlsByType('MousePosition')[0]); ms.addMousecoords(config, false); }; - + /** * Removes the mouse coordinates control from the map - * + * * @memberof mapService * @public * @alias removeMousecoords @@ -2282,12 +2282,12 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, /** * Zoom to a specified geometry - * + * * @memberof mapService * @public * @alias zoomTo * @param {ol.geom.Geometry} geom - The OL geometry to zoom to - * @param {Boolean} nearest - Zoom to nearest zoom level possible. Default is false + * @param {Boolean} nearest - Zoom to nearest zoom level possible. Default is false */ ms.zoomTo = function(geom, nearest){ var opt = { @@ -2302,7 +2302,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, /** * Pan map to specified coordinates - * + * * @memberof mapService * @public * @alias panTo @@ -2311,10 +2311,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.panTo = function(coords){ ms.map.getView().setCenter(coords); }; - + /** * Add drag interaction for the print extent feature - * + * * @memberof mapService * @public * @alias addDragPrintExtent @@ -2323,11 +2323,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var ctrl = new ms.dragExtent(); ms.map.addInteraction(ctrl); }; - + //Custum drag interaction for print extent /** * Creates the custom drag print extent interaction - * + * * @memberof mapService * @public * @alias dragExtent @@ -2339,14 +2339,14 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, handleMoveEvent: ms.dragExtent.prototype.handleMoveEvent, handleUpEvent: ms.dragExtent.prototype.handleUpEvent }); - + this._coordinate = null; this._feature = null; this._cursor = 'pointer'; this._previousCursor = 'default'; }; ol.inherits(ms.dragExtent, ol.interaction.Pointer); - + ms.dragExtent.prototype.handleDownEvent = function(evt){ var map = evt.map; var feature = map.forEachFeatureAtPixel(evt.pixel, function(feature, layer){ @@ -2357,15 +2357,15 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, }, this, function(layer){ return layer.get('type') === 'print'; }); - + if (feature){ this._coordinate = evt.coordinate; this._feature = feature; } - + return !!feature; }; - + ms.dragExtent.prototype.handleDragEvent = function(evt){ var deltaX = evt.coordinate[0] - this._coordinate[0]; var deltaY = evt.coordinate[1] - this._coordinate[1]; @@ -2376,7 +2376,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, this._coordinate[0] = evt.coordinate[0]; this._coordinate[1] = evt.coordinate[1]; }; - + ms.dragExtent.prototype.handleMoveEvent = function(evt){ if (this._cursor) { var map = evt.map; @@ -2398,18 +2398,18 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } } }; - + ms.dragExtent.prototype.handleUpEvent = function(evt){ this._coordinate = null; this._feature = null; return false; }; - + //Measuring interaction ms.measureInteraction = {}; /** * Add measure control and start it automatically - * + * * @memberof mapService * @public * @alias startMeasureControl @@ -2447,18 +2447,18 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, }) }) }); - + ms.map.addInteraction(draw); ms.registerDrawEvents(draw, layer); ms.measureInteraction = draw; }; - + ms.measurePointsLength = 0; ms.measureOverlays = []; ms.measureETA = undefined; /** * Register all draw events for the measure control - * + * * @memberof mapService * @public * @alias registerDrawEvents @@ -2469,13 +2469,13 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, //Clear any vector features previous drawn layer.getSource().clear(); ms.clearMeasureOverlays(); - + //Disable user input on config window ms.sp.measure.disabled = true; - + var feature = evt.feature; - ms.measurePointsLength = feature.getGeometry().getCoordinates().length - 1; - + ms.measurePointsLength = feature.getGeometry().getCoordinates().length - 1; + listener = feature.getGeometry().on('change', function(evt){ var coords = evt.target.getCoordinates(); if (coords.length !== ms.measurePointsLength + 1){ @@ -2487,7 +2487,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } }); }); - + draw.on('drawend', function(evt){ ms.measurePointsLength = 0; ms.sp.measure.disabled = false; @@ -2499,10 +2499,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.measureETA = undefined; }); }; - + /** * Calculate length over the sphere, bearing and ETA of the measures drawn - * + * * @memberof mapService * @public * @alias calculateLengthAndBearingAndETA @@ -2512,7 +2512,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.calculateLengthAndBearingAndETA = function(line){ var coords = line.getCoordinates(); var sourceProj = ms.getMapProjectionCode(); - + //Calculate distance if (coords.length > 2){ var c1 = ms.pointCoordsToTurf(ol.proj.transform(coords[coords.length - 3], sourceProj, 'EPSG:4326')); @@ -2523,15 +2523,15 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, units = 'miles'; displayUnits = 'mi'; } - + var distance = turf.distance(c1, c2, units); var bearing = turf.bearing(c1, c2); - + //Calculate ETA if(angular.isDefined(ms.sp.measure.speed) && angular.isDefined(ms.sp.measure.startDate) && ms.sp.measure.speed !== null && ms.sp.measure.speed > 0){ //Convert knots to kmh var avgSpeed = ms.sp.measure.speed * 1.852; - + //Make sure we use distance in km var distanceForETA; if (displayUnits === 'mi'){ @@ -2539,54 +2539,54 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } else { distanceForETA = distance; } - + //Calculate necessary time for the specified distance var timeSpent = distanceForETA / avgSpeed; //in hours - + if (!angular.isDefined(ms.measureETA)){ ms.measureETA = moment.utc(ms.sp.measure.startDate, 'YYYY-MM-DD HH:mm:ss Z'); } ms.measureETA.add(timeSpent, 'hours'); } - - + + if (ms.sp.measure.units === 'nm'){ displayUnits = 'nm'; distance = distance * 1000 / 1852; } - + if (distance < 1 && displayUnits === 'km'){ distance = distance * 1000; displayUnits = 'm'; } - + if (bearing < 0){ bearing = bearing + 360; } - + distance = Math.round(distance * 100) / 100; //2 decimals bearing = Math.round(bearing * 100) / 100; //2 decimals - - + + var response = { distance: distance, - dist_units: displayUnits, + dist_units: displayUnits, bearing: bearing, bearing_units: '\u00b0', anchorPosition: coords[coords.length - 2] }; - + if (angular.isDefined(ms.measureETA)){ response.eta = ms.measureETA.format(globalSettingsService.getDateFormat()); } - + return response; } }; - + /** * Create the measure tooltips - * + * * @memberof mapService * @public * @alias createMeasureTooltip @@ -2595,14 +2595,14 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.createMeasureTooltip = function(data){ var el = document.createElement('div'); el.className = 'map-tooltip map-tooltip-small'; - + data.dist_title = locale.getString('spatial.map_measure_distance_title'); data.bearing_title = locale.getString('spatial.map_measure_bearing_title'); if (angular.isDefined(data.eta)){ data.eta_title = locale.getString('spatial.map_measure_eta_title'); el.className = 'map-tooltip map-tooltip-large'; } - + var templateURL = 'partial/spatial/templates/measure_tooltip.html'; $templateRequest(templateURL).then(function(template){ var rendered = Mustache.render(template, data); @@ -2610,7 +2610,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, }, function(){ console.log('error fetching template'); }); - + var offset = []; if (data.bearing >= 0 && data.bearing <= 90){ offset = [-135, -45]; @@ -2630,21 +2630,21 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, offset = [-163, 6]; } } - + var tooltip = new ol.Overlay({ element: el, offset: offset, insertFirst: false }); - + ms.map.addOverlay(tooltip); tooltip.setPosition(data.anchorPosition); ms.measureOverlays.push(tooltip); }; - + /** * Remove all measure tooltip overlays - * + * * @memberof mapService * @public * @alias clearMeasureOverlays @@ -2655,10 +2655,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } ms.measureOverlays = []; }; - + /** * Clear the measure control by removing it from the map and destroying all tooltip overlyas - * + * * @memberof mapService * @public * @alias clearMeasureControl @@ -2669,10 +2669,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.map.removeLayer(ms.getLayerByType('measure-vector')); ms.measureInteraction = {}; }; - + /** * Convert point coordinates to GeoJSON so that they can be used in Turf - * + * * @memberof mapService * @public * @alias pointCoordsToTurf @@ -2683,10 +2683,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var geom = new ol.geom.Point(coords); return genericMapService.geomToGeoJson(geom); }; - + /** * Convert GeoJSON to OL feature - * + * * @memberof mapService * @public * @alias turfToOlGeom @@ -2697,7 +2697,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var geom = genericMapService.geoJsonToOlGeom(feature); return geom.transform('EPSG:4326', ms.getMapProjectionCode()); }; - + //VECTOR LABELS //label visibility settings object ms.labelVisibility = { @@ -2710,15 +2710,15 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, activities: ['fs', 'ext_mark', 'ircs', 'cfr', 'gfcm', 'iccat', 'uvi', 'name', 'source', 'activityType', 'reportType', 'purposeCode', 'occurrence', 'areas', 'gears', 'species'], activitiesTitles: true }; - + /** * Set labels visibility according to the user configurations - * + * * @memberof mapService * @public * @alias setLabelVisibility * @param {String} type - The label type (either positions or segments) - * @param {Object} config - The label configuration object + * @param {Object} config - The label configuration object */ ms.setLabelVisibility = function(type, config){ ms.labelVisibility[type] = config.values; @@ -2741,26 +2741,26 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.labelVisibility[type] = []; } }; - + //Container for displayed label overlays ms.vmsposLabels = { active: false, displayedIds: [] }; - + ms.vmssegLabels = { active: false, displayedIds: [] }; - + ms.ersLabels = { active: false, displayedIds: [] }; - + /** * Reset all label container objects - * + * * @memberof mapService * @public * @alias resetLabelContainers @@ -2770,22 +2770,22 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, active: false, displayedIds: [] }; - + ms.vmssegLabels = { active: false, displayedIds: [] }; - + ms.ersLabels = { active: false, displayedIds: [] }; }; - - + + /** * Check label status and activate them if necessary - * + * * @memberof mapService * @public * @alias checkLabelStatus @@ -2795,39 +2795,39 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, if (ms.vmsposLabels.active === true){ ms.activateVectorLabels('vmspos'); } - + if (ms.vmssegLabels.active === true){ ms.activateVectorLabels('vmsseg'); } - + if (ms.ersLabels.active === true){ ms.activateVectorLabels('ers'); } }; - + //Activate Vector Label Overlays /** * Activate vector labels - * + * * @memberof mapService * @public * @alias activateVectorLabels * @param {String} type - The type of labels to be activated (either positions or segments) */ ms.activateVectorLabels = function(type){ - if ((type === 'vmspos' && ms.labelVisibility.positions.length > 0) || + if ((type === 'vmspos' && ms.labelVisibility.positions.length > 0) || (type === 'vmsseg' && ms.labelVisibility.segments.length > 0) || (type === 'ers' && ms.labelVisibility.activities.length > 0)){ - var containerName = type + 'Labels'; + var containerName = type + 'Labels'; ms[containerName].active = true; ms[containerName].displayedIds = []; - + var layer = ms.getLayerByType(type); - + var extent = ms.map.getView().calculateExtent(ms.map.getSize()); var size = Math.min.apply(Math, ol.extent.getSize(extent)); //var resolution = ms.map.getView().getResolution(); - + var src = layer.getSource(); if (type === 'vmsseg'){ src = src.getSource(); @@ -2841,11 +2841,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, if (containedFeatures.length === 1){ feat = containedFeatures[0]; } - + if (feature.get('featNumber') === 1 && containedFeatures.length > 1){ feat = feature.get('featureToDisplay'); } - + if (angular.isDefined(feat) && feat.get('isVisible')){ overlayId = feat.get('overlayId'); if (!angular.isDefined(overlayId)){ @@ -2888,15 +2888,15 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } } }); - + //Finally we remove overlays that are no longer visible ms.removeLabelsByMapChange(type); } }; - + /** * Remove labels when map changes (by zooming or panning) - * + * * @memberof mapService * @public * @alias removeLabelsByMapChange @@ -2907,7 +2907,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var containerName = type + 'Labels'; var existingKeys = _.keys(ms[containerName]); existingKeys = _.without(existingKeys, 'active', 'displayedIds'); - + var diff = _.difference(existingKeys, ms[containerName].displayedIds); angular.forEach(diff, function(key){ var hidden = this[key].feature.get('overlayHidden'); @@ -2919,10 +2919,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } }, ms[containerName]); }; - + /** * Remove labels when map changes (by zooming or panning) - * + * * @memberof mapService * @public * @alias deactivateVectorLabels @@ -2932,7 +2932,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.deactivateVectorLabels = function(type){ var containerName = type + 'Labels'; var keys = _.keys(ms[containerName]); - keys = _.without(keys, 'active', 'displayedIds'); + keys = _.without(keys, 'active', 'displayedIds'); if (angular.isDefined(keys) && angular.isDefined(ms.map)){ angular.forEach(keys, function(key) { @@ -2945,15 +2945,15 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms[containerName].active = false; } }; - + /** * Add label overlay - * + * * @memberof mapService * @public * @alias addLabelsOverlay * @param {ol.Feature} feature - The OL feature object that will be labeled - * @param {String} type - The type of label (either vmspos or vmsseg) + * @param {String} type - The type of label (either vmspos or vmsseg) * @param {String} overlayId - The GUID of the overlay */ ms.addLabelsOverlay = function(feature, type, overlayId){ @@ -2965,37 +2965,37 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } else { coords = ms.getMiddlePoint(feature.getGeometry()); } - + var containerName = type + 'Labels'; - + //HTML DOM var labelEl = document.createElement('div'); labelEl.className = 'col-md-12 vector-label vector-label-' + type; - + var toolsEl = document.createElement('div'); - + var closeBtn = document.createElement('span'); closeBtn.className = 'fa fa-times close-icon pull-right'; closeBtn.addEventListener('click', closeLabelOverlay(containerName, overlayId), false); - + toolsEl.appendChild(closeBtn); labelEl.appendChild(toolsEl); - + var contentEl = document.createElement('div'); contentEl.className = 'col-md-12 label-content'; labelEl.appendChild(contentEl); - + //Mustache var data = ms.setLabelObj(feature, type); ms.requestLabelTemplate(type, data, contentEl); - + var overlay = new ol.Overlay({ element: labelEl, autoPan: false, position: coords, positioning: 'top-left' }); - + ms.map.addOverlay(overlay); ms[containerName][overlayId] = { feature: feature, @@ -3028,7 +3028,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, }; /** * Build the label object that will be used with Mustache - * + * * @memberof mapService * @public * @alias setLabelObj @@ -3045,7 +3045,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, titles = ms.getPositionTitles(); replacementTitles = ms.labelVisibility.positionsReplacementTitles; srcData = ms.formatPositionDataForPopup(feature.getProperties()); - + for (i = 0; i < ms.labelVisibility.positions.length; i++){ data.push({ title: ms.getLabelAttrName(titles,replacementTitles,'positions',i), @@ -3056,7 +3056,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, showTitles = ms.labelVisibility.activitiesTitles; titles = ms.getActivityTitles(); srcData = ms.formatActivityDataForPopup(feature.getProperties()); - + for (i = 0; i < ms.labelVisibility.activities.length; i++){ data.push({ title: titles[ms.labelVisibility.activities[i]], @@ -3068,7 +3068,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, replacementTitles = ms.labelVisibility.segmentsReplacementTitles; titles = ms.getSegmentTitles(); srcData = ms.formatSegmentDataForPopup(feature.getProperties()); - + for (i = 0; i < ms.labelVisibility.segments.length; i++){ data.push({ title: ms.getLabelAttrName(titles,replacementTitles,'segments',i), @@ -3076,7 +3076,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, }); } } - + if (data.length > 0){ return { id: id, @@ -3094,10 +3094,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, }; } }; - + /** * Request label template and render it using Mustache - * + * * @memberof mapService * @public * @alias requestLabelTemplate @@ -3114,10 +3114,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, console.log('error getting template'); }); }; - + /** * Close a single label overlay by id - * + * * @memberof mapService * @private * @param {String} container - The label container name @@ -3134,10 +3134,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } }; }; - + /** * Generate an overlay id (GUID) - * + * * @memberof mapService * @public * @alias generateOverlayId @@ -3146,20 +3146,20 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, */ ms.generateOverlayId = function(container){ var id = generateGUID(); - + if (_.has(container, id) === true){ ms.generateOverlayId(container); } else { return id; } }; - + /** * Generate random GUID - * + * * @memberof mapService * @public - * @returns {String} The generated GUID + * @returns {String} The generated GUID */ var generateGUID = function(){ function s4() { @@ -3169,12 +3169,12 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); }; - + //POPUPS //Render popup info using mustache /** * Request popup template and render it using Mustache - * + * * @memberof mapService * @public * @alias requestPopupTemplate @@ -3185,11 +3185,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, */ ms.requestPopupTemplate = function(data, type, coords, fromCluster){ ms.popupRecContainer.currentType = type; - + if (type === 'ers'){ ms.popupRecContainer.activityType = data.activityType; } - + var templateURL = 'partial/spatial/templates/' + type + '.html'; $templateRequest(templateURL).then(function(template){ var rendered = Mustache.render(template, data); @@ -3216,10 +3216,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, console.log('error getting template'); }); }; - + /** * Add OL popup overlay - * + * * @memberof mapService * @public * @alias addPopupOverlay @@ -3238,7 +3238,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, /** * Close OL popup overlay - * + * * @memberof mapService * @public * @alias closePopup @@ -3249,7 +3249,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.popupRecContainer.reset(); return false; }; - + //Popup visibility settings object ms.popupVisibility = { positions: ['fs', 'extMark', 'ircs', 'cfr', 'name', 'posTime', 'lat', 'lon', 'stat', 'm_spd', 'c_spd', 'crs', 'msg_tp', 'act_tp', 'source'], @@ -3261,7 +3261,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ers: ['fs', 'ext_mark', 'ircs', 'cfr', 'gfcm', 'iccat', 'uvi', 'name', 'source', 'activityType', 'reportType', 'purposeCode', 'occurrence', 'areas', 'gears', 'species'], ersTitles: true }; - + ms.setPopupVisibility = function(type, config){ ms.popupVisibility[type] = config.values; ms.popupVisibility[type + 'Titles'] = angular.isDefined(config.isAttributeVisible) ? config.isAttributeVisible: false; @@ -3281,15 +3281,15 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.popupVisibility[type] = []; } }; - - //POPUP - decide which function to call so that data is properly formated + + //POPUP - decide which function to call so that data is properly formated /** * Create object containing all the necessary information to be displayed in the popup - * + * * @memberof mapService * @public * @alias setObjPopup - * @param {Object} record - The source record for which a popup will be displayed + * @param {Object} record - The source record for which a popup will be displayed * @returns {Object} An object containing the necessary information to be displayed in the popup */ ms.setObjPopup = function(record){ @@ -3311,10 +3311,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, default: break; } - + return data; }; - + ms.popupRecContainer = { records: [], currentType: undefined, @@ -3349,11 +3349,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, //POPUP - Define the object that will be used in the popup for vms positions /** * Create object containing all the necessary position information to be displayed in the popup - * + * * @memberof mapService * @public * @alias setPositionsObjPopup - * @param {ol.Feature} feature - The OL feature used to display the popup + * @param {ol.Feature} feature - The OL feature used to display the popup * @param {String} [id] - The id of the feature * @returns {Object} An object containing the necessary position information to be displayed in the popup */ @@ -3394,11 +3394,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } }; }; - + //Popup attribute names for positions /** * Get attributes names for positional data - * + * * @memberof mapService * @public * @alias getPositionTitles @@ -3423,11 +3423,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, source: locale.getString('spatial.tab_vms_pos_table_header_source') }; }; - + //Popup data values for positions /** * Format positional data to be displayed in the popup taking into consideration user preferences - * + * * @memberof mapService * @public * @alias formatPositionDataForPopup @@ -3437,7 +3437,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.formatPositionDataForPopup = function(data){ var coords = data.geometry.getCoordinates(); var repCoords = ol.proj.transform(coords, ms.getMapProjectionCode(), 'EPSG:4326'); - + return { name: data.name, fs: data.countryCode, @@ -3456,10 +3456,10 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, source: data.source }; }; - + /** * Do the mapping between application object properties and the source data properties - * + * * @memberof mapService * @public * @alias getMappingTitlesProperties @@ -3506,7 +3506,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, asset:'name' }; } - + if (type === 'vmsseg'){ return { name: 'name', @@ -3525,11 +3525,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, /** * Create object containing all the necessary segment information to be displayed in the popup - * + * * @memberof mapService * @public * @alias setSegmentsObjPopup - * @param {ol.Feature} feature - The OL feature used to display the popup + * @param {ol.Feature} feature - The OL feature used to display the popup * @returns {Object} An object containing the necessary position information to be displayed in the popup */ ms.setSegmentsObjPopup = function(feature){ @@ -3566,11 +3566,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } }; }; - + //Popup attribute names for segments /** * Get attributes names for segment data - * + * * @memberof mapService * @public * @alias getSegmentTitles @@ -3590,11 +3590,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, cat: locale.getString('spatial.tab_vms_seg_table_header_category') }; }; - + //Popup data values for segments /** * Format segment data to be displayed in the popup taking into consideration user preferences - * + * * @memberof mapService * @public * @alias formatPositionDataForPopup @@ -3615,18 +3615,18 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, cat: data.segmentCategory }; }; - + //POPUP - alarms //Define the object that will be used in the popup for alarms /** * Create the alarms object that will be used in the popup - * + * * @memberof mapService * @public * @alias setAlarmsObjPopup - * @param {ol.Feature} feature - The OL feature representing the alarm + * @param {ol.Feature} feature - The OL feature representing the alarm * @param {Boolean} includeAsset - Whether the details button should be displayed in the popup or not - * @returns {Object} + * @returns {Object} */ ms.setAlarmsObjPopup = function(feature, includeAsset){ if (!angular.isDefined(includeAsset)){ @@ -3634,7 +3634,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } var titles = ms.getAlarmTitles(); var srcData = ms.formatAlarmDataForPopup(feature); - + return { alarmTitle: locale.getString('spatial.popup_alarms_title'), titles: titles, @@ -3642,11 +3642,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, includeAssetDetails: includeAsset }; }; - + //Popup attribute names for alarms /** * Get attributes names for alarms data - * + * * @memberof mapService * @public * @alias getAlarmTitles @@ -3667,17 +3667,17 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, updatedBy: locale.getString('spatial.rule_updated_by') }; }; - + /** * Format alarm data to be displayed in the popup taking into consideration user preferences - * + * * @memberof mapService * @public * @alias formatAlarmDataForPopup * @param {Object} data - The object containing initial data * @returns {Object} An object containing properly formated alarm data */ - ms.formatAlarmDataForPopup = function(data){ + ms.formatAlarmDataForPopup = function(data){ return { name: data.name, fs: data.fs, @@ -3694,20 +3694,20 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, color: ms.getColorByStatus(ms.styles.alarms, data.ticketStatus) }; }; - + /** * Create object containing all the necessary fishing activity information to be displayed in the popup - * + * * @memberof mapService * @public * @alias setActivitiesObjPopup - * @param {ol.Feature} feature - The OL feature used to display the popup + * @param {ol.Feature} feature - The OL feature used to display the popup * @returns {Object} An object containing the necessary position information to be displayed in the popup */ ms.setActivitiesObjPopup = function(feature){ var titles = ms.getActivityTitles(); var srcData = ms.formatActivityDataForPopup(feature); - + var data = []; for (var i = 0; i < ms.popupVisibility.ers.length; i++){ data.push({ @@ -3715,7 +3715,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, value: srcData[ms.popupVisibility.ers[i]] }); } - + return { showTitles: ms.popupVisibility.ersTitles, activity: data, @@ -3742,11 +3742,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } }; }; - + //Popup attribute names for fishing activities /** * Get attributes names for activity data - * + * * @memberof mapService * @public * @alias getActivityTitles @@ -3773,11 +3773,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, species: locale.getString('spatial.criteria_species') }; }; - + //Popup data values for activities /** * Format segment data to be displayed in the popup taking into consideration user preferences - * + * * @memberof mapService * @public * @alias formatActivityDataForPopup @@ -3787,7 +3787,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.formatActivityDataForPopup = function(data){ var filter = $filter('stArrayToString'); var pCodeDesc = mdrCacheService.getDescriptionByCode('FLUX_GP_PURPOSE', data.purposeCode); - + return { fs: data.flagState, name: data.vesselName, @@ -3804,8 +3804,8 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, occurrence: unitConversionService.date.convertToUserFormat(data.acceptedDateTime), areas: filter(data.areas, ' - '), //ports: data.ports, - gears: filter(data.gears, ' - '), - species: filter(data.species, ', ') + gears: filter(data.gears, ' - '), + species: filter(data.species, ', ') }; }; @@ -3815,11 +3815,11 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, //array holding features selected by DragBox ms.selectedFeatures = []; - + ms.getSelectedFeatures = function() { return ms.selectedFeatures; }; - + ms.setDragBoxEvent = function(map){ var dragBox = new ol.interaction.DragBox({ condition: ol.events.condition.shiftKeyOnly @@ -3831,7 +3831,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, dragBox.on('boxstart', function () { ms.selectedFeatures = []; }); - + ms.wktFormatter = new ol.format.WKT(); dragBox.on('boxend', function () { @@ -3847,13 +3847,13 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, ms.resetHighlightedFeatures(); }); }; - + ms.resetHighlightedFeatures = function() { var layer = ms.getLayerByType('highlight').getSource(); layer.clear(true); layer.addFeatures(ms.selectedFeatures); }; - + ms.getFeaturesIntersectingExtent = function(source, extend, geomType, layer) { source.forEachFeatureIntersectingExtent(extend, function (feature) { ms.selectedFeatures.push(feature); @@ -3861,14 +3861,14 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, feature.getGeometry().set("GeometryType", geomType); }); } ; - + ms.clearFeaturesOfUnselectedLayer = function(layer) { ms.selectedFeatures = ms.selectedFeatures.filter(function(feature) { return feature.get('layerType') !== layer; }); ms.resetHighlightedFeatures(); }; - + ms.getSelectedFeaturesForExport = function(identifier) { var features = {}; angular.forEach(ms.selectedFeatures, function (feature) { @@ -3893,7 +3893,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, } return parent[name]; }; - + ms.getFlagState = function(feature) { if(feature.get('layerType') === 'ers') { return feature.get('flagState') !== "" ? feature.get('flagState') : "UNKNOWN"; @@ -3903,7 +3903,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, return feature.get('countryCode') !== "" ? feature.get('countryCode') : "UNKNOWN"; } }; - + ms.getIdentifier = function(feature, identifier) { if(feature.get('layerType') === 'ers') { return identifier.toUpperCase() + ": " + feature.get(identifier.toUpperCase()); @@ -3913,7 +3913,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, return identifier.toUpperCase() + ": " + feature.get(identifier.toLowerCase()); } }; - + ms.pushFeatureInRelevantLayerFolder = function(parent, feature) { var layerFolder; if(feature.get('layerType') === 'ers') { @@ -3927,7 +3927,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, layerFolder.push(ms.segmentFeatureToDto(feature)); } }; - + ms.getTransformedCoordinates = function(feature) { var src = 'EPSG:3857'; var dest = 'EPSG:4326'; @@ -3935,13 +3935,13 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, clonedFeature.getGeometry().transform(src, dest); return clonedFeature.getGeometry().getCoordinates(); }; - + ms.positionFeatureToDto = function(feature) { var dto = {}; dto['geometry'] = ms.getTransformedCoordinates(feature).join(); dto['color'] = ms.getColorForPositionWithoutIsVisible(feature); - + var properties = feature.get('features')[0].getProperties(); dto['positionTime'] = properties['positionTime']; dto['connectionId'] = properties['connectionId']; @@ -3968,7 +3968,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, dto['geometry'].push(coordinates.join()); }); dto['color'] = ms.getColorForSegment(feature); - + var properties = feature.getProperties(); dto['cfr'] = properties['cfr']; dto['countryCode'] = properties['countryCode']; @@ -3988,7 +3988,7 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, var dto = {}; dto['geometry'] = ms.getTransformedCoordinates(feature).join(); - + var properties = feature.getProperties(); dto['activityId'] = parseInt(properties['activityId']); dto['faReportID'] = parseInt(properties['faReportID']); @@ -4016,7 +4016,6 @@ angular.module('unionvmsWeb').factory('mapService', function(locale, $rootScope, dto['vesselIdentifiers'] = vesselIds; return dto; }; - + return ms; }); - From 1930d728c873bda6c11d406389615a1e9d63a83e Mon Sep 17 00:00:00 2001 From: gmanifavas Date: Fri, 23 Oct 2020 16:25:47 +0300 Subject: [PATCH 14/33] [UNIONVMS-4738] Fix areas imported by gml not being saved. --- .../areas/uploadAreaModal/uploadAreaModal.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/unionvms-web/app/partial/areas/uploadAreaModal/uploadAreaModal.js b/unionvms-web/app/partial/areas/uploadAreaModal/uploadAreaModal.js index ffb1e1cbf..c2e040393 100644 --- a/unionvms-web/app/partial/areas/uploadAreaModal/uploadAreaModal.js +++ b/unionvms-web/app/partial/areas/uploadAreaModal/uploadAreaModal.js @@ -179,6 +179,8 @@ angular.module('unionvmsWeb').controller('UploadareamodalCtrl',function($scope, }); var geom = geometries[0].getGeometry(); + + geom.setCoordinates($scope.transformXYZCoordsToXY(geom.getCoordinates()[0])); var firstCoord = geom.getFirstCoordinate(); var lastCoord = geom.getLastCoordinate(); @@ -200,6 +202,18 @@ angular.module('unionvmsWeb').controller('UploadareamodalCtrl',function($scope, return; } }; + + $scope.transformXYZCoordsToXY = function(coords) { + var xyCoords = []; + xyCoords.push([]); + angular.forEach(coords, function (xyzCoors) { + var innerCoords = []; + innerCoords.push(xyzCoors[1]); + innerCoords.push(xyzCoors[0]); + xyCoords[0].push(innerCoords) + }, this); + return xyCoords; + }; //WKT Parser $scope.parseWKT = function(){ From 9b92de152f8b79f94d657f547b94d46078a731ab Mon Sep 17 00:00:00 2001 From: gmanifavas Date: Fri, 23 Oct 2020 18:18:01 +0300 Subject: [PATCH 15/33] [UNIONVMS-4743] Remove extra forms when clearing search filters. --- .../spatial/liveViewPanel/vmsPanel/vmsPanel.html | 10 +++++----- .../partial/spatial/liveViewPanel/vmsPanel/vmsPanel.js | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html b/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html index 66a85a36f..91352e291 100644 --- a/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html +++ b/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html @@ -163,7 +163,7 @@ {{'spatial.reports_table_search_header' | i18n}} - + @@ -315,7 +315,7 @@ {{'spatial.reports_table_search_header' | i18n}} - + @@ -444,7 +444,7 @@ {{'spatial.reports_table_search_header' | i18n}} - + @@ -586,7 +586,7 @@ {{'spatial.reports_table_search_header' | i18n}} - + @@ -753,7 +753,7 @@ {{'spatial.reports_table_search_header' | i18n}} - + diff --git a/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.js b/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.js index 4e88713fe..2962b5eef 100644 --- a/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.js +++ b/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.js @@ -155,6 +155,10 @@ angular.module('unionvmsWeb').controller('VmspanelCtrl',function($scope, locale, $scope.lastEventDates = []; } }; + + $scope.clearDynamicForms = function(tab) { + $scope.dynamicSearchArray[tab] = [0]; + }; $scope.clearComboFilters = function(){ $scope.firstFishingActivityTypes = []; From 34805809499cffb479ad445671526f53e188684e Mon Sep 17 00:00:00 2001 From: gmanifavas Date: Mon, 26 Oct 2020 12:30:39 +0200 Subject: [PATCH 16/33] [UNIONVMS-4743] Fix trip search for multiple criteria. --- .../stFieldSearchGeoJson/stFieldSearchGeoJson.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js b/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js index 3bcc20121..c6e886853 100644 --- a/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js +++ b/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js @@ -95,7 +95,15 @@ angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, u return resp; }; - + + var getIdentifier = function (obj) { + if(type === 'trips') { + return obj['tripId']; + } else { + return obj['id']; + } + }; + //Function to calculate upper boundary when filtering fields with duration/time var dehumanizeTimeAndCalculateUpBoundary = function(time){ var parsedStr = time.match(/([0-9]+[dhms]{1})/ig); @@ -459,7 +467,7 @@ angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, u var tempRec = tempRecs[y]; var added = false; for(var innerY=0; innerY < filteredRecs.length; innerY++){ - if(tempRec.id === filteredRecs[innerY].id){ + if(getIdentifier(tempRec) === getIdentifier(filteredRecs[innerY])){ added = true; break; } From 8a995c7538659b1e3737d7a868b1020a669c9ae6 Mon Sep 17 00:00:00 2001 From: PROTOPAPAS Thanasis Date: Mon, 26 Oct 2020 12:50:06 +0200 Subject: [PATCH 17/33] [UNIONVMS-4855] add save for map configuration selections --- .../directive/spatial/layerTree/layerTree.js | 116 +- .../mapPanel/layerPanel/layerTreeModel.js | 1240 ++++++++-------- .../reportsPanel/reportForm/reportForm.js | 1284 +++++++++-------- .../spatial/reportsPanel/reportModel.js | 1076 +++++++------- .../app/service/reporting/reportService.js | 99 +- 5 files changed, 2008 insertions(+), 1807 deletions(-) diff --git a/unionvms-web/app/directive/spatial/layerTree/layerTree.js b/unionvms-web/app/directive/spatial/layerTree/layerTree.js index 5814acef5..f5feea83f 100644 --- a/unionvms-web/app/directive/spatial/layerTree/layerTree.js +++ b/unionvms-web/app/directive/spatial/layerTree/layerTree.js @@ -37,11 +37,39 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer return ( false ); } }; - + + var pushLayerConfigByType = function(node, value) { + if(node.data) { + if (node.data.type === 'ers-type') { + reportService.pushLayerConfig(node.data.filterType, value); + } else if (node.data.type === 'WMS') { + reportService.pushLayerConfig(node.data.typeName, value); + } else { + reportService.pushLayerConfig(node.data.type, value); + } + } + }; + // call tree and map update var selectHandler = function( event, data){ + + if (data.node.hasOwnProperty("selected")) { + pushLayerConfigByType(data.node, data.node.selected); + } + + if (angular.isDefined(data.node.children)) { + angular.forEach(data.node.children, function(firstChild) { + pushLayerConfigByType(firstChild, data.node.selected); + if (angular.isDefined(firstChild.children)) { + angular.forEach(firstChild.children, function(secondChild) { + pushLayerConfigByType(secondChild, data.node.selected); + }); + } + }); + } + updateBasemap( event, data ); - + if (data.node.hasChildren() === true && !angular.isDefined(data.node.data.geoJson)){ loopFolderNodes(data.node); } else { @@ -50,7 +78,7 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer data.node.data.mapLayer.set('visible', data.node.isSelected()); } else if (!angular.isDefined(data.node.data.geoJson) && !angular.isDefined(data.node.data.mapLayer)){ applyGeoJsonFilter(data, false); - var parent = data.node.getParent(); + var parent = data.node.getParent(); parent.data.mapLayer.set('visible', getCheckedStatusForMainNode(parent)); } else { data.node.data.mapLayer.set('visible', data.node.isSelected()); @@ -62,7 +90,7 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer mapService.clearFeaturesOfUnselectedLayer(data.node.data.type); } }; - + var getCheckedStatusForMainNode = function(node){ var checked = false; angular.forEach(node.getChildren(), function(child) { @@ -70,25 +98,25 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer checked = true; } }); - + return checked; }; - + var applyGeoJsonFilter = function(data, isParent){ var parent; if (!isParent){ parent = data.node.getParent(); } else { parent = data.node; - } - + } + //Get source GeoJSON as features var features = (new ol.format.GeoJSON()).readFeatures(parent.data.geoJson, { dataProjection: 'EPSG:4326', featureProjection: mapService.getMapProjectionCode() }); - - + + var filteredFeatures; if (!isParent){ //Here we need filtering @@ -99,34 +127,34 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer filter.push(child.data.filterType); } }); - + filteredFeatures = features.filter(function(feature){ return _.indexOf(filter, feature.get(parent.data.filterProperty)) !== -1; }); } else { filteredFeatures = features; } - + //Apply data to the source layer var vectorSource = parent.data.mapLayer.getSource(); vectorSource.clear(); if (parent.data.type === 'vmspos'){ var clusterSource = vectorSource.getSource(); clusterSource.clear(); - + var count = 0; angular.forEach(filteredFeatures, function(feature) { count += 1; feature.setId(count); feature.set('isVisible', true); }); - + clusterSource.addFeatures(filteredFeatures); } else { vectorSource.addFeatures(filteredFeatures); } }; - + var loopFolderNodes = function(parent){ $.each(parent.children, function(index, node){ if (node.hasChildren() && !angular.isDefined(node.data.geoJson)){ @@ -159,26 +187,26 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer selFeatures.clear(); } } - + if (node.data.type === 'ers' && node.isSelected() === false && mapService.ersLabels.active === true){ mapService.deactivateVectorLabels('ers'); removeActiveLabelClass(node); } - + if (node.data.type === 'vmsseg' && mapService.vmssegLabels.active === true && node.isSelected() === false){ mapService.deactivateVectorLabels('vmsseg'); removeActiveLabelClass(node); } - + if (node.data.type === 'vmspos-type' && mapService.vmsposLabels.active === true){ mapService.deactivateVectorLabels('vmspos'); if (getCheckedStatusForMainNode(node.getParent()) === true){ mapService.activateVectorLabels('vmspos'); } else { removeActiveLabelClass(node.getParent()); - } + } } - + if (node.data.type === 'ers-type' && mapService.ersLabels.active === true){ mapService.deactivateVectorLabels('ers'); if (getCheckedStatusForMainNode(node.getParent()) === true){ @@ -187,7 +215,7 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer removeActiveLabelClass(node.getParent()); } } - + if (node.data.type === 'vmsdata' && node.isSelected() === false){ var children = node.getChildren(); angular.forEach(children, function(child){ @@ -195,21 +223,21 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer removeActiveLabelClass(child); }); } - + //Deal with popups var nodeTitles = ['vmsseg', 'vmspos', 'alarms', 'vmspos-type', 'ers', 'ers-type']; if (angular.isDefined(mapService.overlay) && node.isSelected() === false && _.indexOf(nodeTitles, node.data.type) !== -1){ mapService.closePopup(); } }; - + var removeActiveLabelClass = function(node){ var target = $(node.span).children('.fancytree-title').children('.fa.fa-tag'); var className = 'label-selected-' + node.data.type; - + if (angular.isDefined(target) && target.hasClass(className)){ target.removeClass(className); - } + } }; var renderNodeHandler = function( event, data ) { @@ -226,23 +254,23 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer if (data.node.data.labelEnabled === true){ addLabel( data ); } - + if (data.node.data.optionsEnabled === true){ addOptions(data); } }; - + //add options button for vectors var addOptions = function(data){ var tip, $title = $( data.node.span ).children( '.fancytree-title' ), $options = $title.children('.fa.fa-cog'); - + if ( $options.length > 0) { return; } - + tip = locale.getString(data.node.data.optionsTip); $('') .appendTo($title) @@ -251,13 +279,13 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer openSettingsModal(data); }); }; - + //Options modal var openModal = function(type){ if (angular.isDefined(reportService.autoRefreshInterval)){ reportService.stopAutoRefreshInterval(); } - + var modalInstance = $modal.open({ templateUrl: 'partial/spatial/reportsPanel/reportForm/mapConfigurationModal/mapConfigurationModal.html', controller: 'MapconfigurationmodalCtrl', @@ -276,7 +304,7 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer } displayStatus.push(status); }); - + var components = { fromLayerTree: locale.getString('spatial.' + type + '_config_modal_title'), styles: { @@ -285,19 +313,19 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer alarm: displayStatus[2] } }; - + if (type !== 'alarms'){ components.visibility = { position: displayStatus[0], - segment: displayStatus[1] + segment: displayStatus[1] }; } - + return components; } } }); - + modalInstance.result.then(function(data){ if (!angular.equals(reportFormService.liveView.currentReport.currentMapConfig.mapConfiguration, data.mapSettings)){ reportFormService.liveView.currentReport.currentMapConfig.mapConfiguration = data.mapSettings; @@ -314,7 +342,7 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer spatialHelperService.configureFullscreenModal(modalInstance); }; - + var openSettingsModal = function(data){ var type = data.node.data.type; if (!angular.isDefined(reportFormService.liveView.currentReport)){ @@ -322,7 +350,7 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer var report = new Report(); report = report.fromJson(response); reportFormService.liveView.originalReport = report; - + reportFormService.liveView.currentReport = new Report(); angular.copy(report, reportFormService.liveView.currentReport); openModal(type); @@ -335,7 +363,7 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer openModal(type); } }; - + //add label button for vectors var addLabel = function(data){ var tip, @@ -350,7 +378,7 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer var cls = 'fa fa-tag fancytree-clickable'; var empty = false; - if ((data.node.data.type === 'vmspos' && mapService.labelVisibility.positions.length === 0) || + if ((data.node.data.type === 'vmspos' && mapService.labelVisibility.positions.length === 0) || (data.node.data.type === 'vmsseg' && mapService.labelVisibility.segments.length === 0) || (data.node.data.type === 'ers' && mapService.labelVisibility.activities.length === 0)){ tip = locale.getString('spatial.layer_tree_empty_popup_label_visibility_settings'); @@ -540,7 +568,7 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer scope.$tree.reload( source ); updateMap(); }; - + //nodes is an array layerPanelService.addLayerTreeNode = function(nodes) { var root = scope.$tree.getRootNode(); @@ -595,7 +623,7 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer return selectedNodes; }; - + layerPanelService.getChildrenByStatus = function(checkedStatus, parentType){ var root = scope.$tree.getRootNode(); var targetNode = root.findAll(function(node){ @@ -609,7 +637,7 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer nodes.push(child.data.filterType); } }); - + return nodes; }; @@ -627,7 +655,7 @@ angular.module('unionvmsWeb').directive('layerTree', function($q, $modal, mapSer } }); }; - + layerPanelService.toggleCheckNode = function(type, status){ var root = scope.$tree.getRootNode(); var node = root.findAll(function(node){ diff --git a/unionvms-web/app/partial/spatial/liveViewPanel/mapPanel/layerPanel/layerTreeModel.js b/unionvms-web/app/partial/spatial/liveViewPanel/mapPanel/layerPanel/layerTreeModel.js index a8a447677..6c6059f0e 100644 --- a/unionvms-web/app/partial/spatial/liveViewPanel/mapPanel/layerPanel/layerTreeModel.js +++ b/unionvms-web/app/partial/spatial/liveViewPanel/mapPanel/layerPanel/layerTreeModel.js @@ -1,591 +1,649 @@ -/* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . -*/ -angular.module('unionvmsWeb').factory('TreeModel',function(locale, mapService, userService) { - - function TreeModel(){} - - var baseLayerCounter = 0; - - //Build tree node for OSM based layers - var buildOsmBasedNodes = function(src){ - if (src.isBaseLayer === true){ - baseLayerCounter += 1; - } - - var node = { - title: src.title, - selected: src.isBaseLayer === false ? undefined : (baseLayerCounter === 1 ? true : false), - extraClasses: src.isBaseLayer === true ? 'layertree-basemap' : undefined, - data: { - type: src.type, - isBaseLayer: src.isBaseLayer, - title: src.title - } - }; - - return node; - }; - - //Build tree node for Bing based layers - var buildBingBasedNodes = function(src){ - if (angular.isDefined(src.apiKey) && src.apiKey !== ''){ - baseLayerCounter += 1; - - var layerTitle = locale.getString('spatial.layer_tree_' + src.title); - var node = { - title: layerTitle, - selected: baseLayerCounter === 1 ? true : false, - extraClasses: 'layertree-basemap', - data: { - type: src.type, - isBaseLayer: true, - title: layerTitle, - layerGeoName: src.layerGeoName, - apiKey: src.apiKey - } - }; - - return node; - } - }; - - //Build a tree node for WMS layers - var buildWmsNode = function(src){ - var stylesForObject = []; - var selected = false; - if (angular.isDefined(src.styles)){ - stylesForObject = checkWmStylesAvailability(src.styles); - } - - var filtersForObject; - //This is for user areas only - if (angular.isDefined(src.filters)){ - filtersForObject = buildCqlContext(src.filters, 'USERAREAS'); - } - - //This is for system areas and port data - if (angular.isDefined(src.groupFilter)){ - filtersForObject = buildCqlContext(src.groupFilter, 'REFDATA'); - } - - if (src.isBaseLayer === true){ - baseLayerCounter += 1; - if (baseLayerCounter === 1){ - selected = true; - } - } - - if (!angular.isDefined(src.cql)){ - src.cql = null; - } - - //Final node - var mapExtent = mapService.map.getView().getProjection().getExtent(); - var node = { - title: src.title, - selected: selected, - extraClasses: src.isBaseLayer === true ? 'layertree-basemap' : undefined, - data: { - type: 'WMS', - title: src.title, - typeName: angular.isDefined(src.typeName) ? src.typeName : undefined, - isBaseLayer: src.isBaseLayer, - attribution: src.shortCopyright, - longAttribution: angular.isDefined(src.longCopyright) ? src.longCopyright : undefined, - url: src.url, - serverType: angular.isDefined(src.serverType) ? src.serverType : undefined, - params: { - time_: (new Date()).getTime(), - 'LAYERS': src.layerGeoName, - 'TILED': true, - 'TILESORIGIN': mapExtent[0] + ',' + mapExtent[1], - 'STYLES': angular.isDefined(stylesForObject) === true ? stylesForObject[0] : '', - 'cql_filter': src.cql - } - } - }; - - if (angular.isDefined(filtersForObject)){ - node.data.contextItems = filtersForObject; - } - - - var menuSep = { - className: 'context-menu-item context-menu-separator context-menu-not-selectable' - }; - - if (stylesForObject.length > 1){ - if (angular.isDefined(node.data.contextItems)){ - _.extend(node.data.contextItems, {sep1: menuSep}); - _.extend(node.data.contextItems, stylesForObject[1]); - } else { - node.data.contextItems = stylesForObject[1]; - } - } - - if ((angular.isDefined(src.areaType) && src.areaType === 'SYSAREA') || (angular.isDefined(src.typeName) && (src.typeName === 'PORT' || src.typeName === 'PORTAREA'))){ - _.extend(node.data.contextItems, {sep2: menuSep}); - var settings = { - settingsMenu: { - name: locale.getString('spatial.layer_tree_tip_context_menu'), - icon: function(opt, $itemElement, itemKey, item){ - $itemElement.html('' + item.name); - return 'context-menu-icon-settings'; - } - } - }; - _.extend(node.data.contextItems, settings); - } - - if (angular.isDefined(node.data.contextItems)){ - node.data.contextTip = locale.getString('spatial.layer_tree_tip_context_menu'); - _.extend(node.data.contextItems, {sep3: menuSep}); - } - - return node; - }; - - //Build area nodes - var buildAreaNode = function(src){ - var node; - if (src.areaType === 'SYSAREA'){ - if (angular.isDefined(src.cql)){ - src.groupFilter = { - baseCql: src.cql, - allCql: null - }; - } - node = buildWmsNode(src); - } else if (src.areaType === 'AREAGROUP'){ - node = buildUserAreaGroupNode(src); - } else { - node = buildUserAreaNode(src); - } - - return node; - }; - - //User area group specific node - var buildUserAreaGroupNode = function(src){ - var cql = "(user_name = '" + userService.getUserName() + "' OR scopes ilike '%#" + userService.getCurrentContext().scope.scopeName +"#%')"; - - var newDef = { - isBaseLayer: src.isBaseLayer, - layerGeoName: src.layerGeoName, - longCopyright: src.longCopyright, - shortCopyright: src.shortCopyright, - serverType: src.serverType, - styles: src.styles, - type: src.url, - url: src.url, - title: src.title, - cql: cql + ' AND ' + src.cql_all + ' AND ' +src.cql_active, - filters: { - baseCql: cql, - allCql: src.cql_all, - activeCql: src.cql_active - } - }; - - return buildWmsNode(newDef); - }; - - //User area specific node - var buildUserAreaNode = function(src){ - var filter; - if (src.areaType === 'USERAREA'){ - filter = 'gid = ' + src.gid; - } else { - filter = "user_name = '" + userService.getUserName() + "' AND " + src.cql; - } - - var newDef = { - isBaseLayer: src.isBaseLayer, - layerGeoName: src.layerGeoName, - longCopyright: src.longCopyright, - shortCopyright: src.shortCopyright, - serverType: src.serverType, - styles: src.styles, - type: src.url, - url: src.url, - title: src.title, - cql: filter - }; - - return buildWmsNode(newDef); - }; - - //Check how many WMS styles are available, set the default style and build the style context menu - var checkWmStylesAvailability = function(styles){ - var finalStyles = []; - var styleKeys = Object.keys(styles); - var defaultStyle = styles[styleKeys[0]]; - - finalStyles.push(defaultStyle); - if (styleKeys.length > 1){ - var contextMenuItems = buildStyleContext(styles, defaultStyle); - finalStyles.push(contextMenuItems); - } - - return finalStyles; - }; - - //Cql options for user area group layers (type is USERAREAS), and for ref data (type is REFDATA) - var buildCqlContext = function(filters, type){ - var cqlContext = { - cqlHeader: { - name: locale.getString('spatial.layer_tree_context_menu_show_title'), - disabled: true, - className: 'layer-menu-header' - } - }; - - var name_1, name_2, cql_1, cql_2; - if (type === 'USERAREAS'){ - name_1 = locale.getString('spatial.layer_tree_context_menu_active_areas_title'); - cql_1 = filters.baseCql + ' AND ' + filters.allCql + ' AND ' + filters.activeCql; - name_2 = locale.getString('spatial.layer_tree_context_menu_all_areas_title'); - cql_2 = filters.baseCql + ' AND ' + filters.allCql; - } else { - name_1 = locale.getString('spatial.layer_tree_context_menu_active_groups_title'); - cql_1 = filters.baseCql; - name_2 = locale.getString('spatial.layer_tree_context_menu_all_groups_title'); - cql_2 = filters.allCql; - } - - cqlContext.activeAreas = { - name: name_1, - type: 'radio', - radio: 'filter', - value: 'activeAreas', - cql: cql_1, - selected: true - }; - - cqlContext.allAreas = { - name: name_2, - type: 'radio', - radio: 'filter', - value: 'allAreas', - cql: cql_2, - selected: false - }; - - return cqlContext; - }; - - //Build style contextmenu object - var buildStyleContext = function(styles, defaultStyle){ - var styleContext = { - styleHeader: { - name: locale.getString('spatial.layer_tree_context_menu_style_title'), - disabled: true, - className: 'layer-menu-header' - } - }; - - if (angular.isDefined(styles.geom)){ - styleContext.geomStyle = { - name: locale.getString('spatial.layer_tree_context_menu_geom_style'), - type: 'radio', - radio: 'style', - value: styles.geom, - selected: styles.geom === defaultStyle ? true : false - }; - } - - if (angular.isDefined(styles.labelGeom)){ - styleContext.geomLabelStyle = { - name: locale.getString('spatial.layer_tree_context_menu_geom_label_style'), - type: 'radio', - radio: 'style', - value: styles.labelGeom, - selected: styles.labelGeom === defaultStyle ? true : false - }; - } - - if (angular.isDefined(styles.label)){ - styleContext.labelStyle = { - name: locale.getString('spatial.layer_tree_context_menu_label_style'), - type: 'radio', - radio: 'style', - value: styles.label, - selected: styles.label === defaultStyle ? true : false - }; - } - - return styleContext; - }; - - var loopAndBuildNode = function(nodeFromServer){ - var nodeArray = []; - for (var i = 0; i < nodeFromServer.length; i++){ - var def = nodeFromServer[i]; - switch(def.type){ - case 'WMS': - if (angular.isDefined(def.areaType)){ - nodeArray.push(buildAreaNode(def)); - } else { - nodeArray.push(buildWmsNode(def)); - } - break; - case 'OSM': - nodeArray.push(buildOsmBasedNodes(def)); - break; - case 'OSEA': - nodeArray.push(buildOsmBasedNodes(def)); - break; - case 'BING': - var node = buildBingBasedNodes(def); - if (angular.isDefined(node)){ - nodeArray.push(node); - } - break; - } - } - - return nodeArray; - }; - - //Check if ports and port areas have been configured with group selection - var setAdditionalPortSettings = function(data){ - angular.forEach(data, function(rec) { - if (angular.isDefined(rec.cql)){ - rec.groupFilter = { - baseCql: rec.cql, - allCql: null - }; - } - }); - - return data; - }; - - TreeModel.prototype.fromConfig = function(config){ - var tree = []; - - //Ports - if (angular.isDefined(config.port)){ - var portNodes = loopAndBuildNode(setAdditionalPortSettings(config.port)); - tree.push({ - title: locale.getString('spatial.layer_tree_ports'), - folder: true, - expanded: false, - children: portNodes - }); - } - - //Areas - if (angular.isDefined(config.areas) && config.areas.length > 0){ - var areaNodes = loopAndBuildNode(config.areas); - var areaFolder = { - title: locale.getString('spatial.layer_tree_areas'), - folder: true, - expanded: false, - children: areaNodes - }; - - tree.push(areaFolder); - } - - //Additional cartography - if (angular.isDefined(config.additional)){ - var additionalNodes = loopAndBuildNode(config.additional); - tree.push({ - title: locale.getString('spatial.layer_tree_additional_cartography'), - folder: true, - expanded: false, - children: additionalNodes - }); - } - - //Baselayers - if (angular.isDefined(config.baseLayers)){ - var baseNodes = loopAndBuildNode(config.baseLayers); - tree.push({ - title: locale.getString('spatial.layer_tree_background_layers'), - folder: true, - expanded: true, - unselectable: true, - hideCheckbox: true, - extraClasses: 'layertree-baselayer-node', - key: 'basemap', - children: baseNodes - }); - } - - baseLayerCounter = 0; - return tree; - }; - - //Build vector nodes for positions and segments - var buildVectorNodes = function(type, data){ - var title, lyrType, longCopyright, extraCls; - var selected = false; - - switch (type) { - case 'positions': - title = locale.getString('spatial.layer_tree_positions'); - selected = true; - lyrType = 'vmspos'; - longCopyright = locale.getString('spatial.vms_positions_long_copyright'); - break; - case 'segments': - title = locale.getString('spatial.layer_tree_segments'); - lyrType = 'vmsseg'; - longCopyright = locale.getString('spatial.vms_positions_long_copyright'); - break; - case 'activities': - title = locale.getString('spatial.layer_tree_activities'); - lyrType = 'ers'; - longCopyright = locale.getString('spatial.activities_long_copyright'); - break; - default: - break; - } - - var node = { - title: title, - selected: selected, - extraClasses: extraCls, - data: { - excludeDnd: true, - title: title, - type: lyrType, - isBaseLayer: false, - optionsEnabled: true, - optionsTip: 'spatial.layer_tree_tip_context_menu', - labelEnabled: true, - labelTip: 'spatial.layer_tree_tip_label_vector', - longAttribution: longCopyright.length > 0 ? longCopyright : undefined, - geoJson: data - } - }; - - var childNodes = []; - - - if (type === 'activities'){ - node.data.optionsEnabled = false; //FIXME this should be removed when we implement conmtext menu options for activities layer - node.data.filterProperty = 'activityType'; - - var activityTypes = _.map(data.features, function(feat){ - return feat.properties.activityType; - }); - - activityTypes = _.sortBy(_.uniq(activityTypes), function(type){ - return type; - }); - - if (activityTypes.length > 0){ - angular.forEach(activityTypes, function(type){ - var abbr = locale.getString('abbreviations.activity_' + type); - childNodes.push({ - title: abbr !== "%%KEY_NOT_FOUND%%" ? abbr : type, - filterType: type, - type: 'ers-type', - excludeDnd: true, - selected: false - }); - }); - - node.children = childNodes; - } - } - - if (type === 'positions'){ - node.data.filterProperty = 'source'; - var sourceArray = _.map(data.features, function(feat){ - return feat.properties.source; - }); - - sourceArray = _.sortBy(_.uniq(sourceArray), function(src){ - return src; - }); - - if (sourceArray.length > 0){ - angular.forEach(sourceArray, function(source){ - childNodes.push({ - title: source, - filterType: source, - type: 'vmspos-type', - excludeDnd: true, - selected: true - }); - }); - - node.children = childNodes; - } - } - - return node; - }; - - //Build parent folder node for vms layers - TreeModel.prototype.nodeFromData = function(data){ - var finalNodes = []; - var vectorNodes = []; - //FIXME uncomment - if (data.movements.features.length > 0){ - vectorNodes.push(buildVectorNodes('positions', data.movements)); - } - if (data.segments.features.length > 0){ - vectorNodes.push(buildVectorNodes('segments', data.segments)); - } - - if (vectorNodes.length > 0){ - var node = { - title: locale.getString('spatial.layer_tree_vms'), - type: 'vmsdata', - folder: true, - expanded: true, - children: vectorNodes - }; - finalNodes.push(node); - } - - if (data.activities.features.length > 0){ - finalNodes.push(buildVectorNodes('activities', data.activities)); - } - - if (finalNodes.length > 0){ - return finalNodes; - } - - }; - - //Build node for alarms - TreeModel.prototype.nodeForAlarms = function(data){ - var longCopyright = locale.getString('spatial.alarms_long_copyright'); - var title = locale.getString('spatial.layer_tree_alarms'); - var node = { - title: title, - type: 'alarms', - folder: false, - selected: true, - extraClasses: 'layertree-alarms', - data: { - excludeDnd: true, - title: title, - type: 'alarms', - optionsEnabled: true, - optionsTip: 'spatial.layer_tree_tip_context_menu', - longAttribution: longCopyright.length > 0 ? longCopyright : undefined, - geoJson: data - } - }; - - return [node]; - }; - - return TreeModel; -}); +/* +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . +*/ +angular.module('unionvmsWeb').factory('TreeModel',function(locale, mapService, userService) { + + function TreeModel(){} + + var baseLayerCounter = 0; + + //Build tree node for OSM based layers + var buildOsmBasedNodes = function(src, layerConfig){ + if (src.isBaseLayer === true){ + baseLayerCounter += 1; + } + + var selectedOsmBaseNode = src.isBaseLayer === false ? undefined : (baseLayerCounter === 1 ? true : false); + + if (src.type === 'OSM' && layerConfig.hasOwnProperty('OSM')) { + selectedOsmBaseNode = layerConfig['OSM']; + } + + if (src.type === 'OSEA' && layerConfig.hasOwnProperty('OSEA')) { + selectedOsmBaseNode = layerConfig['OSEA']; + } + + var node = { + title: src.title, + selected: selectedOsmBaseNode, + extraClasses: src.isBaseLayer === true ? 'layertree-basemap' : undefined, + data: { + type: src.type, + isBaseLayer: src.isBaseLayer, + title: src.title + } + }; + + return node; + }; + + //Build tree node for Bing based layers + var buildBingBasedNodes = function(src, layerConfig){ + if (angular.isDefined(src.apiKey) && src.apiKey !== ''){ + baseLayerCounter += 1; + + var layerTitle = locale.getString('spatial.layer_tree_' + src.title); + var node = { + title: layerTitle, + selected: baseLayerCounter === 1 ? true : false, + extraClasses: 'layertree-basemap', + data: { + type: src.type, + isBaseLayer: true, + title: layerTitle, + layerGeoName: src.layerGeoName, + apiKey: src.apiKey + } + }; + + return node; + } + }; + + + //Build a tree node for WMS layers + var buildWmsNode = function(src, layerConfig){ + var stylesForObject = []; + var selected = false; + if (angular.isDefined(src.styles)){ + stylesForObject = checkWmStylesAvailability(src.styles); + } + + var filtersForObject; + //This is for user areas only + if (angular.isDefined(src.filters)){ + filtersForObject = buildCqlContext(src.filters, 'USERAREAS'); + } + + //This is for system areas and port data + if (angular.isDefined(src.groupFilter)){ + filtersForObject = buildCqlContext(src.groupFilter, 'REFDATA'); + } + + if (src.isBaseLayer === true){ + baseLayerCounter += 1; + if (baseLayerCounter === 1){ + selected = true; + } + } + + if (!angular.isDefined(src.cql)){ + src.cql = null; + } + + var finalSelected = false; + + switch(src.typeName) { + case 'PORT': + finalSelected = layerConfig.hasOwnProperty('PORT') ? layerConfig['PORT'] : selected; + break; + case'PORTAREA': + finalSelected = layerConfig.hasOwnProperty('PORTAREA') ? layerConfig['PORTAREA'] : selected; + break; + case'RFMO': + finalSelected = layerConfig.hasOwnProperty('RFMO') ? layerConfig['RFMO'] : selected; + break; + case'EEZ': + finalSelected = layerConfig.hasOwnProperty('EEZ') ? layerConfig['EEZ'] : selected; + break; + default: + finalSelected = selected; + } + + //Final node + var mapExtent = mapService.map.getView().getProjection().getExtent(); + var node = { + title: src.title, + selected: finalSelected, + extraClasses: src.isBaseLayer === true ? 'layertree-basemap' : undefined, + data: { + type: 'WMS', + title: src.title, + typeName: angular.isDefined(src.typeName) ? src.typeName : undefined, + isBaseLayer: src.isBaseLayer, + attribution: src.shortCopyright, + longAttribution: angular.isDefined(src.longCopyright) ? src.longCopyright : undefined, + url: src.url, + serverType: angular.isDefined(src.serverType) ? src.serverType : undefined, + params: { + time_: (new Date()).getTime(), + 'LAYERS': src.layerGeoName, + 'TILED': true, + 'TILESORIGIN': mapExtent[0] + ',' + mapExtent[1], + 'STYLES': angular.isDefined(stylesForObject) === true ? stylesForObject[0] : '', + 'cql_filter': src.cql + } + } + }; + + if (angular.isDefined(filtersForObject)){ + node.data.contextItems = filtersForObject; + } + + + var menuSep = { + className: 'context-menu-item context-menu-separator context-menu-not-selectable' + }; + + if (stylesForObject.length > 1){ + if (angular.isDefined(node.data.contextItems)){ + _.extend(node.data.contextItems, {sep1: menuSep}); + _.extend(node.data.contextItems, stylesForObject[1]); + } else { + node.data.contextItems = stylesForObject[1]; + } + } + + if ((angular.isDefined(src.areaType) && src.areaType === 'SYSAREA') || (angular.isDefined(src.typeName) && (src.typeName === 'PORT' || src.typeName === 'PORTAREA'))){ + _.extend(node.data.contextItems, {sep2: menuSep}); + var settings = { + settingsMenu: { + name: locale.getString('spatial.layer_tree_tip_context_menu'), + icon: function(opt, $itemElement, itemKey, item){ + $itemElement.html('' + item.name); + return 'context-menu-icon-settings'; + } + } + }; + _.extend(node.data.contextItems, settings); + } + + if (angular.isDefined(node.data.contextItems)){ + node.data.contextTip = locale.getString('spatial.layer_tree_tip_context_menu'); + _.extend(node.data.contextItems, {sep3: menuSep}); + } + + return node; + }; + + //Build area nodes + var buildAreaNode = function(src, layerConfig){ + var node; + if (src.areaType === 'SYSAREA'){ + if (angular.isDefined(src.cql)){ + src.groupFilter = { + baseCql: src.cql, + allCql: null + }; + } + node = buildWmsNode(src, layerConfig); + } else if (src.areaType === 'AREAGROUP'){ + node = buildUserAreaGroupNode(src, layerConfig); + } else { + node = buildUserAreaNode(src, layerConfig); + } + + return node; + }; + + //User area group specific node + var buildUserAreaGroupNode = function(src, layerConfig){ + var cql = "(user_name = '" + userService.getUserName() + "' OR scopes ilike '%#" + userService.getCurrentContext().scope.scopeName +"#%')"; + + var newDef = { + isBaseLayer: src.isBaseLayer, + layerGeoName: src.layerGeoName, + longCopyright: src.longCopyright, + shortCopyright: src.shortCopyright, + serverType: src.serverType, + styles: src.styles, + type: src.url, + url: src.url, + title: src.title, + cql: cql + ' AND ' + src.cql_all + ' AND ' +src.cql_active, + filters: { + baseCql: cql, + allCql: src.cql_all, + activeCql: src.cql_active + } + }; + + return buildWmsNode(newDef, layerConfig); + }; + + //User area specific node + var buildUserAreaNode = function(src, layerConfig){ + var filter; + if (src.areaType === 'USERAREA'){ + filter = 'gid = ' + src.gid; + } else { + filter = "user_name = '" + userService.getUserName() + "' AND " + src.cql; + } + + var newDef = { + isBaseLayer: src.isBaseLayer, + layerGeoName: src.layerGeoName, + longCopyright: src.longCopyright, + shortCopyright: src.shortCopyright, + serverType: src.serverType, + styles: src.styles, + type: src.url, + url: src.url, + title: src.title, + cql: filter + }; + + return buildWmsNode(newDef, layerConfig); + }; + + //Check how many WMS styles are available, set the default style and build the style context menu + var checkWmStylesAvailability = function(styles){ + var finalStyles = []; + var styleKeys = Object.keys(styles); + var defaultStyle = styles[styleKeys[0]]; + + finalStyles.push(defaultStyle); + if (styleKeys.length > 1){ + var contextMenuItems = buildStyleContext(styles, defaultStyle); + finalStyles.push(contextMenuItems); + } + + return finalStyles; + }; + + //Cql options for user area group layers (type is USERAREAS), and for ref data (type is REFDATA) + var buildCqlContext = function(filters, type){ + var cqlContext = { + cqlHeader: { + name: locale.getString('spatial.layer_tree_context_menu_show_title'), + disabled: true, + className: 'layer-menu-header' + } + }; + + var name_1, name_2, cql_1, cql_2; + if (type === 'USERAREAS'){ + name_1 = locale.getString('spatial.layer_tree_context_menu_active_areas_title'); + cql_1 = filters.baseCql + ' AND ' + filters.allCql + ' AND ' + filters.activeCql; + name_2 = locale.getString('spatial.layer_tree_context_menu_all_areas_title'); + cql_2 = filters.baseCql + ' AND ' + filters.allCql; + } else { + name_1 = locale.getString('spatial.layer_tree_context_menu_active_groups_title'); + cql_1 = filters.baseCql; + name_2 = locale.getString('spatial.layer_tree_context_menu_all_groups_title'); + cql_2 = filters.allCql; + } + + cqlContext.activeAreas = { + name: name_1, + type: 'radio', + radio: 'filter', + value: 'activeAreas', + cql: cql_1, + selected: true + }; + + cqlContext.allAreas = { + name: name_2, + type: 'radio', + radio: 'filter', + value: 'allAreas', + cql: cql_2, + selected: false + }; + + return cqlContext; + }; + + //Build style contextmenu object + var buildStyleContext = function(styles, defaultStyle){ + var styleContext = { + styleHeader: { + name: locale.getString('spatial.layer_tree_context_menu_style_title'), + disabled: true, + className: 'layer-menu-header' + } + }; + + if (angular.isDefined(styles.geom)){ + styleContext.geomStyle = { + name: locale.getString('spatial.layer_tree_context_menu_geom_style'), + type: 'radio', + radio: 'style', + value: styles.geom, + selected: styles.geom === defaultStyle ? true : false + }; + } + + if (angular.isDefined(styles.labelGeom)){ + styleContext.geomLabelStyle = { + name: locale.getString('spatial.layer_tree_context_menu_geom_label_style'), + type: 'radio', + radio: 'style', + value: styles.labelGeom, + selected: styles.labelGeom === defaultStyle ? true : false + }; + } + + if (angular.isDefined(styles.label)){ + styleContext.labelStyle = { + name: locale.getString('spatial.layer_tree_context_menu_label_style'), + type: 'radio', + radio: 'style', + value: styles.label, + selected: styles.label === defaultStyle ? true : false + }; + } + + return styleContext; + }; + + var loopAndBuildNode = function(nodeFromServer, layerConfig){ + var nodeArray = []; + for (var i = 0; i < nodeFromServer.length; i++){ + var def = nodeFromServer[i]; + switch(def.type){ + case 'WMS': + if (angular.isDefined(def.areaType)){ + nodeArray.push(buildAreaNode(def, layerConfig)); + } else { + nodeArray.push(buildWmsNode(def, layerConfig)); + } + break; + case 'OSM': + nodeArray.push(buildOsmBasedNodes(def, layerConfig)); + break; + case 'OSEA': + nodeArray.push(buildOsmBasedNodes(def, layerConfig)); + break; + case 'BING': + var node = buildBingBasedNodes(def, layerConfig); + if (angular.isDefined(node)){ + nodeArray.push(node); + } + break; + } + } + + return nodeArray; + }; + + //Check if ports and port areas have been configured with group selection + var setAdditionalPortSettings = function(data){ + angular.forEach(data, function(rec) { + if (angular.isDefined(rec.cql)){ + rec.groupFilter = { + baseCql: rec.cql, + allCql: null + }; + } + }); + + return data; + }; + + TreeModel.prototype.fromConfig = function(config, layerConfig){ + var tree = []; + + //Ports + if (angular.isDefined(config.port)){ + var portNodes = loopAndBuildNode(setAdditionalPortSettings(config.port), layerConfig); + tree.push({ + title: locale.getString('spatial.layer_tree_ports'), + folder: true, + expanded: false, + children: portNodes, + data: { + type: 'PortMain' + } + }); + } + + //Areas + if (angular.isDefined(config.areas) && config.areas.length > 0){ + var areaNodes = loopAndBuildNode(config.areas, layerConfig); + var areaFolder = { + title: locale.getString('spatial.layer_tree_areas'), + folder: true, + expanded: false, + children: areaNodes, + data: { + type: 'AreasMain' + } + }; + + tree.push(areaFolder); + } + + //Additional cartography + if (angular.isDefined(config.additional)){ + var additionalNodes = loopAndBuildNode(config.additional, layerConfig); + tree.push({ + title: locale.getString('spatial.layer_tree_additional_cartography'), + folder: true, + expanded: false, + children: additionalNodes, + data: { + type: 'CartographyMain' + } + }); + } + + //Baselayers + if (angular.isDefined(config.baseLayers)){ + var baseNodes = loopAndBuildNode(config.baseLayers, layerConfig); + tree.push({ + title: locale.getString('spatial.layer_tree_background_layers'), + folder: true, + expanded: true, + unselectable: true, + hideCheckbox: true, + extraClasses: 'layertree-baselayer-node', + key: 'basemap', + children: baseNodes, + data: { + type: 'BaseMain' + } + }); + } + + baseLayerCounter = 0; + return tree; + }; + + //Build vector nodes for positions and segments + var buildVectorNodes = function(type, data, layerConfiguration){ + var title, lyrType, longCopyright, extraCls; + var selected = false; + + switch (type) { + case 'positions': + title = locale.getString('spatial.layer_tree_positions'); + selected = layerConfiguration.hasOwnProperty('vmspos') ? layerConfiguration['vmspos'] : true; + lyrType = 'vmspos'; + longCopyright = locale.getString('spatial.vms_positions_long_copyright'); + break; + case 'segments': + selected = layerConfiguration.hasOwnProperty('vmsseg') ? layerConfiguration['vmsseg'] : selected; + title = locale.getString('spatial.layer_tree_segments'); + lyrType = 'vmsseg'; + longCopyright = locale.getString('spatial.vms_positions_long_copyright'); + break; + case 'activities': + title = locale.getString('spatial.layer_tree_activities'); + lyrType = 'ers'; + longCopyright = locale.getString('spatial.activities_long_copyright'); + break; + default: + break; + } + + var node = { + title: title, + selected: selected, + extraClasses: extraCls, + data: { + excludeDnd: true, + title: title, + type: lyrType, + isBaseLayer: false, + optionsEnabled: true, + optionsTip: 'spatial.layer_tree_tip_context_menu', + labelEnabled: true, + labelTip: 'spatial.layer_tree_tip_label_vector', + longAttribution: longCopyright.length > 0 ? longCopyright : undefined, + geoJson: data + } + }; + + var childNodes = []; + + + if (type === 'activities'){ + node.data.optionsEnabled = false; //FIXME this should be removed when we implement conmtext menu options for activities layer + node.data.filterProperty = 'activityType'; + + var activityTypes = _.map(data.features, function(feat){ + return feat.properties.activityType; + }); + + activityTypes = _.sortBy(_.uniq(activityTypes), function(type){ + return type; + }); + + if (activityTypes.length > 0){ + angular.forEach(activityTypes, function(type){ + var selectedByType = false; + if (type === 'ARRIVAL') { + selectedByType = layerConfiguration.hasOwnProperty('ARRIVAL') ? layerConfiguration['ARRIVAL'] : selectedByType; + } else if (type === 'DEPARTURE') { + selectedByType = layerConfiguration.hasOwnProperty('DEPARTURE') ? layerConfiguration['DEPARTURE'] : selectedByType; + } else if (type === 'FISHING_OPERATION') { + selectedByType = layerConfiguration.hasOwnProperty('FISHING_OPERATION') ? layerConfiguration['FISHING_OPERATION'] : selectedByType; + } + var abbr = locale.getString('abbreviations.activity_' + type); + childNodes.push({ + title: abbr !== "%%KEY_NOT_FOUND%%" ? abbr : type, + filterType: type, + type: 'ers-type', + excludeDnd: true, + selected: selectedByType + }); + }); + + node.children = childNodes; + } + } + + if (type === 'positions'){ + node.data.filterProperty = 'source'; + var sourceArray = _.map(data.features, function(feat){ + return feat.properties.source; + }); + + sourceArray = _.sortBy(_.uniq(sourceArray), function(src){ + return src; + }); + + var selectedVmsPosType = false; + if (layerConfiguration.hasOwnProperty('vmspos') && layerConfiguration['vmspos'] === false) { + selectedVmsPosType = false; + } else { + selectedVmsPosType = layerConfiguration.hasOwnProperty('vmspos-type') ? layerConfiguration['vmspos-type'] : false; + } + + if (sourceArray.length > 0){ + angular.forEach(sourceArray, function(source){ + childNodes.push({ + title: source, + filterType: source, + type: 'vmspos-type', + excludeDnd: true, + selected: selectedVmsPosType + }); + }); + + node.children = childNodes; + } + } + + return node; + }; + + //Build parent folder node for vms layers + TreeModel.prototype.nodeFromData = function(data, layerConfiguration){ + var finalNodes = []; + var vectorNodes = []; + //FIXME uncomment + if (data.movements.features.length > 0){ + vectorNodes.push(buildVectorNodes('positions', data.movements, layerConfiguration)); + } + if (data.segments.features.length > 0){ + vectorNodes.push(buildVectorNodes('segments', data.segments, layerConfiguration)); + } + + if (vectorNodes.length > 0){ + var node = { + title: locale.getString('spatial.layer_tree_vms'), + type: 'vmsdata', + folder: true, + expanded: true, + children: vectorNodes + }; + finalNodes.push(node); + } + + if (data.activities.features.length > 0){ + finalNodes.push(buildVectorNodes('activities', data.activities, layerConfiguration)); + } + + if (finalNodes.length > 0){ + return finalNodes; + } + + }; + + //Build node for alarms + TreeModel.prototype.nodeForAlarms = function(data){ + var longCopyright = locale.getString('spatial.alarms_long_copyright'); + var title = locale.getString('spatial.layer_tree_alarms'); + var node = { + title: title, + type: 'alarms', + folder: false, + selected: true, + extraClasses: 'layertree-alarms', + data: { + excludeDnd: true, + title: title, + type: 'alarms', + optionsEnabled: true, + optionsTip: 'spatial.layer_tree_tip_context_menu', + longAttribution: longCopyright.length > 0 ? longCopyright : undefined, + geoJson: data + } + }; + + return [node]; + }; + + return TreeModel; +}); diff --git a/unionvms-web/app/partial/spatial/reportsPanel/reportForm/reportForm.js b/unionvms-web/app/partial/spatial/reportsPanel/reportForm/reportForm.js index d27dfe7b4..1e1745bac 100644 --- a/unionvms-web/app/partial/spatial/reportsPanel/reportForm/reportForm.js +++ b/unionvms-web/app/partial/spatial/reportsPanel/reportForm/reportForm.js @@ -1,636 +1,648 @@ -/* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . -*/ -angular.module('unionvmsWeb').controller('ReportformCtrl',function($scope, $modal, $anchorScroll, reportMsgService, locale, Report, reportRestService, spatialRestService, configurationService, movementRestService, reportService, SpatialConfig, spatialConfigRestService, userService, loadingStatus, reportFormService){ - //Report form mode - $scope.showVesselFilter = false; - - //set visibility types in dropdown option - $scope.visibilities = []; - - //Set the available report types to create - $scope.reportTypes = [ - {"text": locale.getString('spatial.reports_form_type_standard'), "code": "standard"}, - {"text": locale.getString('spatial.reports_form_type_summary'), "code": "summary"} - ]; - - //Set positions selector dropdown options - $scope.positionItems = [ - {"text": locale.getString('spatial.reports_form_positions_selector_option_all'), "code": "all"}, - {"text": locale.getString('spatial.reports_form_positions_selector_option_last'), "code": "last"} - ]; - - //Set positions selector dropdown options - $scope.positionTypeItems = [ - {"text": locale.getString('spatial.reports_form_positions_selector_type_option_positions'), "code": "positions"}, - {"text": locale.getString('spatial.reports_form_positions_selector_type_option_hours'), "code": "hours"} - ]; - - //Set vessel search type dropdown options - $scope.vesselSearchItems = [ - {"text": locale.getString('spatial.reports_form_vessels_search_by_vessel'), "code": "asset"}, - {"text": locale.getString('spatial.reports_form_vessels_search_by_group'), "code": "vgroup"} - ]; - - //Set movement type dropdown options - $scope.movementTypes = configurationService.setTextAndCodeForDropDown(configurationService.getValue('MOVEMENT', 'MESSAGE_TYPE'),'MESSAGE_TYPE','MOVEMENT'); - - //Set movemment activity type dropdown options - $scope.activityTypes = configurationService.setTextAndCodeForDropDown(configurationService.getValue('MOVEMENT', 'ACTIVITY_TYPE'), 'ACTIVITY_TYPE', 'MOVEMENT'); - - //Set category types dropdown options - $scope.categoryTypes = configurationService.setTextAndCodeForDropDown(configurationService.getValue('MOVEMENT', 'CATEGORY_TYPE'), 'CATEGORY_TYPE', 'MOVEMENT'); - - //Set movement source types dropdown options - $scope.movementSourceTypes = configurationService.setTextAndCodeForDropDown(configurationService.getConfig('MOVEMENT_SOURCE_TYPES'),'MOVEMENT_SOURCE_TYPES','MOVEMENT'); - - $scope.submitingReport = false; - - $scope.repFormServ = reportFormService; - - - $scope.aggregationTypes = [ - { - code: "FLAG_STATE", - text: locale.getString('spatial.criteria_flag_state') - }, - { - code: "VESSEL", - text: locale.getString('spatial.criteria_vessel') - }, - { - code: "DATE", - text: locale.getString('spatial.criteria_date'), - items: [ - { - code: "DATE_DAY", - text: locale.getString('spatial.criteria_date_day') - }, - { - code: "DATE_MONTH", - text: locale.getString('spatial.criteria_date_month') - }, - { - code: "DATE_YEAR", - text: locale.getString('spatial.criteria_date_year') - } - ], - selection: "single" - }, - { - code: "AREA", - text: locale.getString('spatial.criteria_area'), - items: [ - { - code: "TERRITORY", - text: locale.getString('spatial.criteria_territory') - }, - { - code: "FAO_AREA", - text: locale.getString('spatial.criteria_fao_area') - }, - { - code: "ICES_STAT_RECTANGLE", - text: locale.getString('spatial.criteria_ices_stat_rectangle') - }, - { - code: "EFFORT_ZONE", - text: locale.getString('spatial.criteria_effort_zone') - }, - { - code: "RFMO", - text: locale.getString('spatial.criteria_rfmo') - }, - { - code: "GFCM_GSA", - text: locale.getString('spatial.criteria_gfcm_gsa') - }, - { - code: "GFCM_STAT_RECTANGLE", - text: locale.getString('spatial.criteria_gfcm_stat_rectangle') - } - ], - selection: "multiple" - }, - { - code: "GEAR_TYPE", - text: locale.getString('spatial.criteria_gear_type') - }, - { - code: "SPECIES", - text: locale.getString('spatial.criteria_species') - }, - { - code: "PRESENTATION", - text: locale.getString('spatial.criteria_presentation') - } - ]; - - $scope.showSaveBtn = function(){ - var result = false; - if ($scope.formMode === 'CREATE'){ - result = true; - } else { - if ((angular.isDefined($scope.report) && $scope.report.createdBy === userService.getUserName()) || $scope.isAllowed('Reporting', 'MANAGE_ALL_REPORTS')){ - result = true; - } - } - return result; - }; - - $scope.init = function(){ - $scope.formAlert = { - visible: false, - msg: '' - }; - $scope.submitingReport = false; - - if ($scope.formMode === 'CREATE'){ - $scope.report.vesselsSelection = []; - } - $scope.showVesselFilter = false; - $scope.selectedAreas = []; - - $scope.shared = { - vesselSearchBy: 'asset', - searchVesselString: '', - selectAll: false, - selectedVessels: 0, - vessels: [], - areas: [] - }; - - if ($scope.report.movSources.length === 0){ - $scope.report.movSources = []; - angular.forEach($scope.movementSourceTypes, function(item){ - $scope.report.movSources.push(item.code); - }); - } - - $scope.checkVisibilities(); - }; - - $scope.checkVisibilities = function(){ - $scope.visibilities = [{"text": locale.getString('spatial.reports_table_share_label_private'), "code": "private"}]; - var availableVisibilities = ['SCOPE', 'PUBLIC']; - angular.forEach(availableVisibilities, function(visibility) { - if (userService.isAllowed('SHARE_REPORT_' + visibility, 'Reporting', true) || userService.isAllowed('MANAGE_ALL_REPORTS', 'Reporting', true)){ - var name = visibility.toLowerCase(); - $scope.visibilities.push({"text": locale.getString('spatial.reports_table_share_label_' + name), "code": name}); - } - }); - }; - - $scope.resetForm = function(){ - reportFormService.report = new Report(); - $scope.report = reportFormService.report; - $scope.init(); - $scope.reportForm.$setPristine(); - $scope.clearVmsErrors(); - }; - - $scope.clearVmsErrors = function(){ - for (var attr in $scope.reportForm.$error){ - $scope.reportForm.$setValidity(attr, true); - } - }; - - $scope.validateRanges = function(){ - var min, max, minD, maxD; - var status = true; - - //Validate positions speed range - if (angular.isDefined($scope.report.vmsFilters.positions) && !_.isEmpty($scope.report.vmsFilters.positions)){ - min = $scope.report.vmsFilters.positions.movMinSpeed; - max = $scope.report.vmsFilters.positions.movMaxSpeed; - - validateRangeFieldGroup(min,max,'movMinSpeed','movMaxSpeed','positionSecForm'); - } - - //Validate segments speed and duration ranges - if (angular.isDefined($scope.report.vmsFilters.segments) && !_.isEmpty($scope.report.vmsFilters.segments)){ - min = $scope.report.vmsFilters.segments.segMinSpeed; - max = $scope.report.vmsFilters.segments.segMaxSpeed; - - validateRangeFieldGroup(min,max,'segMinSpeed','segMaxSpeed','segmentSecForm'); - - minD = $scope.report.vmsFilters.segments.segMinDuration; - maxD = $scope.report.vmsFilters.segments.segMaxDuration; - - validateRangeFieldGroup(minD,maxD,'segMinDuration','segMaxDuration','segmentSecForm'); - } - - //Validate tracks time at sea and duration ranges - if (angular.isDefined($scope.report.vmsFilters.tracks) && !_.isEmpty($scope.report.vmsFilters.tracks)){ - min = $scope.report.vmsFilters.tracks.trkMinTime; - max = $scope.report.vmsFilters.tracks.trkMaxTime; - - validateRangeFieldGroup(min,max,'trkMinTime','trkMaxTime','trackSecForm'); - - minD = $scope.report.vmsFilters.tracks.trkMinDuration; - maxD = $scope.report.vmsFilters.tracks.trkMaxDuration; - - validateRangeFieldGroup(minD,maxD,'trkMinDuration','trkMaxDuration','trackSecForm'); - } - }; - - var validateRangeFieldGroup = function(min,max,fieldMin,fieldMax,subForm){ - if(angular.isDefined(min) && min<0){ - $scope.reportForm.reportBodyForm[subForm][fieldMin].$setValidity('minError', false); - }else{ - $scope.reportForm.reportBodyForm[subForm][fieldMin].$setValidity('minError', true); - } - if(angular.isDefined(max) && max<0){ - $scope.reportForm.reportBodyForm[subForm][fieldMax].$setValidity('minError', false); - }else{ - $scope.reportForm.reportBodyForm[subForm][fieldMax].$setValidity('minError', true); - } - if(angular.isDefined(min) && angular.isDefined(max) && min !== null && max !== null && min > max){ - $scope.reportForm.reportBodyForm[subForm][fieldMax].$setValidity('maxError', false); - }else{ - $scope.reportForm.reportBodyForm[subForm][fieldMax].$setValidity('maxError', true); - } - }; - - $scope.saveReport = function(){ - loadingStatus.isLoading('SaveReport',true); - $scope.submitingReport = true; - $scope.validateRanges(); - if ($scope.reportForm.$valid){ - $scope.report.areas = $scope.exportSelectedAreas(); - $scope.currentRepCopy = angular.copy($scope.report); - $scope.report.currentMapConfig.mapConfiguration.layerSettings = reportFormService.checkLayerSettings($scope.report.currentMapConfig.mapConfiguration.layerSettings); - $scope.report = reportFormService.checkMapConfigDifferences($scope.report); - switch ($scope.formMode) { - case 'CREATE': - reportRestService.createReport($scope.report).then(createReportSuccess, createReportError); - break; - case 'EDIT': - reportRestService.updateReport($scope.report).then(updateReportSuccess, updateReportError); - break; - case 'EDIT-FROM-LIVEVIEW': - if (!angular.equals($scope.currentRepCopy, reportFormService.liveView.originalReport)){ - reportRestService.updateReport($scope.report).then(updateReportSuccess, updateReportError); - } else { - loadingStatus.isLoading('SaveReport',false); - $scope.repNav.goToView('liveViewPanel','mapPanel'); - } - - break; - } - } else { - loadingStatus.isLoading('SaveReport',false); - var invalidElm = angular.element('#reportForm')[0].querySelector('.ng-invalid'); - var errorElm = angular.element('#reportForm')[0].querySelector('.has-error'); - if (invalidElm){ - invalidElm.scrollIntoView(); - } else if (invalidElm === null && errorElm){ - errorElm.scrollIntoView(); - } - } - }; - - $scope.validateDates = function(sDate, eDate){ - var sMomDate = moment(sDate, 'YYYY-MM-DD'); - var eMomDate = moment(eDate, 'YYYY-MM-DD'); - - if (sMomDate.isAfter(eMomDate)){ - return false; - } else { - return true; - } - }; - - $scope.openMapConfigurationModal = function(){ - var modalInstance = $modal.open({ - templateUrl: 'partial/spatial/reportsPanel/reportForm/mapConfigurationModal/mapConfigurationModal.html', - controller: 'MapconfigurationmodalCtrl', - size: 'lg', - resolve: { - reportConfigs: function(){ - return angular.copy($scope.report.currentMapConfig); - }, - displayComponents: function(){ - var components = { - visibility: { - position: true, - segment: true - } - }; - - if ($scope.report.withMap){ - components.map = true; - components.layers = true; - components.referenceData = true; - components.styles = { - position: true, - segment: true, - alarm: true - }; - } - - return components; - } - } - }); - - modalInstance.result.then(function(data){ - if(!angular.equals($scope.report.currentMapConfig.mapConfiguration,data.mapSettings)){ - $scope.reportForm.$setDirty(); - $scope.report.currentMapConfig.mapConfiguration = data.mapSettings; - } - }); - }; - - $scope.runReport = function() { - $scope.submitingReport = true; - $scope.validateRanges(); - if($scope.reportForm.reportBodyForm.$valid){ - $scope.report.areas = $scope.exportSelectedAreas(); - reportService.runReportWithoutSaving($scope.report); - - if (!angular.equals($scope.report, reportFormService.liveView.originalReport)){ - reportFormService.liveView.outOfDate = true; - } else { - reportFormService.liveView.outOfDate = false; - } - reportFormService.liveView.currentTempReport = undefined; - }else{ - var invalidElm = angular.element('#reportForm')[0].querySelector('.ng-invalid'); - var errorElm = angular.element('#reportForm')[0].querySelector('.has-error'); - if (invalidElm){ - invalidElm.scrollIntoView(); - } else if (invalidElm === null && errorElm){ - errorElm.scrollIntoView(); - } - } - }; - - $scope.saveAsReport = function() { - $scope.submitingReport = true; - $scope.validateRanges(); - if ($scope.reportForm.reportBodyForm.$valid){ - var modalInstance = $modal.open({ - templateUrl: 'partial/spatial/reportsPanel/reportForm/saveAsModal/saveAsModal.html', - controller: 'SaveasmodalCtrl', - size: 'md', - resolve: { - reportData: function(){ - return $scope.report; - } - } - }); - - modalInstance.result.then(function(data){ - data.areas = $scope.exportSelectedAreas(); - data.currentMapConfig.mapConfiguration.layerSettings = reportFormService.checkLayerSettings(data.currentMapConfig.mapConfiguration.layerSettings); - data = reportFormService.checkMapConfigDifferences(data); - reportRestService.createReport(data).then(createReportSuccess, createReportError); - }); - } else { - var invalidElm = angular.element('#reportForm')[0].querySelector('.ng-invalid'); - var errorElm = angular.element('#reportForm')[0].querySelector('.has-error'); - if (invalidElm){ - invalidElm.scrollIntoView(); - } else if (invalidElm === null && errorElm){ - errorElm.scrollIntoView(); - } - } - - }; - - $scope.$watch('report.positionSelector', function(newVal, oldVal){ - if ($scope.report && newVal === 'all'){ - //Reset X Value field - $scope.report.xValue = undefined; - } - }); - - $scope.$watch('report.positionTypeSelector', function(newVal, oldVal){ - if ($scope.report && newVal === 'hours'){ - $scope.report.startDateTime = undefined; - $scope.report.endDateTime = undefined; - } - }); - - var createReportSuccess = function(response){ - reportService.loadReportHistory(); - if($scope.repNav.hasPreviousState()){ - $scope.repNav.goToPreviousView(); - }else{ - $scope.repNav.goToView('liveViewPanel','mapPanel',$scope.openReportList); - } - reportFormService.report = undefined; - reportMsgService.show('spatial.success_create_report', 'success', true, 8000); - loadingStatus.isLoading('SaveReport',false); - }; - - var createReportError = function(error){ - reportError(error,'spatial.error_create_report'); - loadingStatus.isLoading('SaveReport',false); - }; - - var updateReportSuccess = function(response){ - reportService.loadReportHistory(); - - reportMsgService.show('spatial.success_update_report', 'success', true, 8000); - if ($scope.formMode === 'EDIT'){ - if($scope.repNav.hasPreviousState()){ - $scope.repNav.goToPreviousView(); - }else{ - $scope.repNav.goToView('liveViewPanel','mapPanel',$scope.openReportList); - } - reportFormService.report = undefined; - } else if ($scope.formMode === 'EDIT-FROM-LIVEVIEW'){ - angular.copy($scope.currentRepCopy,reportFormService.liveView.currentReport); - delete $scope.currentRepCopy; - angular.copy(reportFormService.liveView.currentReport, reportFormService.liveView.originalReport); - reportFormService.liveView.outOfDate = false; - //reportService.runReport($scope.report); - - if (reportFormService.liveView.currentReport.reportType === 'summary'){ - $scope.repNav.goToView('liveViewPanel','catchDetails'); - } else { - $scope.repNav.goToView('liveViewPanel','mapPanel'); - } - - } - loadingStatus.isLoading('SaveReport',false); - }; - - var updateReportError = function(error){ - angular.copy($scope.currentRepCopy,reportFormService.liveView.currentReport); - delete $scope.currentRepCopy; - reportError(error,'spatial.error_update_report'); - loadingStatus.isLoading('SaveReport',false); - }; - - var reportError = function(error, defaultMsg) { - $scope.formAlert.visible = true; - var errorMsg; - - if (angular.isDefined(error.data.msg)) { - var msg = error.data.msg; - if (msg.indexOf('spatial') === -1){ - msg = 'spatial.' + msg; - } - errorMsg = locale.getString(msg); - } - - if (!angular.isDefined(errorMsg) || errorMsg.indexOf('KEY_NOT_FOUND') !== -1 || errorMsg === ''){ - errorMsg = locale.getString(defaultMsg); - } - - $scope.formAlert.msg = errorMsg; - }; - - $scope.resetReport = function(){ - loadingStatus.isLoading('ResetReport',true); - $scope.reportForm.$setPristine(); - reportRestService.getReport($scope.report.id).then(function(response){ - $scope.init(); - angular.copy($scope.report.fromJson(response), $scope.report); - $scope.report.currentMapConfig = {mapConfiguration: {}}; - if (angular.isDefined($scope.report.areas) && $scope.report.areas.length > 0){ - getAreaProperties(buildAreaPropArray()); - } - angular.copy($scope.report.mapConfiguration,$scope.report.currentMapConfig.mapConfiguration); - loadingStatus.isLoading('ResetReport',false); - }, function(error){ - $anchorScroll(); - $scope.formAlert.msg = locale.getString('spatial.error_entry_not_found'); - $scope.formAlert.visible = true; - loadingStatus.isLoading('ResetReport',false); - }); - }; - - $scope.cancel = function(){ - if ($scope.formMode === 'EDIT-FROM-LIVEVIEW'){ - angular.copy(reportFormService.liveView.currentTempReport, reportFormService.liveView.currentReport); - if (!angular.equals(reportFormService.liveView.currentReport, reportFormService.liveView.originalReport)){ - reportFormService.liveView.outOfDate = true; - } - reportFormService.liveView.currentTempReport = undefined; - } else { - reportFormService.report = undefined; - } - $scope.repNav.goToPreviousView(); - }; - - var loadReportForm = function(){ - switch($scope.formMode){ - case 'CREATE': - reportFormService.report = new Report(); - $scope.report = reportFormService.report; - break; - case 'EDIT': - $scope.report = reportFormService.report; - break; - case 'EDIT-FROM-LIVEVIEW': - $scope.report = reportFormService.liveView.currentReport; - reportFormService.liveView.currentTempReport = angular.copy($scope.report); - break; - } - - $scope.init(); - - if (angular.isDefined($scope.report.areas) && $scope.report.areas.length > 0){ - getAreaProperties(buildAreaPropArray()); - } - setTimeout(function() { - $scope.reportForm.$setPristine(); - }, 100); - }; - - /** - * Export all selected areas when modal is closed while saving - * - * @memberof ReportformCtrl - * @public - * @alias exportSelectedAreas - * @returns {Array} An array containing all selected areas properly formatted to submit to server side - */ - $scope.exportSelectedAreas = function(){ - var exported = []; - for (var i = 0; i < $scope.selectedAreas.length; i++){ - var area = { - gid: parseInt($scope.selectedAreas[i].gid), - areaType: $scope.selectedAreas[i].areaType - }; - exported.push(area); - } - - return exported; - }; - - /** - * Build proper array from the modal resolved selected areas. This is to be used to request area properties to server - * - * @memberof AreasselectionfieldsetCtrl - * @private - */ - var buildAreaPropArray = function(){ - var areas = []; - for (var i = 0; i < $scope.report.areas.length; i++){ - areas.push({ - gid : $scope.report.areas[i].gid, - areaType: $scope.report.areas[i].areaType - }); - } - return areas; - }; - - /** - * Get area properties from the Spatial REST API - * - * @memberof AreasselectionfieldsetCtrl - * @private - */ - var getAreaProperties = function(data){ - spatialRestService.getAreaProperties(data).then(function(response){ - $scope.selectedAreas = buildSelectedAreasArray(response.data); - }, function(error){ - $anchorScroll(); - $scope.formAlert.msg = locale.getString('spatial.area_selection_modal_get_selected_sys_area_details_error'); - $scope.formAlert.visible = true; - }); - }; - - /** - * Build properly formated array out of the area properties server response data and merge it with the existent modal resolved selected areas. - * - * @memberof AreasselectionfieldsetCtrl - * @private - */ - var buildSelectedAreasArray = function(data){ - var finalAreas = []; - for (var i = 0; i < data.length; i++){ - var area = data[i]; - area.gid = parseInt(area.gid); - for (var j = 0; j < $scope.report.areas.length; j++){ - if (parseInt($scope.report.areas[j].gid) === parseInt(data[i].gid) && $scope.report.areas[j].areaType === data[i].areaType){ - area.id = parseInt($scope.report.areas[j].id); - } - } - finalAreas.push(area); - } - - return finalAreas; - }; - - $scope.$watch(function(){return $scope.repNav.isViewVisible('reportForm');}, function(newVal,oldVal){ - if(newVal===true){ - loadReportForm(); - } - }); - -}); - +/* +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . +*/ +angular.module('unionvmsWeb').controller('ReportformCtrl',function($scope, $modal, $anchorScroll, reportMsgService, locale, Report, reportRestService, spatialRestService, configurationService, movementRestService, reportService, SpatialConfig, spatialConfigRestService, userService, loadingStatus, reportFormService, mapService){ + //Report form mode + $scope.showVesselFilter = false; + + //set visibility types in dropdown option + $scope.visibilities = []; + + //Set the available report types to create + $scope.reportTypes = [ + {"text": locale.getString('spatial.reports_form_type_standard'), "code": "standard"}, + {"text": locale.getString('spatial.reports_form_type_summary'), "code": "summary"} + ]; + + //Set positions selector dropdown options + $scope.positionItems = [ + {"text": locale.getString('spatial.reports_form_positions_selector_option_all'), "code": "all"}, + {"text": locale.getString('spatial.reports_form_positions_selector_option_last'), "code": "last"} + ]; + + //Set positions selector dropdown options + $scope.positionTypeItems = [ + {"text": locale.getString('spatial.reports_form_positions_selector_type_option_positions'), "code": "positions"}, + {"text": locale.getString('spatial.reports_form_positions_selector_type_option_hours'), "code": "hours"} + ]; + + //Set vessel search type dropdown options + $scope.vesselSearchItems = [ + {"text": locale.getString('spatial.reports_form_vessels_search_by_vessel'), "code": "asset"}, + {"text": locale.getString('spatial.reports_form_vessels_search_by_group'), "code": "vgroup"} + ]; + + //Set movement type dropdown options + $scope.movementTypes = configurationService.setTextAndCodeForDropDown(configurationService.getValue('MOVEMENT', 'MESSAGE_TYPE'),'MESSAGE_TYPE','MOVEMENT'); + + //Set movemment activity type dropdown options + $scope.activityTypes = configurationService.setTextAndCodeForDropDown(configurationService.getValue('MOVEMENT', 'ACTIVITY_TYPE'), 'ACTIVITY_TYPE', 'MOVEMENT'); + + //Set category types dropdown options + $scope.categoryTypes = configurationService.setTextAndCodeForDropDown(configurationService.getValue('MOVEMENT', 'CATEGORY_TYPE'), 'CATEGORY_TYPE', 'MOVEMENT'); + + //Set movement source types dropdown options + $scope.movementSourceTypes = configurationService.setTextAndCodeForDropDown(configurationService.getConfig('MOVEMENT_SOURCE_TYPES'),'MOVEMENT_SOURCE_TYPES','MOVEMENT'); + + $scope.submitingReport = false; + + $scope.repFormServ = reportFormService; + + + $scope.aggregationTypes = [ + { + code: "FLAG_STATE", + text: locale.getString('spatial.criteria_flag_state') + }, + { + code: "VESSEL", + text: locale.getString('spatial.criteria_vessel') + }, + { + code: "DATE", + text: locale.getString('spatial.criteria_date'), + items: [ + { + code: "DATE_DAY", + text: locale.getString('spatial.criteria_date_day') + }, + { + code: "DATE_MONTH", + text: locale.getString('spatial.criteria_date_month') + }, + { + code: "DATE_YEAR", + text: locale.getString('spatial.criteria_date_year') + } + ], + selection: "single" + }, + { + code: "AREA", + text: locale.getString('spatial.criteria_area'), + items: [ + { + code: "TERRITORY", + text: locale.getString('spatial.criteria_territory') + }, + { + code: "FAO_AREA", + text: locale.getString('spatial.criteria_fao_area') + }, + { + code: "ICES_STAT_RECTANGLE", + text: locale.getString('spatial.criteria_ices_stat_rectangle') + }, + { + code: "EFFORT_ZONE", + text: locale.getString('spatial.criteria_effort_zone') + }, + { + code: "RFMO", + text: locale.getString('spatial.criteria_rfmo') + }, + { + code: "GFCM_GSA", + text: locale.getString('spatial.criteria_gfcm_gsa') + }, + { + code: "GFCM_STAT_RECTANGLE", + text: locale.getString('spatial.criteria_gfcm_stat_rectangle') + } + ], + selection: "multiple" + }, + { + code: "GEAR_TYPE", + text: locale.getString('spatial.criteria_gear_type') + }, + { + code: "SPECIES", + text: locale.getString('spatial.criteria_species') + }, + { + code: "PRESENTATION", + text: locale.getString('spatial.criteria_presentation') + } + ]; + + $scope.showSaveBtn = function(){ + var result = false; + if ($scope.formMode === 'CREATE'){ + result = true; + } else { + if ((angular.isDefined($scope.report) && $scope.report.createdBy === userService.getUserName()) || $scope.isAllowed('Reporting', 'MANAGE_ALL_REPORTS')){ + result = true; + } + } + return result; + }; + + $scope.init = function(){ + $scope.formAlert = { + visible: false, + msg: '' + }; + $scope.submitingReport = false; + + if ($scope.formMode === 'CREATE'){ + $scope.report.vesselsSelection = []; + } + $scope.showVesselFilter = false; + $scope.selectedAreas = []; + + $scope.shared = { + vesselSearchBy: 'asset', + searchVesselString: '', + selectAll: false, + selectedVessels: 0, + vessels: [], + areas: [] + }; + + if ($scope.report.movSources.length === 0){ + $scope.report.movSources = []; + angular.forEach($scope.movementSourceTypes, function(item){ + $scope.report.movSources.push(item.code); + }); + } + + $scope.checkVisibilities(); + }; + + $scope.checkVisibilities = function(){ + $scope.visibilities = [{"text": locale.getString('spatial.reports_table_share_label_private'), "code": "private"}]; + var availableVisibilities = ['SCOPE', 'PUBLIC']; + angular.forEach(availableVisibilities, function(visibility) { + if (userService.isAllowed('SHARE_REPORT_' + visibility, 'Reporting', true) || userService.isAllowed('MANAGE_ALL_REPORTS', 'Reporting', true)){ + var name = visibility.toLowerCase(); + $scope.visibilities.push({"text": locale.getString('spatial.reports_table_share_label_' + name), "code": name}); + } + }); + }; + + $scope.resetForm = function(){ + reportFormService.report = new Report(); + $scope.report = reportFormService.report; + $scope.init(); + $scope.reportForm.$setPristine(); + $scope.clearVmsErrors(); + }; + + $scope.clearVmsErrors = function(){ + for (var attr in $scope.reportForm.$error){ + $scope.reportForm.$setValidity(attr, true); + } + }; + + $scope.validateRanges = function(){ + var min, max, minD, maxD; + var status = true; + + //Validate positions speed range + if (angular.isDefined($scope.report.vmsFilters.positions) && !_.isEmpty($scope.report.vmsFilters.positions)){ + min = $scope.report.vmsFilters.positions.movMinSpeed; + max = $scope.report.vmsFilters.positions.movMaxSpeed; + + validateRangeFieldGroup(min,max,'movMinSpeed','movMaxSpeed','positionSecForm'); + } + + //Validate segments speed and duration ranges + if (angular.isDefined($scope.report.vmsFilters.segments) && !_.isEmpty($scope.report.vmsFilters.segments)){ + min = $scope.report.vmsFilters.segments.segMinSpeed; + max = $scope.report.vmsFilters.segments.segMaxSpeed; + + validateRangeFieldGroup(min,max,'segMinSpeed','segMaxSpeed','segmentSecForm'); + + minD = $scope.report.vmsFilters.segments.segMinDuration; + maxD = $scope.report.vmsFilters.segments.segMaxDuration; + + validateRangeFieldGroup(minD,maxD,'segMinDuration','segMaxDuration','segmentSecForm'); + } + + //Validate tracks time at sea and duration ranges + if (angular.isDefined($scope.report.vmsFilters.tracks) && !_.isEmpty($scope.report.vmsFilters.tracks)){ + min = $scope.report.vmsFilters.tracks.trkMinTime; + max = $scope.report.vmsFilters.tracks.trkMaxTime; + + validateRangeFieldGroup(min,max,'trkMinTime','trkMaxTime','trackSecForm'); + + minD = $scope.report.vmsFilters.tracks.trkMinDuration; + maxD = $scope.report.vmsFilters.tracks.trkMaxDuration; + + validateRangeFieldGroup(minD,maxD,'trkMinDuration','trkMaxDuration','trackSecForm'); + } + }; + + var validateRangeFieldGroup = function(min,max,fieldMin,fieldMax,subForm){ + if(angular.isDefined(min) && min<0){ + $scope.reportForm.reportBodyForm[subForm][fieldMin].$setValidity('minError', false); + }else{ + $scope.reportForm.reportBodyForm[subForm][fieldMin].$setValidity('minError', true); + } + if(angular.isDefined(max) && max<0){ + $scope.reportForm.reportBodyForm[subForm][fieldMax].$setValidity('minError', false); + }else{ + $scope.reportForm.reportBodyForm[subForm][fieldMax].$setValidity('minError', true); + } + if(angular.isDefined(min) && angular.isDefined(max) && min !== null && max !== null && min > max){ + $scope.reportForm.reportBodyForm[subForm][fieldMax].$setValidity('maxError', false); + }else{ + $scope.reportForm.reportBodyForm[subForm][fieldMax].$setValidity('maxError', true); + } + }; + + $scope.saveReport = function(){ + loadingStatus.isLoading('SaveReport',true); + $scope.submitingReport = true; + $scope.validateRanges(); + if ($scope.reportForm.$valid){ + $scope.report.areas = $scope.exportSelectedAreas(); + if (angular.isDefined(mapService.map) && $scope.formMode !== 'CREATE') { + $scope.report.mapZoom = mapService.map.getView().getZoom(); + $scope.report.mapCenter = JSON.stringify(mapService.map.getView().getCenter()); + } + if ($scope.formMode !== 'CREATE') { + $scope.report.mapLayerConfig = JSON.stringify(reportService.getLayerConfig()); + } + $scope.currentRepCopy = angular.copy($scope.report); + $scope.report.currentMapConfig.mapConfiguration.layerSettings = reportFormService.checkLayerSettings($scope.report.currentMapConfig.mapConfiguration.layerSettings); + $scope.report = reportFormService.checkMapConfigDifferences($scope.report); + switch ($scope.formMode) { + case 'CREATE': + reportRestService.createReport($scope.report).then(createReportSuccess, createReportError); + break; + case 'EDIT': + reportRestService.updateReport($scope.report).then(updateReportSuccess, updateReportError); + break; + case 'EDIT-FROM-LIVEVIEW': + if (!angular.equals($scope.currentRepCopy, reportFormService.liveView.originalReport)){ + reportRestService.updateReport($scope.report).then(updateReportSuccess, updateReportError); + } else { + loadingStatus.isLoading('SaveReport',false); + $scope.repNav.goToView('liveViewPanel','mapPanel'); + } + + break; + } + } else { + loadingStatus.isLoading('SaveReport',false); + var invalidElm = angular.element('#reportForm')[0].querySelector('.ng-invalid'); + var errorElm = angular.element('#reportForm')[0].querySelector('.has-error'); + if (invalidElm){ + invalidElm.scrollIntoView(); + } else if (invalidElm === null && errorElm){ + errorElm.scrollIntoView(); + } + } + }; + + $scope.validateDates = function(sDate, eDate){ + var sMomDate = moment(sDate, 'YYYY-MM-DD'); + var eMomDate = moment(eDate, 'YYYY-MM-DD'); + + if (sMomDate.isAfter(eMomDate)){ + return false; + } else { + return true; + } + }; + + $scope.openMapConfigurationModal = function(){ + var modalInstance = $modal.open({ + templateUrl: 'partial/spatial/reportsPanel/reportForm/mapConfigurationModal/mapConfigurationModal.html', + controller: 'MapconfigurationmodalCtrl', + size: 'lg', + resolve: { + reportConfigs: function(){ + return angular.copy($scope.report.currentMapConfig); + }, + displayComponents: function(){ + var components = { + visibility: { + position: true, + segment: true + } + }; + + if ($scope.report.withMap){ + components.map = true; + components.layers = true; + components.referenceData = true; + components.styles = { + position: true, + segment: true, + alarm: true + }; + } + + return components; + } + } + }); + + modalInstance.result.then(function(data){ + if(!angular.equals($scope.report.currentMapConfig.mapConfiguration,data.mapSettings)){ + $scope.reportForm.$setDirty(); + $scope.report.currentMapConfig.mapConfiguration = data.mapSettings; + } + }); + }; + + $scope.runReport = function() { + $scope.submitingReport = true; + $scope.validateRanges(); + if($scope.reportForm.reportBodyForm.$valid){ + $scope.report.areas = $scope.exportSelectedAreas(); + reportService.runReportWithoutSaving($scope.report); + + if (!angular.equals($scope.report, reportFormService.liveView.originalReport)){ + reportFormService.liveView.outOfDate = true; + } else { + reportFormService.liveView.outOfDate = false; + } + reportFormService.liveView.currentTempReport = undefined; + }else{ + var invalidElm = angular.element('#reportForm')[0].querySelector('.ng-invalid'); + var errorElm = angular.element('#reportForm')[0].querySelector('.has-error'); + if (invalidElm){ + invalidElm.scrollIntoView(); + } else if (invalidElm === null && errorElm){ + errorElm.scrollIntoView(); + } + } + }; + + $scope.saveAsReport = function() { + $scope.submitingReport = true; + $scope.validateRanges(); + if ($scope.reportForm.reportBodyForm.$valid){ + var modalInstance = $modal.open({ + templateUrl: 'partial/spatial/reportsPanel/reportForm/saveAsModal/saveAsModal.html', + controller: 'SaveasmodalCtrl', + size: 'md', + resolve: { + reportData: function(){ + return $scope.report; + } + } + }); + + modalInstance.result.then(function(data){ + if (angular.isDefined(mapService.map)) { + data.mapZoom = mapService.map.getView().getZoom(); + data.mapCenter = JSON.stringify(mapService.map.getView().getCenter()); + } + data.mapLayerConfig = JSON.stringify(reportService.getLayerConfig()); + data.areas = $scope.exportSelectedAreas(); + data.currentMapConfig.mapConfiguration.layerSettings = reportFormService.checkLayerSettings(data.currentMapConfig.mapConfiguration.layerSettings); + data = reportFormService.checkMapConfigDifferences(data); + reportRestService.createReport(data).then(createReportSuccess, createReportError); + }); + } else { + var invalidElm = angular.element('#reportForm')[0].querySelector('.ng-invalid'); + var errorElm = angular.element('#reportForm')[0].querySelector('.has-error'); + if (invalidElm){ + invalidElm.scrollIntoView(); + } else if (invalidElm === null && errorElm){ + errorElm.scrollIntoView(); + } + } + + }; + + $scope.$watch('report.positionSelector', function(newVal, oldVal){ + if ($scope.report && newVal === 'all'){ + //Reset X Value field + $scope.report.xValue = undefined; + } + }); + + $scope.$watch('report.positionTypeSelector', function(newVal, oldVal){ + if ($scope.report && newVal === 'hours'){ + $scope.report.startDateTime = undefined; + $scope.report.endDateTime = undefined; + } + }); + + var createReportSuccess = function(response){ + reportService.loadReportHistory(); + if($scope.repNav.hasPreviousState()){ + $scope.repNav.goToPreviousView(); + }else{ + $scope.repNav.goToView('liveViewPanel','mapPanel',$scope.openReportList); + } + reportFormService.report = undefined; + reportMsgService.show('spatial.success_create_report', 'success', true, 8000); + loadingStatus.isLoading('SaveReport',false); + }; + + var createReportError = function(error){ + reportError(error,'spatial.error_create_report'); + loadingStatus.isLoading('SaveReport',false); + }; + + var updateReportSuccess = function(response){ + reportService.loadReportHistory(); + + reportMsgService.show('spatial.success_update_report', 'success', true, 8000); + if ($scope.formMode === 'EDIT'){ + if($scope.repNav.hasPreviousState()){ + $scope.repNav.goToPreviousView(); + }else{ + $scope.repNav.goToView('liveViewPanel','mapPanel',$scope.openReportList); + } + reportFormService.report = undefined; + } else if ($scope.formMode === 'EDIT-FROM-LIVEVIEW'){ + angular.copy($scope.currentRepCopy,reportFormService.liveView.currentReport); + delete $scope.currentRepCopy; + angular.copy(reportFormService.liveView.currentReport, reportFormService.liveView.originalReport); + reportFormService.liveView.outOfDate = false; + //reportService.runReport($scope.report); + + if (reportFormService.liveView.currentReport.reportType === 'summary'){ + $scope.repNav.goToView('liveViewPanel','catchDetails'); + } else { + $scope.repNav.goToView('liveViewPanel','mapPanel'); + } + + } + loadingStatus.isLoading('SaveReport',false); + }; + + var updateReportError = function(error){ + angular.copy($scope.currentRepCopy,reportFormService.liveView.currentReport); + delete $scope.currentRepCopy; + reportError(error,'spatial.error_update_report'); + loadingStatus.isLoading('SaveReport',false); + }; + + var reportError = function(error, defaultMsg) { + $scope.formAlert.visible = true; + var errorMsg; + + if (angular.isDefined(error.data.msg)) { + var msg = error.data.msg; + if (msg.indexOf('spatial') === -1){ + msg = 'spatial.' + msg; + } + errorMsg = locale.getString(msg); + } + + if (!angular.isDefined(errorMsg) || errorMsg.indexOf('KEY_NOT_FOUND') !== -1 || errorMsg === ''){ + errorMsg = locale.getString(defaultMsg); + } + + $scope.formAlert.msg = errorMsg; + }; + + $scope.resetReport = function(){ + loadingStatus.isLoading('ResetReport',true); + $scope.reportForm.$setPristine(); + reportRestService.getReport($scope.report.id).then(function(response){ + $scope.init(); + angular.copy($scope.report.fromJson(response), $scope.report); + $scope.report.currentMapConfig = {mapConfiguration: {}}; + if (angular.isDefined($scope.report.areas) && $scope.report.areas.length > 0){ + getAreaProperties(buildAreaPropArray()); + } + angular.copy($scope.report.mapConfiguration,$scope.report.currentMapConfig.mapConfiguration); + loadingStatus.isLoading('ResetReport',false); + }, function(error){ + $anchorScroll(); + $scope.formAlert.msg = locale.getString('spatial.error_entry_not_found'); + $scope.formAlert.visible = true; + loadingStatus.isLoading('ResetReport',false); + }); + }; + + $scope.cancel = function(){ + if ($scope.formMode === 'EDIT-FROM-LIVEVIEW'){ + angular.copy(reportFormService.liveView.currentTempReport, reportFormService.liveView.currentReport); + if (!angular.equals(reportFormService.liveView.currentReport, reportFormService.liveView.originalReport)){ + reportFormService.liveView.outOfDate = true; + } + reportFormService.liveView.currentTempReport = undefined; + } else { + reportFormService.report = undefined; + } + $scope.repNav.goToPreviousView(); + }; + + var loadReportForm = function(){ + switch($scope.formMode){ + case 'CREATE': + reportFormService.report = new Report(); + $scope.report = reportFormService.report; + break; + case 'EDIT': + $scope.report = reportFormService.report; + break; + case 'EDIT-FROM-LIVEVIEW': + $scope.report = reportFormService.liveView.currentReport; + reportFormService.liveView.currentTempReport = angular.copy($scope.report); + break; + } + + $scope.init(); + + if (angular.isDefined($scope.report.areas) && $scope.report.areas.length > 0){ + getAreaProperties(buildAreaPropArray()); + } + setTimeout(function() { + $scope.reportForm.$setPristine(); + }, 100); + }; + + /** + * Export all selected areas when modal is closed while saving + * + * @memberof ReportformCtrl + * @public + * @alias exportSelectedAreas + * @returns {Array} An array containing all selected areas properly formatted to submit to server side + */ + $scope.exportSelectedAreas = function(){ + var exported = []; + for (var i = 0; i < $scope.selectedAreas.length; i++){ + var area = { + gid: parseInt($scope.selectedAreas[i].gid), + areaType: $scope.selectedAreas[i].areaType + }; + exported.push(area); + } + + return exported; + }; + + /** + * Build proper array from the modal resolved selected areas. This is to be used to request area properties to server + * + * @memberof AreasselectionfieldsetCtrl + * @private + */ + var buildAreaPropArray = function(){ + var areas = []; + for (var i = 0; i < $scope.report.areas.length; i++){ + areas.push({ + gid : $scope.report.areas[i].gid, + areaType: $scope.report.areas[i].areaType + }); + } + return areas; + }; + + /** + * Get area properties from the Spatial REST API + * + * @memberof AreasselectionfieldsetCtrl + * @private + */ + var getAreaProperties = function(data){ + spatialRestService.getAreaProperties(data).then(function(response){ + $scope.selectedAreas = buildSelectedAreasArray(response.data); + }, function(error){ + $anchorScroll(); + $scope.formAlert.msg = locale.getString('spatial.area_selection_modal_get_selected_sys_area_details_error'); + $scope.formAlert.visible = true; + }); + }; + + /** + * Build properly formated array out of the area properties server response data and merge it with the existent modal resolved selected areas. + * + * @memberof AreasselectionfieldsetCtrl + * @private + */ + var buildSelectedAreasArray = function(data){ + var finalAreas = []; + for (var i = 0; i < data.length; i++){ + var area = data[i]; + area.gid = parseInt(area.gid); + for (var j = 0; j < $scope.report.areas.length; j++){ + if (parseInt($scope.report.areas[j].gid) === parseInt(data[i].gid) && $scope.report.areas[j].areaType === data[i].areaType){ + area.id = parseInt($scope.report.areas[j].id); + } + } + finalAreas.push(area); + } + + return finalAreas; + }; + + $scope.$watch(function(){return $scope.repNav.isViewVisible('reportForm');}, function(newVal,oldVal){ + if(newVal===true){ + loadReportForm(); + } + }); + +}); + diff --git a/unionvms-web/app/partial/spatial/reportsPanel/reportModel.js b/unionvms-web/app/partial/spatial/reportsPanel/reportModel.js index 244ad5881..83c048495 100644 --- a/unionvms-web/app/partial/spatial/reportsPanel/reportModel.js +++ b/unionvms-web/app/partial/spatial/reportsPanel/reportModel.js @@ -1,532 +1,544 @@ -/* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . -*/ -angular.module('unionvmsWeb').factory('Report',function(unitConversionService, userService, locale) { //globalSettingsService, - function Report(){ - this.id = undefined; - this.name = undefined; - this.desc = undefined; - this.createdBy = undefined; - this.visibility = 'private'; - this.startDateTime = undefined; - this.endDateTime = undefined; - this.reportType = 'standard'; - this.positionSelector = 'all'; - this.positionTypeSelector = 'positions'; - this.xValue = undefined; - - //Components - this.withMap = true; - - //Vessel filter - this.vesselsSelection = []; - - //VNS filter - this.hasVmsFilter = false; - this.movSources = []; - this.vmsFilters = { - positions: {}, - segments: {}, - tracks: {} - }; - - this.hasFaFilter = false; - this.faFilters = {}; - - this.areas = []; - - //Spatial configs - this.mapConfiguration = { - stylesSettings: undefined, - layerSettings: undefined, - visibilitySettings: undefined - }; - this.currentMapConfig = { - mapConfiguration: {} - }; - } - -// var getDateFormat = function(){ -// return globalSettingsService.getDateFormat(); -// }; -// -// var getTimeZone = function(){ -// return parseInt(globalSettingsService.getTimezone()); -// }; -// -// var convertDate = function(date, direction){ -// var displayFormat = getDateFormat(); -// var src_format = 'YYYY-MM-DD HH:mm:ss Z'; -// var server_format = 'YYYY-MM-DDTHH:mm:ss'; -// -// if (direction === 'to_server'){ -// if (moment.utc(date, src_format).isValid()){ -// return moment.utc(date, src_format).format(server_format); -// } -// } else if(direction === 'from_server') { -// if (moment.utc(date, server_format).isValid()){ -// return moment.utc(date, server_format).format(displayFormat); -// } -// } -// }; - - var validateFilterObject = function(filter,isRunningReport){ - var valid = true; - var existingFilter = false; - var isDefined = false; - for (var i in filter){ - if (i === 'id'){ - existingFilter = true; - } else if (i !== 'id' && i !== 'type'){ - if (angular.isDefined(filter[i])){ - isDefined = true; - } - } - } - - if ((existingFilter || isRunningReport) && isDefined === false){ - valid = false; - } - - return valid; - }; - - Report.prototype.fromJson = function(data){ - var report = new Report(); - - if(data){ - var filter = data.filterExpression; - - report.id = data.id; - report.name = data.name; - report.desc = data.desc; - report.createdBy = data.createdBy; - report.withMap = data.withMap; - report.visibility = data.visibility; - - if (report.visibility !== 'private' && !userService.isAllowed('SHARE_REPORT_' + report.visibility.toUpperCase(), 'Reporting', true) && !userService.isAllowed('MANAGE_ALL_REPORTS', 'Reporting', true)){ - report.visibility = 'private'; - } - - //Common filters - report.commonFilterId = filter.common.id; - report.startDateTime = angular.isDefined(filter.common.startDate) ? unitConversionService.date.convertDate(filter.common.startDate, 'from_server') : undefined; - report.endDateTime = angular.isDefined(filter.common.endDate) ? unitConversionService.date.convertDate(filter.common.endDate, 'from_server') : undefined; - report.positionSelector = angular.isDefined(filter.common.positionSelector) ? filter.common.positionSelector : 'all'; - report.positionTypeSelector = angular.isDefined(filter.common.positionTypeSelector) ? filter.common.positionTypeSelector : 'positions'; - report.xValue = angular.isDefined(filter.common.xValue) ? filter.common.xValue : undefined; - - //Vessel filters - report.vesselsSelection = filter.assets; - - if(angular.isDefined(data.reportType)){ - report.reportType = data.reportType; - } - - //VMS positions filters - if (angular.isDefined(filter.vms) && angular.isDefined(filter.vms.vmsposition)){ - if (_.has(filter.vms.vmsposition, 'movsources')){ - report.movSources = filter.vms.vmsposition.movsources; - } - delete filter.vms.vmsposition.movsources; - report.vmsFilters.positions = filter.vms.vmsposition; - } - - - if (angular.isDefined(filter.vms) && angular.isDefined(filter.vms.vmssegment)){ - report.vmsFilters.segments = filter.vms.vmssegment; - } - - if (angular.isDefined(filter.vms) && angular.isDefined(filter.vms.tracks)){ - report.vmsFilters.tracks = filter.vms.tracks; - } - - if (!angular.equals({}, filter.vms)){ - report.hasVmsFilter = true; - for (var i in filter.vms){ - var filterName = 'has' + i.substring(0,1).toUpperCase()+i.substring(1) + 'Filter'; - report[filterName] = true; - } - } - - //Fishing activity filters - if(!angular.isDefined(filter.fa)){ - filter.fa = {}; - } - - report.faFilters = {}; - angular.forEach(filter.fa, function(value,key){ - if(key === 'weight'){ - report.faFilters[key] = value; - }else{ - report.faFilters[key] = value[0]; - } - }); - - if (!angular.equals({}, filter.fa)){ - report.hasFaFilter = true; - } - - if(!angular.isDefined(report.faFilters.weight)){ - report.faFilters.weight = {unit: 'kg'}; - }else if(!angular.isDefined(report.faFilters.weight.unit)){ - report.faFilters.weight.unit = 'kg'; - } - - if(!angular.isDefined(filter.sort)){ - filter.sort = {}; - } - - report.sortFilters = filter.sort; - - report.areas = filter.areas; - - if(angular.isDefined(filter.criteria) && filter.criteria.length){ - angular.forEach(filter.criteria, function(item){ - item.text = locale.getString('spatial.criteria_' + item.code.toLowerCase()); - }); - } - report.sortFilters = filter.criteria; - - if (angular.isDefined(data.mapConfiguration)){ - if(angular.isDefined(data.mapConfiguration.layerSettings) && angular.isDefined(data.mapConfiguration.layerSettings.areaLayers) && !_.isEmpty(data.mapConfiguration.layerSettings.areaLayers)){ - angular.forEach(data.mapConfiguration.layerSettings.areaLayers, function(item) { - if(item.areaType === 'areagroup'){ - item.name = item.areaGroupName; - } - }); - } - report.mapConfiguration = data.mapConfiguration; - report.currentMapConfig.mapConfiguration = angular.copy(data.mapConfiguration); - } - - } - - return report; - }; - - Report.prototype.toJson = function(){ - return angular.toJson(this.DTO()); - }; - - Report.prototype.DTO = function(){ - var vmsFilters = {}; - var hasData = false; - - if(this.hasVmsFilter){ - if ((angular.isDefined(this.vmsFilters.positions) && !_.isEmpty(this.vmsFilters.positions)) || (angular.isDefined(this.movSources) && !_.isEmpty(this.movSources))){ - vmsFilters.vmsposition = this.vmsFilters.positions; - if (this.movSources.length > 0){ - vmsFilters.vmsposition.movsources = this.movSources; - } - - if(angular.isDefined(this.vmsFilters.positions) && !_.isEmpty(this.vmsFilters.positions)){ - vmsFilters.vmsposition.movMinSpeed = vmsFilters.vmsposition.movMinSpeed === null ? undefined : vmsFilters.vmsposition.movMinSpeed; - vmsFilters.vmsposition.movMaxSpeed = vmsFilters.vmsposition.movMaxSpeed === null ? undefined : vmsFilters.vmsposition.movMaxSpeed; - vmsFilters.vmsposition.type = 'vmspos'; - } - - if (validateFilterObject(vmsFilters.vmsposition) === false){ - vmsFilters.vmsposition = undefined; - } - } - - if (angular.isDefined(this.vmsFilters.segments) && !_.isEmpty(this.vmsFilters.segments)){ - vmsFilters.vmssegment = this.vmsFilters.segments; - vmsFilters.vmssegment.segMinSpeed = vmsFilters.vmssegment.segMinSpeed === null ? undefined : vmsFilters.vmssegment.segMinSpeed; - vmsFilters.vmssegment.segMaxSpeed = vmsFilters.vmssegment.segMaxSpeed === null ? undefined : vmsFilters.vmssegment.segMaxSpeed; - vmsFilters.vmssegment.segMinDuration = vmsFilters.vmssegment.segMinDuration === null ? undefined : vmsFilters.vmssegment.segMinDuration; - vmsFilters.vmssegment.segMaxDuration = vmsFilters.vmssegment.segMaxDuration === null ? undefined : vmsFilters.vmssegment.segMaxDuration; - vmsFilters.vmssegment.type = 'vmsseg'; - - if (validateFilterObject(vmsFilters.vmssegment) === false){ - vmsFilters.vmssegment = undefined; - } - } - - if (angular.isDefined(this.vmsFilters.tracks) && !_.isEmpty(this.vmsFilters.tracks)){ - vmsFilters.vmstrack = this.vmsFilters.tracks; - vmsFilters.vmstrack.trkMinTime = vmsFilters.vmstrack.trkMinTime === null ? undefined : vmsFilters.vmstrack.trkMinTime; - vmsFilters.vmstrack.trkMaxTime = vmsFilters.vmstrack.trkMaxTime === null ? undefined : vmsFilters.vmstrack.trkMaxTime; - vmsFilters.vmstrack.trkMinDuration = vmsFilters.vmstrack.trkMinDuration === null ? undefined : vmsFilters.vmstrack.trkMinDuration; - vmsFilters.vmstrack.trkMaxDuration = vmsFilters.vmstrack.trkMaxDuration === null ? undefined : vmsFilters.vmstrack.trkMaxDuration; - vmsFilters.vmstrack.type = 'vmstrack'; - - if (validateFilterObject(vmsFilters.vmstrack) === false){ - vmsFilters.vmstrack = undefined; - } - } - } - - //Fishing activity filter - var faFilters; - if(this.hasFaFilter){ - if(_.keys(this.faFilters).length){ - faFilters = {}; - angular.forEach(this.faFilters, function(value,key){ - if(key === 'weight' || key === 'id'){ - faFilters[key] = value; - }else{ - faFilters[key] = [value]; - } - }); - - if(angular.isDefined(faFilters.weight) && (!angular.isDefined(faFilters.weight.min) || _.isNull(faFilters.weight.min)) && - (!angular.isDefined(faFilters.weight.max) || _.isNull(faFilters.weight.max))){ - delete faFilters.weight; - } - }else{ - faFilters = undefined; - } - } - - var criteria; - if(angular.isDefined(this.sortFilters) && this.sortFilters.length){ - criteria = []; - angular.forEach(this.sortFilters, function(item){ - var values; - - if(!angular.isDefined(item.values)){ - values = [item.code]; - }else if(!_.isArray(item.values)){ - values = [item.values]; - }else{ - values = item.values; - } - - criteria.push({'code': item.code, 'values': values}); - }); - } - - var filter = { - common: { - id: this.commonFilterId, - startDate: this.startDateTime === undefined ? undefined : unitConversionService.date.convertDate(this.startDateTime, 'to_server'), - endDate: this.endDateTime === undefined ? undefined : unitConversionService.date.convertDate(this.endDateTime, 'to_server'), - positionSelector: this.positionSelector, - positionTypeSelector: this.positionSelector !== 'all' ? this.positionTypeSelector: undefined, - xValue: this.xValue - }, - assets: [], - vms: vmsFilters, - fa: faFilters, - areas: this.areas, - criteria: criteria - }; - - if (angular.isDefined(this.vesselsSelection) && this.vesselsSelection.length){ - filter.assets = this.vesselsSelection; - } - - var dto = { - id: this.id, - name: this.name, - desc: this.desc !== '' ? this.desc : undefined, - reportType: this.reportType, - visibility: angular.isDefined(this.visibility) ? this.visibility : 'private', - withMap: this.reportType === 'standard' ? this.withMap : false, - filterExpression: filter - }; - - if(this.reportType === 'standard'){ - if(this.withMap === true){ - dto.mapConfiguration = this.mapConfiguration; - }else{ - if(angular.isDefined(this.mapConfiguration.spatialConnectId)){ - dto.mapConfiguration = {'spatialConnectId': this.mapConfiguration.spatialConnectId}; - } - if(angular.isDefined(this.mapConfiguration.visibilitySettings)){ - if(angular.isDefined(dto.mapConfiguration)){ - dto.mapConfiguration.visibilitySettings = this.mapConfiguration.visibilitySettings; - }else{ - dto.mapConfiguration = {'visibilitySettings': this.mapConfiguration.visibilitySettings}; - } - } - } - } - - if(angular.isDefined(this.additionalProperties)){ - dto.additionalProperties = this.additionalProperties; - } - - return dto; - }; - - Report.prototype.toJsonCopy = function(){ - return angular.toJson(this.DTOCopy()); - }; - - Report.prototype.DTOCopy = function(){ - var report = {}; - - report.name = this.name; - report.desc = this.desc !== '' ? this.desc : undefined; - report.reportType = this.reportType; - report.withMap = this.withMap; - report.visibility = angular.isDefined(this.visibility) ? this.visibility : 'private'; - - report.filterExpression = {}; - report.filterExpression.common = {}; - report.filterExpression.common.startDate = this.startDateTime === undefined ? undefined : unitConversionService.date.convertDate(this.startDateTime, 'to_server'); - report.filterExpression.common.endDate = this.endDateTime === undefined ? undefined : unitConversionService.date.convertDate(this.endDateTime, 'to_server'); - report.filterExpression.common.positionTypeSelector = this.positionTypeSelector; - report.filterExpression.common.positionSelector = this.positionSelector; - report.filterExpression.common.xValue = this.xValue; - - report.filterExpression.areas = []; - if(angular.isDefined(this.areas) && this.areas.length > 0){ - angular.forEach(this.areas, function(item) { - report.filterExpression.areas.push({ - 'gid': item.gid, - 'areaType': item.areaType - }); - }); - } - - if (angular.isDefined(this.vesselsSelection) && this.vesselsSelection.length){ - report.filterExpression.assets = []; - angular.forEach(this.vesselsSelection, function(item) { - report.filterExpression.assets.push({ - 'guid': item.guid, - 'name': item.name, - 'type': item.type - }); - }); - } - - if(this.hasVmsFilter){ - report.filterExpression.vms = {}; - if ((angular.isDefined(this.vmsFilters.positions) && !_.isEmpty(this.vmsFilters.positions)) || (angular.isDefined(this.movSources) && !_.isEmpty(this.movSources))){ - if(angular.isDefined(this.vmsFilters.positions) && !_.isEmpty(this.vmsFilters.positions)){ - report.filterExpression.vms.vmsposition = { - movActivity: this.vmsFilters.positions.movActivity === null ? undefined : this.vmsFilters.positions.movActivity, - movMaxSpeed: this.vmsFilters.positions.movMaxSpeed === null ? undefined : this.vmsFilters.positions.movMaxSpeed, - movMinSpeed: this.vmsFilters.positions.movMinSpeed === null ? undefined : this.vmsFilters.positions.movMinSpeed, - movsources: this.vmsFilters.positions.movsources === null ? undefined : this.vmsFilters.positions.movsources, - movType: this.vmsFilters.positions.movType === null ? undefined : this.vmsFilters.positions.movType, - type: "vmspos" - }; - } - - if (this.movSources.length > 0){ - if(!angular.isDefined(report.filterExpression.vms.vmsposition)){ - report.filterExpression.vms.vmsposition = {}; - } - report.filterExpression.vms.vmsposition.movsources = this.movSources; - } - if (validateFilterObject(report.filterExpression.vms.vmsposition,true) === false){ - report.filterExpression.vms.vmsposition = undefined; - } - } - - if(this.hasSegmentsFilter === true && angular.isDefined(this.vmsFilters.segments)){ - report.filterExpression.vms.vmssegment = { - segCategory: this.vmsFilters.segments.segCategory === null ? undefined : this.vmsFilters.segments.segCategory, - segMaxDuration: this.vmsFilters.segments.segMaxDuration === null ? undefined : this.vmsFilters.segments.segMaxDuration, - segMaxSpeed: this.vmsFilters.segments.segMaxSpeed === null ? undefined : this.vmsFilters.segments.segMaxSpeed, - segMinDuration: this.vmsFilters.segments.segMinDuration === null ? undefined : this.vmsFilters.segments.segMinDuration, - segMinSpeed: this.vmsFilters.segments.segMinSpeed === null ? undefined : this.vmsFilters.segments.segMinSpeed, - type: "vmsseg" - }; - if (validateFilterObject(report.filterExpression.vms.vmssegment,true) === false){ - report.filterExpression.vms.vmssegment = undefined; - } - } - - if (angular.isDefined(this.vmsFilters.tracks) && !_.isEmpty(this.vmsFilters.tracks)){ - report.filterExpression.vms.vmstrack = { - trkMaxDuration: this.vmsFilters.tracks.trkMaxDuration === null ? undefined : this.vmsFilters.tracks.trkMaxDuration, - trkMaxTime: this.vmsFilters.tracks.trkMaxTime === null ? undefined : this.vmsFilters.tracks.trkMaxTime, - trkMinDuration: this.vmsFilters.tracks.trkMinDuration === null ? undefined : this.vmsFilters.tracks.trkMinDuration, - trkMinTime: this.vmsFilters.tracks.trkMinTime === null ? undefined : this.vmsFilters.tracks.trkMinTime, - type: "vmstrack" - }; - } - if (validateFilterObject(report.filterExpression.vms.vmstrack,true) === false){ - report.filterExpression.vms.vmstrack = undefined; - } - } - - //Fishing activity filter - if(this.hasFaFilter){ - if(_.keys(this.faFilters).length){ - report.filterExpression.fa = {}; - angular.forEach(this.faFilters, function(value,key){ - if(key === 'weight' || key === 'id'){ - report.filterExpression.fa[key] = value; - }else{ - report.filterExpression.fa[key] = [value]; - } - }); - - if(angular.isDefined(report.filterExpression.fa.weight) && (!angular.isDefined(report.filterExpression.fa.weight.min) || _.isNull(report.filterExpression.fa.weight.min)) && - (!angular.isDefined(report.filterExpression.fa.weight.max) || _.isNull(report.filterExpression.fa.weight.max))){ - delete report.filterExpression.fa.weight; - } - }else{ - report.filterExpression.fa = undefined; - } - } - - var criteria; - if(angular.isDefined(this.sortFilters) && this.sortFilters.length){ - criteria = []; - angular.forEach(this.sortFilters, function(item){ - var values; - - if(!angular.isDefined(item.values)){ - values = [item.code]; - }else if(!_.isArray(item.values)){ - values = [item.values]; - }else{ - values = item.values; - } - - criteria.push({'code': item.code, 'values': values}); - }); - } - report.filterExpression.criteria = criteria; - - if(this.reportType === 'standard'){ - if(this.withMap === true){ - report.mapConfiguration = { - coordinatesFormat: this.mapConfiguration.coordinatesFormat, - displayProjectionId: this.mapConfiguration.displayProjectionId, - mapProjectionId: this.mapConfiguration.mapProjectionId, - scaleBarUnits: this.mapConfiguration.scaleBarUnits, - stylesSettings: this.mapConfiguration.stylesSettings, - visibilitySettings: this.mapConfiguration.visibilitySettings, - layerSettings: this.mapConfiguration.layerSettings - }; - }else{ - if(angular.isDefined(this.mapConfiguration.spatialConnectId)){ - report.mapConfiguration = {'spatialConnectId': this.mapConfiguration.spatialConnectId}; - } - if(angular.isDefined(this.mapConfiguration.visibilitySettings)){ - if(angular.isDefined(report.mapConfiguration)){ - report.mapConfiguration.visibilitySettings = this.mapConfiguration.visibilitySettings; - }else{ - report.mapConfiguration = {'visibilitySettings': this.mapConfiguration.visibilitySettings}; - } - } - } - } - - if(angular.isDefined(this.additionalProperties)){ - report.additionalProperties = this.additionalProperties; - } - - return report; - }; - - return Report; -}); - +/* +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . +*/ +angular.module('unionvmsWeb').factory('Report',function(unitConversionService, userService, locale) { //globalSettingsService, + function Report(){ + this.id = undefined; + this.name = undefined; + this.desc = undefined; + this.createdBy = undefined; + this.visibility = 'private'; + this.startDateTime = undefined; + this.endDateTime = undefined; + this.reportType = 'standard'; + this.positionSelector = 'all'; + this.positionTypeSelector = 'positions'; + this.xValue = undefined; + this.mapLayerConfig = undefined; + this.mapZoom = undefined; + this.mapCenter = undefined; + + //Components + this.withMap = true; + + //Vessel filter + this.vesselsSelection = []; + + //VNS filter + this.hasVmsFilter = false; + this.movSources = []; + this.vmsFilters = { + positions: {}, + segments: {}, + tracks: {} + }; + + this.hasFaFilter = false; + this.faFilters = {}; + + this.areas = []; + + //Spatial configs + this.mapConfiguration = { + stylesSettings: undefined, + layerSettings: undefined, + visibilitySettings: undefined + }; + this.currentMapConfig = { + mapConfiguration: {} + }; + } + +// var getDateFormat = function(){ +// return globalSettingsService.getDateFormat(); +// }; +// +// var getTimeZone = function(){ +// return parseInt(globalSettingsService.getTimezone()); +// }; +// +// var convertDate = function(date, direction){ +// var displayFormat = getDateFormat(); +// var src_format = 'YYYY-MM-DD HH:mm:ss Z'; +// var server_format = 'YYYY-MM-DDTHH:mm:ss'; +// +// if (direction === 'to_server'){ +// if (moment.utc(date, src_format).isValid()){ +// return moment.utc(date, src_format).format(server_format); +// } +// } else if(direction === 'from_server') { +// if (moment.utc(date, server_format).isValid()){ +// return moment.utc(date, server_format).format(displayFormat); +// } +// } +// }; + + var validateFilterObject = function(filter,isRunningReport){ + var valid = true; + var existingFilter = false; + var isDefined = false; + for (var i in filter){ + if (i === 'id'){ + existingFilter = true; + } else if (i !== 'id' && i !== 'type'){ + if (angular.isDefined(filter[i])){ + isDefined = true; + } + } + } + + if ((existingFilter || isRunningReport) && isDefined === false){ + valid = false; + } + + return valid; + }; + + Report.prototype.fromJson = function(data){ + var report = new Report(); + + if(data){ + var filter = data.filterExpression; + + report.id = data.id; + report.name = data.name; + report.desc = data.desc; + report.createdBy = data.createdBy; + report.withMap = data.withMap; + report.visibility = data.visibility; + report.mapLayerConfig = data.mapLayerConfig; + report.mapCenter = data.mapCenter; + report.mapZoom = data.mapZoom; + + if (report.visibility !== 'private' && !userService.isAllowed('SHARE_REPORT_' + report.visibility.toUpperCase(), 'Reporting', true) && !userService.isAllowed('MANAGE_ALL_REPORTS', 'Reporting', true)){ + report.visibility = 'private'; + } + + //Common filters + report.commonFilterId = filter.common.id; + report.startDateTime = angular.isDefined(filter.common.startDate) ? unitConversionService.date.convertDate(filter.common.startDate, 'from_server') : undefined; + report.endDateTime = angular.isDefined(filter.common.endDate) ? unitConversionService.date.convertDate(filter.common.endDate, 'from_server') : undefined; + report.positionSelector = angular.isDefined(filter.common.positionSelector) ? filter.common.positionSelector : 'all'; + report.positionTypeSelector = angular.isDefined(filter.common.positionTypeSelector) ? filter.common.positionTypeSelector : 'positions'; + report.xValue = angular.isDefined(filter.common.xValue) ? filter.common.xValue : undefined; + + //Vessel filters + report.vesselsSelection = filter.assets; + + if(angular.isDefined(data.reportType)){ + report.reportType = data.reportType; + } + + //VMS positions filters + if (angular.isDefined(filter.vms) && angular.isDefined(filter.vms.vmsposition)){ + if (_.has(filter.vms.vmsposition, 'movsources')){ + report.movSources = filter.vms.vmsposition.movsources; + } + delete filter.vms.vmsposition.movsources; + report.vmsFilters.positions = filter.vms.vmsposition; + } + + + if (angular.isDefined(filter.vms) && angular.isDefined(filter.vms.vmssegment)){ + report.vmsFilters.segments = filter.vms.vmssegment; + } + + if (angular.isDefined(filter.vms) && angular.isDefined(filter.vms.tracks)){ + report.vmsFilters.tracks = filter.vms.tracks; + } + + if (!angular.equals({}, filter.vms)){ + report.hasVmsFilter = true; + for (var i in filter.vms){ + var filterName = 'has' + i.substring(0,1).toUpperCase()+i.substring(1) + 'Filter'; + report[filterName] = true; + } + } + + //Fishing activity filters + if(!angular.isDefined(filter.fa)){ + filter.fa = {}; + } + + report.faFilters = {}; + angular.forEach(filter.fa, function(value,key){ + if(key === 'weight'){ + report.faFilters[key] = value; + }else{ + report.faFilters[key] = value[0]; + } + }); + + if (!angular.equals({}, filter.fa)){ + report.hasFaFilter = true; + } + + if(!angular.isDefined(report.faFilters.weight)){ + report.faFilters.weight = {unit: 'kg'}; + }else if(!angular.isDefined(report.faFilters.weight.unit)){ + report.faFilters.weight.unit = 'kg'; + } + + if(!angular.isDefined(filter.sort)){ + filter.sort = {}; + } + + report.sortFilters = filter.sort; + + report.areas = filter.areas; + + if(angular.isDefined(filter.criteria) && filter.criteria.length){ + angular.forEach(filter.criteria, function(item){ + item.text = locale.getString('spatial.criteria_' + item.code.toLowerCase()); + }); + } + report.sortFilters = filter.criteria; + + if (angular.isDefined(data.mapConfiguration)){ + if(angular.isDefined(data.mapConfiguration.layerSettings) && angular.isDefined(data.mapConfiguration.layerSettings.areaLayers) && !_.isEmpty(data.mapConfiguration.layerSettings.areaLayers)){ + angular.forEach(data.mapConfiguration.layerSettings.areaLayers, function(item) { + if(item.areaType === 'areagroup'){ + item.name = item.areaGroupName; + } + }); + } + report.mapConfiguration = data.mapConfiguration; + report.currentMapConfig.mapConfiguration = angular.copy(data.mapConfiguration); + } + + } + + return report; + }; + + Report.prototype.toJson = function(){ + return angular.toJson(this.DTO()); + }; + + Report.prototype.DTO = function(){ + var vmsFilters = {}; + var hasData = false; + + if(this.hasVmsFilter){ + if ((angular.isDefined(this.vmsFilters.positions) && !_.isEmpty(this.vmsFilters.positions)) || (angular.isDefined(this.movSources) && !_.isEmpty(this.movSources))){ + vmsFilters.vmsposition = this.vmsFilters.positions; + if (this.movSources.length > 0){ + vmsFilters.vmsposition.movsources = this.movSources; + } + + if(angular.isDefined(this.vmsFilters.positions) && !_.isEmpty(this.vmsFilters.positions)){ + vmsFilters.vmsposition.movMinSpeed = vmsFilters.vmsposition.movMinSpeed === null ? undefined : vmsFilters.vmsposition.movMinSpeed; + vmsFilters.vmsposition.movMaxSpeed = vmsFilters.vmsposition.movMaxSpeed === null ? undefined : vmsFilters.vmsposition.movMaxSpeed; + vmsFilters.vmsposition.type = 'vmspos'; + } + + if (validateFilterObject(vmsFilters.vmsposition) === false){ + vmsFilters.vmsposition = undefined; + } + } + + if (angular.isDefined(this.vmsFilters.segments) && !_.isEmpty(this.vmsFilters.segments)){ + vmsFilters.vmssegment = this.vmsFilters.segments; + vmsFilters.vmssegment.segMinSpeed = vmsFilters.vmssegment.segMinSpeed === null ? undefined : vmsFilters.vmssegment.segMinSpeed; + vmsFilters.vmssegment.segMaxSpeed = vmsFilters.vmssegment.segMaxSpeed === null ? undefined : vmsFilters.vmssegment.segMaxSpeed; + vmsFilters.vmssegment.segMinDuration = vmsFilters.vmssegment.segMinDuration === null ? undefined : vmsFilters.vmssegment.segMinDuration; + vmsFilters.vmssegment.segMaxDuration = vmsFilters.vmssegment.segMaxDuration === null ? undefined : vmsFilters.vmssegment.segMaxDuration; + vmsFilters.vmssegment.type = 'vmsseg'; + + if (validateFilterObject(vmsFilters.vmssegment) === false){ + vmsFilters.vmssegment = undefined; + } + } + + if (angular.isDefined(this.vmsFilters.tracks) && !_.isEmpty(this.vmsFilters.tracks)){ + vmsFilters.vmstrack = this.vmsFilters.tracks; + vmsFilters.vmstrack.trkMinTime = vmsFilters.vmstrack.trkMinTime === null ? undefined : vmsFilters.vmstrack.trkMinTime; + vmsFilters.vmstrack.trkMaxTime = vmsFilters.vmstrack.trkMaxTime === null ? undefined : vmsFilters.vmstrack.trkMaxTime; + vmsFilters.vmstrack.trkMinDuration = vmsFilters.vmstrack.trkMinDuration === null ? undefined : vmsFilters.vmstrack.trkMinDuration; + vmsFilters.vmstrack.trkMaxDuration = vmsFilters.vmstrack.trkMaxDuration === null ? undefined : vmsFilters.vmstrack.trkMaxDuration; + vmsFilters.vmstrack.type = 'vmstrack'; + + if (validateFilterObject(vmsFilters.vmstrack) === false){ + vmsFilters.vmstrack = undefined; + } + } + } + + //Fishing activity filter + var faFilters; + if(this.hasFaFilter){ + if(_.keys(this.faFilters).length){ + faFilters = {}; + angular.forEach(this.faFilters, function(value,key){ + if(key === 'weight' || key === 'id'){ + faFilters[key] = value; + }else{ + faFilters[key] = [value]; + } + }); + + if(angular.isDefined(faFilters.weight) && (!angular.isDefined(faFilters.weight.min) || _.isNull(faFilters.weight.min)) && + (!angular.isDefined(faFilters.weight.max) || _.isNull(faFilters.weight.max))){ + delete faFilters.weight; + } + }else{ + faFilters = undefined; + } + } + + var criteria; + if(angular.isDefined(this.sortFilters) && this.sortFilters.length){ + criteria = []; + angular.forEach(this.sortFilters, function(item){ + var values; + + if(!angular.isDefined(item.values)){ + values = [item.code]; + }else if(!_.isArray(item.values)){ + values = [item.values]; + }else{ + values = item.values; + } + + criteria.push({'code': item.code, 'values': values}); + }); + } + + var filter = { + common: { + id: this.commonFilterId, + startDate: this.startDateTime === undefined ? undefined : unitConversionService.date.convertDate(this.startDateTime, 'to_server'), + endDate: this.endDateTime === undefined ? undefined : unitConversionService.date.convertDate(this.endDateTime, 'to_server'), + positionSelector: this.positionSelector, + positionTypeSelector: this.positionSelector !== 'all' ? this.positionTypeSelector: undefined, + xValue: this.xValue + }, + assets: [], + vms: vmsFilters, + fa: faFilters, + areas: this.areas, + criteria: criteria + }; + + if (angular.isDefined(this.vesselsSelection) && this.vesselsSelection.length){ + filter.assets = this.vesselsSelection; + } + + var dto = { + id: this.id, + name: this.name, + desc: this.desc !== '' ? this.desc : undefined, + reportType: this.reportType, + visibility: angular.isDefined(this.visibility) ? this.visibility : 'private', + withMap: this.reportType === 'standard' ? this.withMap : false, + filterExpression: filter, + mapZoom: this.mapZoom, + mapCenter: this.mapCenter, + mapLayerConfig: this.mapLayerConfig + }; + + if(this.reportType === 'standard'){ + if(this.withMap === true){ + dto.mapConfiguration = this.mapConfiguration; + }else{ + if(angular.isDefined(this.mapConfiguration.spatialConnectId)){ + dto.mapConfiguration = {'spatialConnectId': this.mapConfiguration.spatialConnectId}; + } + if(angular.isDefined(this.mapConfiguration.visibilitySettings)){ + if(angular.isDefined(dto.mapConfiguration)){ + dto.mapConfiguration.visibilitySettings = this.mapConfiguration.visibilitySettings; + }else{ + dto.mapConfiguration = {'visibilitySettings': this.mapConfiguration.visibilitySettings}; + } + } + } + } + + if(angular.isDefined(this.additionalProperties)){ + dto.additionalProperties = this.additionalProperties; + } + + return dto; + }; + + Report.prototype.toJsonCopy = function(){ + return angular.toJson(this.DTOCopy()); + }; + + Report.prototype.DTOCopy = function(){ + var report = {}; + + report.name = this.name; + report.desc = this.desc !== '' ? this.desc : undefined; + report.reportType = this.reportType; + report.withMap = this.withMap; + report.visibility = angular.isDefined(this.visibility) ? this.visibility : 'private'; + report.mapLayerConfig = this.mapLayerConfig; + report.mapCenter = this.mapCenter; + report.mapZoom = this.mapZoom; + + report.filterExpression = {}; + report.filterExpression.common = {}; + report.filterExpression.common.startDate = this.startDateTime === undefined ? undefined : unitConversionService.date.convertDate(this.startDateTime, 'to_server'); + report.filterExpression.common.endDate = this.endDateTime === undefined ? undefined : unitConversionService.date.convertDate(this.endDateTime, 'to_server'); + report.filterExpression.common.positionTypeSelector = this.positionTypeSelector; + report.filterExpression.common.positionSelector = this.positionSelector; + report.filterExpression.common.xValue = this.xValue; + + report.filterExpression.areas = []; + if(angular.isDefined(this.areas) && this.areas.length > 0){ + angular.forEach(this.areas, function(item) { + report.filterExpression.areas.push({ + 'gid': item.gid, + 'areaType': item.areaType + }); + }); + } + + if (angular.isDefined(this.vesselsSelection) && this.vesselsSelection.length){ + report.filterExpression.assets = []; + angular.forEach(this.vesselsSelection, function(item) { + report.filterExpression.assets.push({ + 'guid': item.guid, + 'name': item.name, + 'type': item.type + }); + }); + } + + if(this.hasVmsFilter){ + report.filterExpression.vms = {}; + if ((angular.isDefined(this.vmsFilters.positions) && !_.isEmpty(this.vmsFilters.positions)) || (angular.isDefined(this.movSources) && !_.isEmpty(this.movSources))){ + if(angular.isDefined(this.vmsFilters.positions) && !_.isEmpty(this.vmsFilters.positions)){ + report.filterExpression.vms.vmsposition = { + movActivity: this.vmsFilters.positions.movActivity === null ? undefined : this.vmsFilters.positions.movActivity, + movMaxSpeed: this.vmsFilters.positions.movMaxSpeed === null ? undefined : this.vmsFilters.positions.movMaxSpeed, + movMinSpeed: this.vmsFilters.positions.movMinSpeed === null ? undefined : this.vmsFilters.positions.movMinSpeed, + movsources: this.vmsFilters.positions.movsources === null ? undefined : this.vmsFilters.positions.movsources, + movType: this.vmsFilters.positions.movType === null ? undefined : this.vmsFilters.positions.movType, + type: "vmspos" + }; + } + + if (this.movSources.length > 0){ + if(!angular.isDefined(report.filterExpression.vms.vmsposition)){ + report.filterExpression.vms.vmsposition = {}; + } + report.filterExpression.vms.vmsposition.movsources = this.movSources; + } + if (validateFilterObject(report.filterExpression.vms.vmsposition,true) === false){ + report.filterExpression.vms.vmsposition = undefined; + } + } + + if(this.hasSegmentsFilter === true && angular.isDefined(this.vmsFilters.segments)){ + report.filterExpression.vms.vmssegment = { + segCategory: this.vmsFilters.segments.segCategory === null ? undefined : this.vmsFilters.segments.segCategory, + segMaxDuration: this.vmsFilters.segments.segMaxDuration === null ? undefined : this.vmsFilters.segments.segMaxDuration, + segMaxSpeed: this.vmsFilters.segments.segMaxSpeed === null ? undefined : this.vmsFilters.segments.segMaxSpeed, + segMinDuration: this.vmsFilters.segments.segMinDuration === null ? undefined : this.vmsFilters.segments.segMinDuration, + segMinSpeed: this.vmsFilters.segments.segMinSpeed === null ? undefined : this.vmsFilters.segments.segMinSpeed, + type: "vmsseg" + }; + if (validateFilterObject(report.filterExpression.vms.vmssegment,true) === false){ + report.filterExpression.vms.vmssegment = undefined; + } + } + + if (angular.isDefined(this.vmsFilters.tracks) && !_.isEmpty(this.vmsFilters.tracks)){ + report.filterExpression.vms.vmstrack = { + trkMaxDuration: this.vmsFilters.tracks.trkMaxDuration === null ? undefined : this.vmsFilters.tracks.trkMaxDuration, + trkMaxTime: this.vmsFilters.tracks.trkMaxTime === null ? undefined : this.vmsFilters.tracks.trkMaxTime, + trkMinDuration: this.vmsFilters.tracks.trkMinDuration === null ? undefined : this.vmsFilters.tracks.trkMinDuration, + trkMinTime: this.vmsFilters.tracks.trkMinTime === null ? undefined : this.vmsFilters.tracks.trkMinTime, + type: "vmstrack" + }; + } + if (validateFilterObject(report.filterExpression.vms.vmstrack,true) === false){ + report.filterExpression.vms.vmstrack = undefined; + } + } + + //Fishing activity filter + if(this.hasFaFilter){ + if(_.keys(this.faFilters).length){ + report.filterExpression.fa = {}; + angular.forEach(this.faFilters, function(value,key){ + if(key === 'weight' || key === 'id'){ + report.filterExpression.fa[key] = value; + }else{ + report.filterExpression.fa[key] = [value]; + } + }); + + if(angular.isDefined(report.filterExpression.fa.weight) && (!angular.isDefined(report.filterExpression.fa.weight.min) || _.isNull(report.filterExpression.fa.weight.min)) && + (!angular.isDefined(report.filterExpression.fa.weight.max) || _.isNull(report.filterExpression.fa.weight.max))){ + delete report.filterExpression.fa.weight; + } + }else{ + report.filterExpression.fa = undefined; + } + } + + var criteria; + if(angular.isDefined(this.sortFilters) && this.sortFilters.length){ + criteria = []; + angular.forEach(this.sortFilters, function(item){ + var values; + + if(!angular.isDefined(item.values)){ + values = [item.code]; + }else if(!_.isArray(item.values)){ + values = [item.values]; + }else{ + values = item.values; + } + + criteria.push({'code': item.code, 'values': values}); + }); + } + report.filterExpression.criteria = criteria; + + if(this.reportType === 'standard'){ + if(this.withMap === true){ + report.mapConfiguration = { + coordinatesFormat: this.mapConfiguration.coordinatesFormat, + displayProjectionId: this.mapConfiguration.displayProjectionId, + mapProjectionId: this.mapConfiguration.mapProjectionId, + scaleBarUnits: this.mapConfiguration.scaleBarUnits, + stylesSettings: this.mapConfiguration.stylesSettings, + visibilitySettings: this.mapConfiguration.visibilitySettings, + layerSettings: this.mapConfiguration.layerSettings + }; + }else{ + if(angular.isDefined(this.mapConfiguration.spatialConnectId)){ + report.mapConfiguration = {'spatialConnectId': this.mapConfiguration.spatialConnectId}; + } + if(angular.isDefined(this.mapConfiguration.visibilitySettings)){ + if(angular.isDefined(report.mapConfiguration)){ + report.mapConfiguration.visibilitySettings = this.mapConfiguration.visibilitySettings; + }else{ + report.mapConfiguration = {'visibilitySettings': this.mapConfiguration.visibilitySettings}; + } + } + } + } + + if(angular.isDefined(this.additionalProperties)){ + report.additionalProperties = this.additionalProperties; + } + + return report; + }; + + return Report; +}); + diff --git a/unionvms-web/app/service/reporting/reportService.js b/unionvms-web/app/service/reporting/reportService.js index 84a63cc74..3600284d0 100644 --- a/unionvms-web/app/service/reporting/reportService.js +++ b/unionvms-web/app/service/reporting/reportService.js @@ -33,7 +33,11 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp errorLoadingDefault: false, lastMapConfigs: undefined, getConfigsTime: undefined, - getReportTime: undefined + getReportTime: undefined, + mapZoom: undefined, + mapCenter: undefined, + layerConfiguration: {}, + layersConfig: {} }; rep.clearVmsData = function(){ @@ -87,6 +91,15 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp $modalStack.dismissAll(); }; + rep.pushLayerConfig = function(node, value) { + rep.layersConfig[node] = value; + }; + + + rep.getLayerConfig = function() { + return rep.layersConfig; + }; + rep.runReport = function(report){ rep.clearMapOverlays(); loadingStatus.isLoading('LiveviewMap',true, 0); @@ -96,6 +109,9 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp if(angular.isDefined(report)){ rep.reportType = report.reportType; + rep.layerConfiguration = JSON.parse(report.mapLayerConfig ? report.mapLayerConfig : '{}'); + rep.mapZoom = report.mapZoom; + rep.mapCenter = report.mapCenter; } rep.hasAlert = false; $modalStack.dismissAll(); @@ -176,6 +192,11 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp rep.stopAutoRefreshInterval(); } rep.isReportExecuting = true; + if (angular.isDefined(report)) { + rep.layerConfiguration = JSON.parse(report.mapLayerConfig ? report.mapLayerConfig : '{}'); + rep.mapZoom = report.mapZoom; + rep.mapCenter = report.mapCenter; + } rep.mergedReport = angular.copy(report); if(rep.mergedReport.withMap && rep.mergedReport.reportType === 'standard'){ spatialConfigRestService.getUserConfigs().then(getUserConfigsSuccess, getUserConfigsFailure); @@ -233,6 +254,11 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp }; rep.refreshReport = function(){ + if (angular.isDefined(reportFormService.liveView.currentReport) && reportFormService.liveView.currentReport !== null) { + rep.layerConfiguration = JSON.parse(reportFormService.liveView.currentReport.mapLayerConfig ? reportFormService.liveView.currentReport.mapLayerConfig : '{}'); + rep.mapZoom = reportFormService.liveView.currentReport.mapZoom; + rep.mapCenter = reportFormService.liveView.currentReport.mapCenter; + } if (angular.isDefined(rep.id)){ setStateProperties(); rep.clearMapOverlays(); @@ -472,7 +498,29 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp //Add nodes to the tree and layers to the map if (rep.positions.length > 0 || rep.segments.length > 0 || rep.activities.length > 0){ var vectorNodeSource = new TreeModel(); - vectorNodeSource = vectorNodeSource.nodeFromData(data); + + vectorNodeSource = vectorNodeSource.nodeFromData(data, rep.layerConfiguration); + + angular.forEach(vectorNodeSource, function(VNSChild) { + var selected = false; + + angular.forEach(VNSChild.children, function(child){ + if (child.selected === true) { + selected = true; + } + if (!child.data && child.type === 'ers-type') { + rep.pushLayerConfig(child.filterType, child.selected); + } else { + rep.pushLayerConfig(child.data.type, child.selected); + if (child.children) { + angular.forEach(child.children, function(child2){ + rep.pushLayerConfig(child2.type, child.selected); + }); + } + } + }); + rep.pushLayerConfig(VNSChild.data ? VNSChild.data.type : VNSChild.type, selected); + }); var previousLayerState = mapStateService.fromStorage(); if (angular.isDefined(previousLayerState) && previousLayerState.repId === rep.id){ @@ -494,7 +542,10 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp layerPanelService.addLayerTreeNode(vectorNodeSource); if (reportingNavigatorService.isViewVisible('mapPanel') && angular.isUndefined(previousLayerState)){ - mapService.zoomToPositionsLayer(); + if (angular.isDefined(rep.mapZoom) && rep.mapZoom === null) { + mapService.zoomToPositionsLayer(); + } + } } else if (rep.positions.length === 0 && rep.segments.length === 0){ rep.hasAlert = true; @@ -653,6 +704,10 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp this.push(nodeCfgFromServer); }, newTreeSource); + if (angular.isDefined(oldTreeSource) && oldTreeSource.length === 0) { + newTreeSource = treeSourceFromCfg; + } + return newTreeSource; }; @@ -662,6 +717,22 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp mapService.updateMapView(data.map.projection); } + if (angular.isDefined(rep.mapCenter) && rep.mapCenter !== null) { + rep.mapCenter = rep.mapCenter.replace('[',''); + rep.mapCenter = rep.mapCenter.replace(']',''); + + var centerArray = []; + if (angular.isDefined(centerArray)) { + centerArray.push(parseFloat(rep.mapCenter.split(',')[0])); + centerArray.push(parseFloat(rep.mapCenter.split(',')[1])); + mapService.map.getView().setCenter(centerArray); + } + } + + if (angular.isDefined(rep.mapZoom) && rep.mapZoom !== null) { + mapService.map.getView().setZoom(rep.mapZoom); + } + //Set map controls mapService.updateMapControls(data.map.control); @@ -690,7 +761,24 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp //Build tree object and update layer panel var treeSource = new TreeModel(); - treeSource = treeSource.fromConfig(data.map.layers); + treeSource = treeSource.fromConfig(data.map.layers, rep.layerConfiguration); + + angular.forEach(treeSource, function(ts) { + var selected = false; + angular.forEach(ts.children, function(ch) { + var type = ch.data.type === 'WMS' ? ch.data.typeName : ch.data.type; + if (ch.children) { + angular.forEach(ch.children, function(dc) { + rep.pushLayerConfig(type, dc.selected ? dc.selected : false); + }); + } + if (ch.selected) { + selected = true; + } + rep.pushLayerConfig(type, ch.selected ? ch.selected : false); + }); + rep.pushLayerConfig(ts.data.type, selected); + }); //Maintain the map state if map is being refreshed var previousLayerState = mapStateService.fromStorage(); @@ -816,6 +904,9 @@ angular.module('unionvmsWeb').factory('reportService',function($rootScope, $comp }; var getMapConfigsFromReportSuccess = function(data){ + rep.mergedReport.layerConfiguration = rep.layerConfiguration; + rep.mergedReport.mapZoom = rep.mapZoom; + rep.mergedReport.mapCenter = rep.mapCenter; prepareReportToRun(rep.mergedReport); configureMap(data[0]); From 24193e41186b6a6a99606810f500f7751f8eb85a Mon Sep 17 00:00:00 2001 From: gmanifavas Date: Mon, 2 Nov 2020 16:33:15 +0200 Subject: [PATCH 18/33] [UNIONVMS-4750] Apply last X search to segments. --- .../stFieldSearchGeoJson.js | 33 +++++++++++-------- .../liveViewPanel/vmsPanel/vmsPanel.html | 9 +---- .../app/service/reporting/reportService.js | 14 ++++---- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js b/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js index c6e886853..8478e8b04 100644 --- a/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js +++ b/unionvms-web/app/filter/spatial/stFieldSearchGeoJson/stFieldSearchGeoJson.js @@ -95,7 +95,7 @@ angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, u return resp; }; - + var getIdentifier = function (obj) { if(type === 'trips') { return obj['tripId']; @@ -103,7 +103,7 @@ angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, u return obj['id']; } }; - + //Function to calculate upper boundary when filtering fields with duration/time var dehumanizeTimeAndCalculateUpBoundary = function(time){ var parsedStr = time.match(/([0-9]+[dhms]{1})/ig); @@ -284,6 +284,11 @@ angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, u var additionalKeys = _.keys(additionalFilters); additionalKeys.splice(0,1); var temp; + if (type === 'segments' && angular.isDefined(lastX)){ + tempRecs = tempRecs.sort(function(a, b){ + return new Date(b.properties.positionTime) - new Date(a.properties.positionTime); + }); + } angular.forEach(tempRecs, function(rec, idx){ var filterDate, recDate; var includeArray = []; @@ -430,20 +435,20 @@ angular.module('smart-table').filter('stFieldSearchGeoJson', function($filter, u include = updateInclude(temp, include); } - if (include && angular.isDefined(this.vessels) && type !== 'trips'){ - var connectId = type === 'tracks' ? rec.guid : rec.properties.connectionId; - if(angular.isDefined(connectId)){ - if(!angular.isDefined(this.vessels[connectId])){ - this.vessels[connectId] = 1; - } - if(this.vessels[connectId] <= this.vessels.last_x_count){ - this.vessels[connectId] += 1; - } - else{ - include = false; + if (include && angular.isDefined(this.vessels)){ + if (type === 'positions' || type === 'segments') { + var connectId = rec.properties.connectionId; + if (angular.isDefined(connectId)) { + if (!angular.isDefined(this.vessels[connectId])) { + this.vessels[connectId] = 1; + } + if (this.vessels[connectId] <= this.vessels.last_x_count) { + this.vessels[connectId] += 1; + } else { + include = false; + } } } - } if (angular.isDefined(this.tripIds)) { diff --git a/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html b/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html index 91352e291..b0753d1aa 100644 --- a/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html +++ b/unionvms-web/app/partial/spatial/liveViewPanel/vmsPanel/vmsPanel.html @@ -430,14 +430,7 @@ -
-
-
- - -
-
-
+
@@ -69,7 +69,7 @@
@@ -81,7 +81,7 @@
@@ -93,7 +93,7 @@
@@ -105,7 +105,7 @@
@@ -117,7 +117,7 @@
@@ -129,7 +129,7 @@
@@ -237,4 +237,4 @@ - \ No newline at end of file + diff --git a/unionvms-web/app/partial/activity/tripReportsList/tripReportsList.html b/unionvms-web/app/partial/activity/tripReportsList/tripReportsList.html index 90a169007..41ba4488b 100644 --- a/unionvms-web/app/partial/activity/tripReportsList/tripReportsList.html +++ b/unionvms-web/app/partial/activity/tripReportsList/tripReportsList.html @@ -1,6 +1,12 @@
+
+ +
+
+ +
@@ -59,14 +65,14 @@
@@ -95,7 +101,7 @@
diff --git a/unionvms-web/app/partial/activity/tripReportsList/tripReportsList.js b/unionvms-web/app/partial/activity/tripReportsList/tripReportsList.js index acfba346a..fd1aae900 100644 --- a/unionvms-web/app/partial/activity/tripReportsList/tripReportsList.js +++ b/unionvms-web/app/partial/activity/tripReportsList/tripReportsList.js @@ -21,7 +21,7 @@ copy of the GNU General Public License along with the IFDM Suite. If not, see {@link unionvmsWeb.activityRestFactory}

+ * @param activityRestFactory {service} The REST factory for the activity module

{@link unionvmsWeb.activityRestFactory}

* @description * REST services for the activity module */ @@ -173,7 +176,7 @@ angular.module('unionvmsWeb').factory('activityRestFactory', function ($resource var activityService = { /** * Get the user preferences for the activty module - * + * * @memberof activityRestService * @public * @returns {Promise} A promise with either the user preferences of the activity module or reject error @@ -190,7 +193,7 @@ angular.module('unionvmsWeb').factory('activityRestFactory', function ($resource }, /** * Get a list of fishing activity reports according to search criteria - * + * * @memberof activityRestService * @public * @param {Object} data - The search criteria and table pagination data object @@ -228,7 +231,7 @@ angular.module('unionvmsWeb').factory('activityRestFactory', function ($resource }, /** * Get the history for a FA report - * + * * @memberof activityRestService * @public * @param {Number} refId - The reference ID @@ -264,7 +267,7 @@ angular.module('unionvmsWeb').factory('activityRestFactory', function ($resource }, /** * Get the vessel and roles details of a specific trip - * + * * @memberof activityRestService * @public * @param {String} id - The trip id of the selected trip @@ -281,7 +284,7 @@ angular.module('unionvmsWeb').factory('activityRestFactory', function ($resource }, /** * Get the message type count of a specific trip - * + * * @memberof activityRestService * @public * @param {String} id - The trip id of the selected trip @@ -298,7 +301,7 @@ angular.module('unionvmsWeb').factory('activityRestFactory', function ($resource }, /** * Get the trip reports of a specific trip - * + * * @memberof activityRestService * @public * @param {String} id - The trip id of the selected trip @@ -315,7 +318,7 @@ angular.module('unionvmsWeb').factory('activityRestFactory', function ($resource }, /** * Get the trip map data - * + * * @memberof activityRestService * @public * @param {String} id - The trip id of the selected trip @@ -348,8 +351,8 @@ angular.module('unionvmsWeb').factory('activityRestFactory', function ($resource return deferred.promise; }, /** - * Get the Catches Evolution Details. - * + * Get the Catches Evolution Details. + * * @memberof activityRestService * @public * @param {String} id - The trip id of the selected trip @@ -367,11 +370,11 @@ angular.module('unionvmsWeb').factory('activityRestFactory', function ($resource }, /** * Get Fishing Activity details by type - * + * * @memberof activityRestService * @public * @param {String} type - The fisihing activity type (e.g. departure, landing, arrival) - * @param {Object} payload - The post payload containing the activity id (mandatory) and the trip id (not mandatory and to be used only in the report tab) + * @param {Object} payload - The post payload containing the activity id (mandatory) and the trip id (not mandatory and to be used only in the report tab) * @returns {Promise} A promise with either the fishing activity details or reject error */ getFishingActivityDetails: function(type, payload){ @@ -387,7 +390,7 @@ angular.module('unionvmsWeb').factory('activityRestFactory', function ($resource }, /** * Get commchannels data - * + * * @memberof activityRestService * @public * @returns {Promise} A promise with either the fishing activity details or reject error @@ -408,7 +411,16 @@ angular.module('unionvmsWeb').factory('activityRestFactory', function ($resource }, function () { console.error('Failed to export activities to CSV'); return {}; - }); + }); + }, + exportTripListToCsv: function (query) { + return activityRestFactory.exportTripListToCsv(query).then( + function (response) { + return response.data; + }, function () { + console.error('Failed to export trips to CSV'); + return {}; + }); } }; diff --git a/unionvms-web/app/service/activity/activityService.js b/unionvms-web/app/service/activity/activityService.js index 96b55c816..c3ed4cc42 100644 --- a/unionvms-web/app/service/activity/activityService.js +++ b/unionvms-web/app/service/activity/activityService.js @@ -506,10 +506,11 @@ angular.module('unionvmsWeb').factory('activityService',function(locale, activit return comboList; }; - actServ.csvLoading = false; + actServ.activitiesCsvLoading = false; + actServ.tripsCsvLoading = false; actServ.exportActivityListToCsv = function() { - actServ.csvLoading = true; + actServ.activitiesCsvLoading = true; var simpleCriteria = {}; if (angular.isDefined(actServ['reportsList'].searchObject.simpleCriteria)){ @@ -528,7 +529,31 @@ angular.module('unionvmsWeb').factory('activityService',function(locale, activit var file = new Blob([data], {type: 'text/csv;charset=UTF-8'}); $window.saveAs(file, "csvExport" + moment().format("YYYY-MM-DDTHH:mm") + ".csv"); } - actServ.csvLoading = false; + actServ.activitiesCsvLoading = false; + }) + }; + + actServ.exportTripListToCsv = function() { + actServ.tripsCsvLoading = true; + + var simpleCriteria = {}; + if (angular.isDefined(actServ['tripsList'].searchObject.simpleCriteria)){ + simpleCriteria = actServ['tripsList'].searchObject.simpleCriteria; + } + + var payload = { + pagination: getPaginationForServer(undefined), + sorting: actServ['tripsList'].sorting, + searchCriteriaMap: simpleCriteria, + searchCriteriaMapMultipleValues: actServ['tripsList'].searchObject.multipleCriteria, + showOnlyLatest: true + }; + activityRestService.exportTripListToCsv(payload).then(function (data) { + if(!angular.equals({}, data)) { + var file = new Blob([data], {type: 'text/csv;charset=UTF-8'}); + $window.saveAs(file, "csvExport" + moment().format("YYYY-MM-DDTHH:mm") + ".csv"); + } + actServ.tripsCsvLoading = false; }) }; From 396715075fc9915784157556fd10fd4af26f4126 Mon Sep 17 00:00:00 2001 From: PROTOPAPAS Thanasis Date: Mon, 9 Nov 2020 12:50:43 +0200 Subject: [PATCH 27/33] [UNIONVMS-4863] [UNIONVMS-4864] front end functionallity for sorting activity and trip tables on activity page by vessel ids --- .../activityReportsList/activityReportsList.html | 12 ++++++------ .../activity/tripReportsList/tripReportsList.html | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/unionvms-web/app/partial/activity/activityReportsList/activityReportsList.html b/unionvms-web/app/partial/activity/activityReportsList/activityReportsList.html index 664d9e10b..733306fd8 100644 --- a/unionvms-web/app/partial/activity/activityReportsList/activityReportsList.html +++ b/unionvms-web/app/partial/activity/activityReportsList/activityReportsList.html @@ -165,12 +165,12 @@ ng-if="column === 'startDate'">{{'activity.header_fa_start_date' | i18n }}
{{'activity.header_fa_end_date' | i18n }}
-
{{'spatial.reports_form_vessel_search_table_header_cfr' | i18n }}
-
{{'spatial.reports_form_vessel_search_table_header_ircs' | i18n }}
-
{{'spatial.reports_form_vessel_search_table_header_external_marking' | i18n }}
-
{{'activity.header_fa_uvi' | i18n }}
-
{{'activity.header_fa_iccat' | i18n }}
-
{{'activity.header_fa_gfcm' | i18n }}
+
{{'spatial.reports_form_vessel_search_table_header_cfr' | i18n }}
+
{{'spatial.reports_form_vessel_search_table_header_ircs' | i18n }}
+
{{'spatial.reports_form_vessel_search_table_header_external_marking' | i18n }}
+
{{'activity.header_fa_uvi' | i18n }}
+
{{'activity.header_fa_iccat' | i18n }}
+
{{'activity.header_fa_gfcm' | i18n }}
{{'activity.header_fa_areas' | i18n }}
{{'activity.header_fa_port' | i18n }}
{{'activity.header_fa_gear' | i18n }}
diff --git a/unionvms-web/app/partial/activity/tripReportsList/tripReportsList.html b/unionvms-web/app/partial/activity/tripReportsList/tripReportsList.html index 41ba4488b..1298e6b1b 100644 --- a/unionvms-web/app/partial/activity/tripReportsList/tripReportsList.html +++ b/unionvms-web/app/partial/activity/tripReportsList/tripReportsList.html @@ -122,13 +122,13 @@
{{'activity.tab_trip_table_header_id' | i18n }}
-
{{'spatial.tab_vms_pos_table_header_fs' | i18n }}
-
{{'spatial.reports_form_vessel_search_table_header_external_marking' | i18n }}
-
{{'spatial.reports_form_vessel_search_table_header_ircs' | i18n }}
-
{{'spatial.reports_form_vessel_search_table_header_cfr' | i18n }}
-
{{'activity.fa_details_item_uvi' | i18n }}
-
{{'activity.fa_details_item_iccat' | i18n }}
-
{{'activity.fa_details_item_gfcm' | i18n }}
+
{{'spatial.tab_vms_pos_table_header_fs' | i18n }}
+
{{'spatial.reports_form_vessel_search_table_header_external_marking' | i18n }}
+
{{'spatial.reports_form_vessel_search_table_header_ircs' | i18n }}
+
{{'spatial.reports_form_vessel_search_table_header_cfr' | i18n }}
+
{{'activity.fa_details_item_uvi' | i18n }}
+
{{'activity.fa_details_item_iccat' | i18n }}
+
{{'activity.fa_details_item_gfcm' | i18n }}
{{'activity.tab_trip_table_header_first_event' | i18n }}
{{'activity.tab_trip_table_header_first_event_time' | i18n }}
{{'activity.tab_trip_table_header_last_event' | i18n }}
From 936c1ba5e241e31b89af0b23eea11a9058a35a15 Mon Sep 17 00:00:00 2001 From: cpapatheodorou Date: Thu, 15 Oct 2020 13:30:05 +0300 Subject: [PATCH 28/33] [UNIONVMS-4634] Added field in activities advanced search form for flux fa report id --- unionvms-web/app/i18n/bg-bg/activity.lang.json | 1 + unionvms-web/app/i18n/cs-cz/activity.lang.json | 1 + unionvms-web/app/i18n/da-dk/activity.lang.json | 1 + unionvms-web/app/i18n/de-at/activity.lang.json | 1 + unionvms-web/app/i18n/de-de/activity.lang.json | 1 + unionvms-web/app/i18n/de-lu/activity.lang.json | 1 + unionvms-web/app/i18n/el-cy/activity.lang.json | 1 + unionvms-web/app/i18n/el-gr/activity.lang.json | 1 + unionvms-web/app/i18n/en-gb/activity.lang.json | 1 + unionvms-web/app/i18n/en-ie/activity.lang.json | 1 + unionvms-web/app/i18n/es-es/activity.lang.json | 1 + unionvms-web/app/i18n/et-ee/activity.lang.json | 1 + unionvms-web/app/i18n/fi-fi/activity.lang.json | 1 + unionvms-web/app/i18n/fr-fr/activity.lang.json | 1 + unionvms-web/app/i18n/fr-lu/activity.lang.json | 1 + unionvms-web/app/i18n/hr-hr/activity.lang.json | 1 + unionvms-web/app/i18n/hu-hu/activity.lang.json | 1 + unionvms-web/app/i18n/im-im/activity.lang.json | 1 + unionvms-web/app/i18n/it-it/activity.lang.json | 1 + unionvms-web/app/i18n/lt-lt/activity.lang.json | 1 + unionvms-web/app/i18n/lv-lv/activity.lang.json | 1 + unionvms-web/app/i18n/mt/activity.lang.json | 1 + unionvms-web/app/i18n/nl-be/activity.lang.json | 1 + unionvms-web/app/i18n/nl-nl/activity.lang.json | 1 + unionvms-web/app/i18n/nl/activity.lang.json | 1 + unionvms-web/app/i18n/pl/activity.lang.json | 1 + unionvms-web/app/i18n/pt-pt/activity.lang.json | 1 + unionvms-web/app/i18n/ro-ro/activity.lang.json | 1 + unionvms-web/app/i18n/si-si/activity.lang.json | 1 + unionvms-web/app/i18n/sk-sk/activity.lang.json | 1 + unionvms-web/app/i18n/sv/activity.lang.json | 1 + unionvms-web/app/i18n/tr-cy/activity.lang.json | 1 + .../activity/advancedSearchForm/advancedSearchForm.html | 4 ++++ .../activity/advancedSearchForm/advancedSearchForm.js | 6 ++++-- 34 files changed, 40 insertions(+), 2 deletions(-) diff --git a/unionvms-web/app/i18n/bg-bg/activity.lang.json b/unionvms-web/app/i18n/bg-bg/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/bg-bg/activity.lang.json +++ b/unionvms-web/app/i18n/bg-bg/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/cs-cz/activity.lang.json b/unionvms-web/app/i18n/cs-cz/activity.lang.json index beeaf7901..ed21b5d05 100644 --- a/unionvms-web/app/i18n/cs-cz/activity.lang.json +++ b/unionvms-web/app/i18n/cs-cz/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/da-dk/activity.lang.json b/unionvms-web/app/i18n/da-dk/activity.lang.json index beeaf7901..ed21b5d05 100644 --- a/unionvms-web/app/i18n/da-dk/activity.lang.json +++ b/unionvms-web/app/i18n/da-dk/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/de-at/activity.lang.json b/unionvms-web/app/i18n/de-at/activity.lang.json index beeaf7901..ed21b5d05 100644 --- a/unionvms-web/app/i18n/de-at/activity.lang.json +++ b/unionvms-web/app/i18n/de-at/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/de-de/activity.lang.json b/unionvms-web/app/i18n/de-de/activity.lang.json index beeaf7901..ed21b5d05 100644 --- a/unionvms-web/app/i18n/de-de/activity.lang.json +++ b/unionvms-web/app/i18n/de-de/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/de-lu/activity.lang.json b/unionvms-web/app/i18n/de-lu/activity.lang.json index beeaf7901..ed21b5d05 100644 --- a/unionvms-web/app/i18n/de-lu/activity.lang.json +++ b/unionvms-web/app/i18n/de-lu/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/el-cy/activity.lang.json b/unionvms-web/app/i18n/el-cy/activity.lang.json index beeaf7901..ed21b5d05 100644 --- a/unionvms-web/app/i18n/el-cy/activity.lang.json +++ b/unionvms-web/app/i18n/el-cy/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/el-gr/activity.lang.json b/unionvms-web/app/i18n/el-gr/activity.lang.json index beeaf7901..ed21b5d05 100644 --- a/unionvms-web/app/i18n/el-gr/activity.lang.json +++ b/unionvms-web/app/i18n/el-gr/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/en-gb/activity.lang.json b/unionvms-web/app/i18n/en-gb/activity.lang.json index 834098778..69d83af21 100644 --- a/unionvms-web/app/i18n/en-gb/activity.lang.json +++ b/unionvms-web/app/i18n/en-gb/activity.lang.json @@ -227,6 +227,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/en-ie/activity.lang.json b/unionvms-web/app/i18n/en-ie/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/en-ie/activity.lang.json +++ b/unionvms-web/app/i18n/en-ie/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/es-es/activity.lang.json b/unionvms-web/app/i18n/es-es/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/es-es/activity.lang.json +++ b/unionvms-web/app/i18n/es-es/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/et-ee/activity.lang.json b/unionvms-web/app/i18n/et-ee/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/et-ee/activity.lang.json +++ b/unionvms-web/app/i18n/et-ee/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/fi-fi/activity.lang.json b/unionvms-web/app/i18n/fi-fi/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/fi-fi/activity.lang.json +++ b/unionvms-web/app/i18n/fi-fi/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/fr-fr/activity.lang.json b/unionvms-web/app/i18n/fr-fr/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/fr-fr/activity.lang.json +++ b/unionvms-web/app/i18n/fr-fr/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/fr-lu/activity.lang.json b/unionvms-web/app/i18n/fr-lu/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/fr-lu/activity.lang.json +++ b/unionvms-web/app/i18n/fr-lu/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/hr-hr/activity.lang.json b/unionvms-web/app/i18n/hr-hr/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/hr-hr/activity.lang.json +++ b/unionvms-web/app/i18n/hr-hr/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/hu-hu/activity.lang.json b/unionvms-web/app/i18n/hu-hu/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/hu-hu/activity.lang.json +++ b/unionvms-web/app/i18n/hu-hu/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/im-im/activity.lang.json b/unionvms-web/app/i18n/im-im/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/im-im/activity.lang.json +++ b/unionvms-web/app/i18n/im-im/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/it-it/activity.lang.json b/unionvms-web/app/i18n/it-it/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/it-it/activity.lang.json +++ b/unionvms-web/app/i18n/it-it/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/lt-lt/activity.lang.json b/unionvms-web/app/i18n/lt-lt/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/lt-lt/activity.lang.json +++ b/unionvms-web/app/i18n/lt-lt/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/lv-lv/activity.lang.json b/unionvms-web/app/i18n/lv-lv/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/lv-lv/activity.lang.json +++ b/unionvms-web/app/i18n/lv-lv/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/mt/activity.lang.json b/unionvms-web/app/i18n/mt/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/mt/activity.lang.json +++ b/unionvms-web/app/i18n/mt/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/nl-be/activity.lang.json b/unionvms-web/app/i18n/nl-be/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/nl-be/activity.lang.json +++ b/unionvms-web/app/i18n/nl-be/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/nl-nl/activity.lang.json b/unionvms-web/app/i18n/nl-nl/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/nl-nl/activity.lang.json +++ b/unionvms-web/app/i18n/nl-nl/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/nl/activity.lang.json b/unionvms-web/app/i18n/nl/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/nl/activity.lang.json +++ b/unionvms-web/app/i18n/nl/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/pl/activity.lang.json b/unionvms-web/app/i18n/pl/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/pl/activity.lang.json +++ b/unionvms-web/app/i18n/pl/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/pt-pt/activity.lang.json b/unionvms-web/app/i18n/pt-pt/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/pt-pt/activity.lang.json +++ b/unionvms-web/app/i18n/pt-pt/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/ro-ro/activity.lang.json b/unionvms-web/app/i18n/ro-ro/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/ro-ro/activity.lang.json +++ b/unionvms-web/app/i18n/ro-ro/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/si-si/activity.lang.json b/unionvms-web/app/i18n/si-si/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/si-si/activity.lang.json +++ b/unionvms-web/app/i18n/si-si/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/sk-sk/activity.lang.json b/unionvms-web/app/i18n/sk-sk/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/sk-sk/activity.lang.json +++ b/unionvms-web/app/i18n/sk-sk/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/sv/activity.lang.json b/unionvms-web/app/i18n/sv/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/sv/activity.lang.json +++ b/unionvms-web/app/i18n/sv/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/i18n/tr-cy/activity.lang.json b/unionvms-web/app/i18n/tr-cy/activity.lang.json index 9a0ba8e12..801641836 100644 --- a/unionvms-web/app/i18n/tr-cy/activity.lang.json +++ b/unionvms-web/app/i18n/tr-cy/activity.lang.json @@ -149,6 +149,7 @@ "catch_panel_see_catch_evolution": "See catch evolution", "catch_panel_see_catch_details": "See catch details", "advanced_search_placeholder_com_channel": "Communication Channel", + "advanced_search_placeholder_flux_fa_report_id": "FA report Id", "advanced_search_placeholder_from_id": "From (ID)", "advanced_search_placeholder_owner": "Owner", "advanced_search_placeholder_start_date": "Start Date", diff --git a/unionvms-web/app/partial/activity/advancedSearchForm/advancedSearchForm.html b/unionvms-web/app/partial/activity/advancedSearchForm/advancedSearchForm.html index 84e3dde19..abfa64276 100644 --- a/unionvms-web/app/partial/activity/advancedSearchForm/advancedSearchForm.html +++ b/unionvms-web/app/partial/activity/advancedSearchForm/advancedSearchForm.html @@ -109,6 +109,10 @@
{{'activity.advanced_search_max' | i18n}}
+
+ + +
diff --git a/unionvms-web/app/partial/activity/advancedSearchForm/advancedSearchForm.js b/unionvms-web/app/partial/activity/advancedSearchForm/advancedSearchForm.js index b991c04e3..a4387d2c8 100644 --- a/unionvms-web/app/partial/activity/advancedSearchForm/advancedSearchForm.js +++ b/unionvms-web/app/partial/activity/advancedSearchForm/advancedSearchForm.js @@ -68,7 +68,8 @@ angular.module('unionvmsWeb').controller('AdvancedsearchformCtrl',function($scop master: undefined, minWeight: undefined, maxWeight: undefined, - tripId: undefined + tripId: undefined, + fluxFaReportId: undefined }; /** @@ -266,7 +267,8 @@ angular.module('unionvmsWeb').controller('AdvancedsearchformCtrl',function($scop maxWeight: 'QUANTITY_MAX', comChannel: 'SOURCE', activityType: 'ACTIVITY_TYPE', - tripId: 'TRIP_ID' + tripId: 'TRIP_ID', + fluxFaReportId: 'FLUX_FA_REPORT_ID' }; var formatedSearch = {}; From ade1d5f5eb72be816e73e1a100b691f40a827e83 Mon Sep 17 00:00:00 2001 From: gmanifavas Date: Wed, 18 Nov 2020 14:26:29 +0200 Subject: [PATCH 29/33] [UNIONVMS-4866] Fix queries for csv export. --- unionvms-web/app/service/activity/activityService.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/unionvms-web/app/service/activity/activityService.js b/unionvms-web/app/service/activity/activityService.js index c3ed4cc42..85fd3c27d 100644 --- a/unionvms-web/app/service/activity/activityService.js +++ b/unionvms-web/app/service/activity/activityService.js @@ -545,8 +545,7 @@ angular.module('unionvmsWeb').factory('activityService',function(locale, activit pagination: getPaginationForServer(undefined), sorting: actServ['tripsList'].sorting, searchCriteriaMap: simpleCriteria, - searchCriteriaMapMultipleValues: actServ['tripsList'].searchObject.multipleCriteria, - showOnlyLatest: true + searchCriteriaMapMultipleValues: actServ['tripsList'].searchObject.multipleCriteria }; activityRestService.exportTripListToCsv(payload).then(function (data) { if(!angular.equals({}, data)) { From d15e4f85d105e4dd1377ca454e92c99666624dca Mon Sep 17 00:00:00 2001 From: Ioannis Mitrolios Date: Tue, 20 Oct 2020 12:11:31 +0300 Subject: [PATCH 30/33] [UNIONVMS-4541] sorting asset table with added backend functionality --- unionvms-web/app/partial/vessel/vessel.js | 812 +++++++++--------- .../partial/vessel/vesselList/vesselList.html | 148 ++-- .../common/model/getListRequestModel.js | 630 +++++++------- .../app/service/common/searchService.js | 9 +- 4 files changed, 817 insertions(+), 782 deletions(-) diff --git a/unionvms-web/app/partial/vessel/vessel.js b/unionvms-web/app/partial/vessel/vessel.js index 1d084a5d4..8d759d46d 100644 --- a/unionvms-web/app/partial/vessel/vessel.js +++ b/unionvms-web/app/partial/vessel/vessel.js @@ -1,407 +1,405 @@ -/* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . - */ -angular.module('unionvmsWeb').controller('VesselCtrl', function($scope, $log, $state, $filter, $timeout, locale, savedSearchService, Vessel, VesselContact, searchService, vesselRestService, alertService, csvService, SearchResults, userService, PositionReportModal) { - - var checkAccessToFeature = function(feature) { - return userService.isAllowed(feature, 'Union-VMS', true); - }; - - //Keep track of visibility statuses - $scope.isVisible = { - search : true, - vesselForm : false, - notificationCancelSearch : false - }; - - $scope.currentSearchResults = new SearchResults('', false, locale.getString('vessel.search_zero_results_error')); - $scope.waitingForVesselDataResponse = false; - - //Selected by checkboxes - $scope.selectedVessels = []; - - $scope.editSelectionDropdownItems = [ - {text:locale.getString('common.save_as_group'), code : 'SAVE'}, - {text:locale.getString('common.append_group'), code : 'ADD_TO_GROUP'}, - {text:locale.getString('common.remove_from_group'), code : 'REMOVE_FROM_GROUP'}, - //{text:locale.getString('common.view_on_map'), code : 'MAP'}, - {text:locale.getString('common.export_selection'), code : 'EXPORT'} - ]; - - $scope.stTable = { - tableState: undefined, - itemsByPage: 20, - page: undefined - }; - - //Init function when entering page - var init = function(){ - //Load list with vessels based on latest movements - $scope.searchLatestMovements(); - - //Load vessel details - var vesselGUID = $state.params.id; - if(angular.isDefined(vesselGUID)){ - vesselRestService.getVessel(vesselGUID).then( - function(vessel) { - $scope.vesselObj = vessel.copy(); - $scope.waitingForVesselDataResponse = false; - }, - function(error){ - $log.error("Error loading state params: /" +vesselGUID); - //Show alert and vessel list - $scope.waitingForVesselDataResponse = false; - toggleFormDetails(); - alertService.showErrorMessage(locale.getString('vessel.vessel_stateparams_failed_to_load_error')); - - //Hide alert and change state after 5 sec - $timeout(function() { - $state.go('app.assets', {}, {notify: false}); - alertService.hideMessage(); - }, 5000); - } - ); - - //Show vessel form with loading indicator - $scope.waitingForVesselDataResponse = true; - toggleFormDetails(); - } - }; - - //Goto page in the search results - $scope.gotoPage = function(page){ - if(angular.isDefined(page)){ - searchService.setPage(page); - $scope.searchVessels(); - } - }; - - // Search for vessels - $scope.searchVessels = function(options, page) { - if (angular.isUndefined(page)){ - page = 1; - } - $scope.selectedGroupGuid = angular.isDefined(options) && angular.isDefined(options.savedSearchGroup) ? options.savedSearchGroup.id : undefined; - - $scope.clearSelection(); - $scope.currentSearchResults.clearErrorMessage(); - $scope.currentSearchResults.filter = ''; - $scope.currentSearchResults.setLoading(true); - searchService.searchVessels(page) - .then(updateSearchResults, onGetSearchResultsError); - - var timeoutDisplayNotificationCancelSearch = 3000; - $timeout(function(){ - if ($scope.currentSearchResults.loading) { - $scope.isVisible.notificationCancelSearch = true; - } - }, timeoutDisplayNotificationCancelSearch); - }; - - // Cancel search for vessels - $scope.cancelSearch = function() { - vesselRestService.cancelPendingRequests(); - $scope.currentSearchResults.setLoading(false); - $scope.isVisible.notificationCancelSearch = false; - }; - - // Search for vessels based on latest movements - $scope.searchLatestMovements = function(options) { - $scope.selectedGroupGuid = angular.isDefined(options) && angular.isDefined(options.savedSearchGroup) ? options.savedSearchGroup.id : undefined; - - $scope.clearSelection(); - $scope.currentSearchResults.clearErrorMessage(); - $scope.currentSearchResults.filter = ''; - $scope.currentSearchResults.setLoading(true); - searchService.searchLatestMovements() - .then(updateSearchResults, onGetSearchResultsError); - }; - - //Update the search results - var updateSearchResults = function(vesselListPage){ - $scope.isVisible.notificationCancelSearch = false; - $scope.currentSearchResults.updateWithNewResults(vesselListPage); - - $scope.allCurrentSearchResults = vesselListPage.items; - $scope.currentSearchResultsByPage = vesselListPage.items; - - $scope.stTable.page = vesselListPage.currentPage; - if ($scope.stTable.page !== ($scope.stTable.tableState.pagination.start / $scope.stTable.itemsByPage) + 1){ - $scope.stTable.tableState.pagination.start = $scope.stTable.page; - } - - $scope.stTable.tableState.pagination.numberOfPages = vesselListPage.totalNumberOfPages; - if (angular.isDefined($scope.stTable.tableState.sort.predicate)){ - $scope.sortTableData($scope.stTable.tableState.sort.predicate, $scope.stTable.tableState.sort.reverse); - } - }; - - $scope.sortTableData = function(predicate, reverse){ - $scope.currentSearchResultsByPage = $filter('orderBy')($scope.currentSearchResultsByPage, predicate, reverse); - }; - - // Handle error from search results (listing vessel) - var onGetSearchResultsError = function(response){ - $scope.isVisible.notificationCancelSearch = false; - - // Error functions not to be runned if search has been cancelled - if (angular.isUndefined(response) || response.status !== -1) { - $scope.currentSearchResults.removeAllItems(); - $scope.currentSearchResults.setLoading(false); - $scope.currentSearchResults.setErrorMessage(locale.getString('common.search_failed_error')); - $scope.allCurrentSearchResults = $scope.currentSearchResults.items; - } - }; - - //Is user allowed to edit vessels? - $scope.allowedToEditVessel = function(vessel){ - // Check permission, and vessel cannot be from source NATIONAL. - return checkAccessToFeature('manageVessels') && (!vessel || vessel.source !== 'NATIONAL'); - }; - - //Get original vessel - $scope.getOriginalVessel = function() { - if (!$scope.vesselObj) { - return; - } - - for (var i = 0; i < $scope.currentSearchResults.items.length; i++) { - if ($scope.currentSearchResults.items[i].equals($scope.vesselObj)) { - return $scope.currentSearchResults.items[i]; - } - } - }; - - $scope.mergeCurrentVesselIntoSearchResults = function() { - $scope.mergeCurrentVesselIntoSearchResults($scope.vesselObj); - }; - - $scope.mergeCurrentVesselIntoSearchResults = function(vesselObj) { - var vesselsInList = $scope.currentSearchResults.items; - for (var i = 0; i < vesselsInList.length; i++) { - if (vesselsInList[i].equals(vesselObj)) { - vesselsInList[i] = vesselObj; - vesselObj = vesselsInList[i].copy(); - } - } - }; - - $scope.removeCurrentVesselFromSearchResults = function() { - var vesselsInList = $scope.currentSearchResults.items; - var index; - for (var i = 0; i < vesselsInList.length; i++) { - if (vesselsInList[i].equals($scope.vesselObj)) { - index = i; - } - } - //Remove vessel from list - if(angular.isDefined(index)){ - $scope.currentSearchResults.items.splice(index, 1); - $scope.vesselObj = undefined; - } - - //Removed last vessel from list? - if($scope.currentSearchResults.items.length === 0){ - $scope.searchVessels(); - } - }; - - //Clear the selection - $scope.clearSelection = function(){ - $scope.selectedVessels = []; - }; - - //Add a vessel to the selection - $scope.addToSelection = function(item){ - $scope.selectedVessels.push(item); - }; - - //Remove a vessel from the selection - $scope.removeFromSelection = function(item){ - $.each($scope.selectedVessels, function(index, vessel){ - if(vessel.equals(item)){ - $scope.selectedVessels.splice(index, 1); - return false; - } - }); - }; - - //Are we in create mode? - $scope.isCreateNewMode = function(){ - return $scope.createNewMode; - }; - - $scope.setCreateMode = function(bool){ - $scope.createNewMode = bool; - }; - - $scope.setVesselObj = function(vessel){ - $scope.vesselObj = vessel; - }; - - $scope.getVesselObj = function(){ - return $scope.vesselObj; - }; - - //Toggle create new vessel - $scope.toggleCreateNewVessel = function(){ - $scope.createNewMode = true; - var newVessel = new Vessel(); - newVessel.contact.push(new VesselContact()); - toggleVesselForm(newVessel); - }; - - //Toggle viewing of a vessel - $scope.toggleViewVessel = function(item, noHideMessage){ - $scope.createNewMode = false; - toggleVesselForm(item, noHideMessage); - }; - - var toggleVesselForm = function(vessel, noHideMessage){ - //Create copy of the vessel object so we don't edit the object in the vessel list - if(vessel){ - $scope.vesselObj = vessel.copy(); - }else{ - $scope.vesselObj = undefined; - } - if (!noHideMessage) { - alertService.hideMessage(); - } - toggleFormDetails(); - }; - - //Toggle between vessel details and vessel list - var toggleFormDetails = function(){ - $scope.isVisible.vesselForm = !$scope.isVisible.vesselForm; - $scope.isVisible.search = !$scope.isVisible.search; - }; - - function getVesselGuids(vessels) { - return vessels.map(function(vessel) { - return vessel.vesselId.guid; - }); - } - - //When click cancel redirect to correct state and toggle list view - $scope.cancelFormView = function(){ - if(angular.isDefined($state.params.id)){ - $state.go('app.assets', {}, {notify: false}); - } - - $scope.toggleViewVessel(); - }; - - //Callback function for the "edit selection" dropdown - $scope.editSelectionCallback = function(selectedItem){ - var selectedItems = $scope.getSelectedItemsInFilter(); - if(selectedItems.length > 0){ - if (selectedItem.code === 'SAVE' || selectedItem.code === 'ADD_TO_GROUP') { - var options = { - dynamicSearch : false, - selectedItems : selectedItems, - append: selectedItem.code === 'ADD_TO_GROUP' - }; - savedSearchService.openSaveSearchModal("VESSEL", options); - } - else if (selectedItem.code === 'REMOVE_FROM_GROUP') { - removeFromGroup($scope.selectedGroupGuid, getVesselGuids(selectedItems)); - } - else if (selectedItem.code === 'EXPORT') { - $scope.exportVesselsAsCSVFile(true); - } - }else{ - alertService.showInfoMessageWithTimeout(locale.getString('common.no_items_selected')); - } - }; - - /* Removed the selected items from the current group, updates the group list and refreshed search if successful. */ - function removeFromGroup(groupId, selectedItems) { - if (groupId === undefined) { - alertService.showInfoMessageWithTimeout(locale.getString('common.no_group_selected')); - return; - } - - savedSearchService.removeVesselsFromGroup(groupId, selectedItems).then(function(group) { - $scope.$broadcast('refreshSavedSearch', group); - }, function(error) { - alertService.showErrorMessageWithTimeout(error); - }); - } - - //Get the selected items that are shown by the filter - $scope.getSelectedItemsInFilter = function(){ - return $filter('filter')($scope.selectedVessels, $scope.currentSearchResults.filter); - }; - - //Export data as CSV file - $scope.exportVesselsAsCSVFile = function(onlySelectedItems){ - var filename = 'assets.csv'; - - //Set the header columns - var header = [ - locale.getString('vessel.table_header_flag_state'), - locale.getString('vessel.table_header_external_marking'), - locale.getString('vessel.table_header_name'), - locale.getString('vessel.table_header_signal'), - locale.getString('vessel.table_header_cfr'), - locale.getString('vessel.table_header_gear_type'), - locale.getString('vessel.table_header_license_type'), - locale.getString('vessel.table_header_last_report'), - - ]; - - //Set the data columns - var getData = function() { - var exportItems; - //Export only selected items - if(onlySelectedItems){ - exportItems = $scope.getSelectedItemsInFilter(); - } - //Export items in the table - else{ - exportItems = $scope.currentSearchResults.items; - } - //Only select those shown by filter - return exportItems.reduce( - function(csvObject, item){ - var csvRow = [ - item.countryCode, - item.externalMarking, - item.name, - item.ircs, - item.cfr, - $filter('vesselGearTypeTranslation')(item.gearType), - $filter('vesselLicenseTypeTranslation')(item.licenseType), - angular.isDefined(item.lastMovement) ? $filter('timeAgo')(item.lastMovement.time) : '', - ]; - csvObject.push(csvRow); - return csvObject; - },[] - ); - }; - - //Create and download the file - csvService.downloadCSVFile(getData(), header, filename); - }; - - //Show a position report - $scope.showReport = function(reportGuid){ - if (angular.isDefined(reportGuid)){ - PositionReportModal.showReportWithGuid(reportGuid); - } - }; - - $scope.$on("$destroy", function() { - alertService.hideMessage(); - }); - - init(); -}); +/* +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . + */ +angular.module('unionvmsWeb').controller('VesselCtrl', function($scope, $log, $state, $filter, $timeout, locale, savedSearchService, Vessel, VesselContact, searchService, vesselRestService, alertService, csvService, SearchResults, userService, PositionReportModal) { + + var checkAccessToFeature = function(feature) { + return userService.isAllowed(feature, 'Union-VMS', true); + }; + + //Keep track of visibility statuses + $scope.isVisible = { + search : true, + vesselForm : false, + notificationCancelSearch : false + }; + + $scope.currentSearchResults = new SearchResults('', false, locale.getString('vessel.search_zero_results_error')); + $scope.waitingForVesselDataResponse = false; + + //Selected by checkboxes + $scope.selectedVessels = []; + + $scope.editSelectionDropdownItems = [ + {text:locale.getString('common.save_as_group'), code : 'SAVE'}, + {text:locale.getString('common.append_group'), code : 'ADD_TO_GROUP'}, + {text:locale.getString('common.remove_from_group'), code : 'REMOVE_FROM_GROUP'}, + //{text:locale.getString('common.view_on_map'), code : 'MAP'}, + {text:locale.getString('common.export_selection'), code : 'EXPORT'} + ]; + + $scope.stTable = { + tableState: undefined, + itemsByPage: 20, + page: undefined + }; + + //Init function when entering page + var init = function(){ + //Load list with vessels based on latest movements + $scope.searchLatestMovements(); + + //Load vessel details + var vesselGUID = $state.params.id; + if(angular.isDefined(vesselGUID)){ + vesselRestService.getVessel(vesselGUID).then( + function(vessel) { + $scope.vesselObj = vessel.copy(); + $scope.waitingForVesselDataResponse = false; + }, + function(error){ + $log.error("Error loading state params: /" +vesselGUID); + //Show alert and vessel list + $scope.waitingForVesselDataResponse = false; + toggleFormDetails(); + alertService.showErrorMessage(locale.getString('vessel.vessel_stateparams_failed_to_load_error')); + + //Hide alert and change state after 5 sec + $timeout(function() { + $state.go('app.assets', {}, {notify: false}); + alertService.hideMessage(); + }, 5000); + } + ); + + //Show vessel form with loading indicator + $scope.waitingForVesselDataResponse = true; + toggleFormDetails(); + } + }; + + //Goto page in the search results + $scope.gotoPage = function(page){ + if(angular.isDefined(page)){ + searchService.setPage(page); + $scope.searchVessels(); + } + }; + + // Search for vessels + $scope.searchVessels = function(options, page) { + if (angular.isUndefined(page)){ + page = 1; + } + $scope.selectedGroupGuid = angular.isDefined(options) && angular.isDefined(options.savedSearchGroup) ? options.savedSearchGroup.id : undefined; + + $scope.clearSelection(); + $scope.currentSearchResults.clearErrorMessage(); + $scope.currentSearchResults.filter = ''; + $scope.currentSearchResults.setLoading(true); + searchService.searchVessels(page) + .then(updateSearchResults, onGetSearchResultsError).finally(searchService.removeOrderByCriteria); + + var timeoutDisplayNotificationCancelSearch = 3000; + $timeout(function(){ + if ($scope.currentSearchResults.loading) { + $scope.isVisible.notificationCancelSearch = true; + } + }, timeoutDisplayNotificationCancelSearch); + }; + + // Cancel search for vessels + $scope.cancelSearch = function() { + vesselRestService.cancelPendingRequests(); + $scope.currentSearchResults.setLoading(false); + $scope.isVisible.notificationCancelSearch = false; + }; + + // Search for vessels based on latest movements + $scope.searchLatestMovements = function(options) { + $scope.selectedGroupGuid = angular.isDefined(options) && angular.isDefined(options.savedSearchGroup) ? options.savedSearchGroup.id : undefined; + + $scope.clearSelection(); + $scope.currentSearchResults.clearErrorMessage(); + $scope.currentSearchResults.filter = ''; + $scope.currentSearchResults.setLoading(true); + searchService.searchLatestMovements() + .then(updateSearchResults, onGetSearchResultsError); + }; + + //Update the search results + var updateSearchResults = function(vesselListPage){ + $scope.isVisible.notificationCancelSearch = false; + $scope.currentSearchResults.updateWithNewResults(vesselListPage); + + $scope.allCurrentSearchResults = vesselListPage.items; + $scope.currentSearchResultsByPage = vesselListPage.items; + + $scope.stTable.page = vesselListPage.currentPage; + if ($scope.stTable.page !== ($scope.stTable.tableState.pagination.start / $scope.stTable.itemsByPage) + 1){ + $scope.stTable.tableState.pagination.start = $scope.stTable.page; + } + + $scope.stTable.tableState.pagination.numberOfPages = vesselListPage.totalNumberOfPages; + }; + + $scope.sortTableData = function(predicate, reverse){ + searchService.addOrderByCriteria(predicate, reverse); + $scope.searchVessels(); + }; + + // Handle error from search results (listing vessel) + var onGetSearchResultsError = function(response){ + $scope.isVisible.notificationCancelSearch = false; + + // Error functions not to be runned if search has been cancelled + if (angular.isUndefined(response) || response.status !== -1) { + $scope.currentSearchResults.removeAllItems(); + $scope.currentSearchResults.setLoading(false); + $scope.currentSearchResults.setErrorMessage(locale.getString('common.search_failed_error')); + $scope.allCurrentSearchResults = $scope.currentSearchResults.items; + } + }; + + //Is user allowed to edit vessels? + $scope.allowedToEditVessel = function(vessel){ + // Check permission, and vessel cannot be from source NATIONAL. + return checkAccessToFeature('manageVessels') && (!vessel || vessel.source !== 'NATIONAL'); + }; + + //Get original vessel + $scope.getOriginalVessel = function() { + if (!$scope.vesselObj) { + return; + } + + for (var i = 0; i < $scope.currentSearchResults.items.length; i++) { + if ($scope.currentSearchResults.items[i].equals($scope.vesselObj)) { + return $scope.currentSearchResults.items[i]; + } + } + }; + + $scope.mergeCurrentVesselIntoSearchResults = function() { + $scope.mergeCurrentVesselIntoSearchResults($scope.vesselObj); + }; + + $scope.mergeCurrentVesselIntoSearchResults = function(vesselObj) { + var vesselsInList = $scope.currentSearchResults.items; + for (var i = 0; i < vesselsInList.length; i++) { + if (vesselsInList[i].equals(vesselObj)) { + vesselsInList[i] = vesselObj; + vesselObj = vesselsInList[i].copy(); + } + } + }; + + $scope.removeCurrentVesselFromSearchResults = function() { + var vesselsInList = $scope.currentSearchResults.items; + var index; + for (var i = 0; i < vesselsInList.length; i++) { + if (vesselsInList[i].equals($scope.vesselObj)) { + index = i; + } + } + //Remove vessel from list + if(angular.isDefined(index)){ + $scope.currentSearchResults.items.splice(index, 1); + $scope.vesselObj = undefined; + } + + //Removed last vessel from list? + if($scope.currentSearchResults.items.length === 0){ + $scope.searchVessels(); + } + }; + + //Clear the selection + $scope.clearSelection = function(){ + $scope.selectedVessels = []; + }; + + //Add a vessel to the selection + $scope.addToSelection = function(item){ + $scope.selectedVessels.push(item); + }; + + //Remove a vessel from the selection + $scope.removeFromSelection = function(item){ + $.each($scope.selectedVessels, function(index, vessel){ + if(vessel.equals(item)){ + $scope.selectedVessels.splice(index, 1); + return false; + } + }); + }; + + //Are we in create mode? + $scope.isCreateNewMode = function(){ + return $scope.createNewMode; + }; + + $scope.setCreateMode = function(bool){ + $scope.createNewMode = bool; + }; + + $scope.setVesselObj = function(vessel){ + $scope.vesselObj = vessel; + }; + + $scope.getVesselObj = function(){ + return $scope.vesselObj; + }; + + //Toggle create new vessel + $scope.toggleCreateNewVessel = function(){ + $scope.createNewMode = true; + var newVessel = new Vessel(); + newVessel.contact.push(new VesselContact()); + toggleVesselForm(newVessel); + }; + + //Toggle viewing of a vessel + $scope.toggleViewVessel = function(item, noHideMessage){ + $scope.createNewMode = false; + toggleVesselForm(item, noHideMessage); + }; + + var toggleVesselForm = function(vessel, noHideMessage){ + //Create copy of the vessel object so we don't edit the object in the vessel list + if(vessel){ + $scope.vesselObj = vessel.copy(); + }else{ + $scope.vesselObj = undefined; + } + if (!noHideMessage) { + alertService.hideMessage(); + } + toggleFormDetails(); + }; + + //Toggle between vessel details and vessel list + var toggleFormDetails = function(){ + $scope.isVisible.vesselForm = !$scope.isVisible.vesselForm; + $scope.isVisible.search = !$scope.isVisible.search; + }; + + function getVesselGuids(vessels) { + return vessels.map(function(vessel) { + return vessel.vesselId.guid; + }); + } + + //When click cancel redirect to correct state and toggle list view + $scope.cancelFormView = function(){ + if(angular.isDefined($state.params.id)){ + $state.go('app.assets', {}, {notify: false}); + } + + $scope.toggleViewVessel(); + }; + + //Callback function for the "edit selection" dropdown + $scope.editSelectionCallback = function(selectedItem){ + var selectedItems = $scope.getSelectedItemsInFilter(); + if(selectedItems.length > 0){ + if (selectedItem.code === 'SAVE' || selectedItem.code === 'ADD_TO_GROUP') { + var options = { + dynamicSearch : false, + selectedItems : selectedItems, + append: selectedItem.code === 'ADD_TO_GROUP' + }; + savedSearchService.openSaveSearchModal("VESSEL", options); + } + else if (selectedItem.code === 'REMOVE_FROM_GROUP') { + removeFromGroup($scope.selectedGroupGuid, getVesselGuids(selectedItems)); + } + else if (selectedItem.code === 'EXPORT') { + $scope.exportVesselsAsCSVFile(true); + } + }else{ + alertService.showInfoMessageWithTimeout(locale.getString('common.no_items_selected')); + } + }; + + /* Removed the selected items from the current group, updates the group list and refreshed search if successful. */ + function removeFromGroup(groupId, selectedItems) { + if (groupId === undefined) { + alertService.showInfoMessageWithTimeout(locale.getString('common.no_group_selected')); + return; + } + + savedSearchService.removeVesselsFromGroup(groupId, selectedItems).then(function(group) { + $scope.$broadcast('refreshSavedSearch', group); + }, function(error) { + alertService.showErrorMessageWithTimeout(error); + }); + } + + //Get the selected items that are shown by the filter + $scope.getSelectedItemsInFilter = function(){ + return $filter('filter')($scope.selectedVessels, $scope.currentSearchResults.filter); + }; + + //Export data as CSV file + $scope.exportVesselsAsCSVFile = function(onlySelectedItems){ + var filename = 'assets.csv'; + + //Set the header columns + var header = [ + locale.getString('vessel.table_header_flag_state'), + locale.getString('vessel.table_header_external_marking'), + locale.getString('vessel.table_header_name'), + locale.getString('vessel.table_header_signal'), + locale.getString('vessel.table_header_cfr'), + locale.getString('vessel.table_header_gear_type'), + locale.getString('vessel.table_header_license_type'), + locale.getString('vessel.table_header_last_report'), + + ]; + + //Set the data columns + var getData = function() { + var exportItems; + //Export only selected items + if(onlySelectedItems){ + exportItems = $scope.getSelectedItemsInFilter(); + } + //Export items in the table + else{ + exportItems = $scope.currentSearchResults.items; + } + //Only select those shown by filter + return exportItems.reduce( + function(csvObject, item){ + var csvRow = [ + item.countryCode, + item.externalMarking, + item.name, + item.ircs, + item.cfr, + $filter('vesselGearTypeTranslation')(item.gearType), + $filter('vesselLicenseTypeTranslation')(item.licenseType), + angular.isDefined(item.lastMovement) ? $filter('timeAgo')(item.lastMovement.time) : '', + ]; + csvObject.push(csvRow); + return csvObject; + },[] + ); + }; + + //Create and download the file + csvService.downloadCSVFile(getData(), header, filename); + }; + + //Show a position report + $scope.showReport = function(reportGuid){ + if (angular.isDefined(reportGuid)){ + PositionReportModal.showReportWithGuid(reportGuid); + } + }; + + $scope.$on("$destroy", function() { + alertService.hideMessage(); + }); + + init(); +}); diff --git a/unionvms-web/app/partial/vessel/vesselList/vesselList.html b/unionvms-web/app/partial/vessel/vesselList/vesselList.html index 374a3f2f3..1e6840df5 100644 --- a/unionvms-web/app/partial/vessel/vesselList/vesselList.html +++ b/unionvms-web/app/partial/vessel/vesselList/vesselList.html @@ -1,74 +1,74 @@ - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - {{'vessel.table_header_flag_state' | i18n}} - - {{'vessel.table_header_external_marking' | i18n}} - - {{'vessel.table_header_name' | i18n}} - - {{'vessel.table_header_signal' | i18n}} - - {{'vessel.table_header_cfr' | i18n}} - - {{'vessel.table_header_gear_type' | i18n}} - - {{'vessel.table_header_license_type' | i18n}} - - {{'vessel.table_header_last_report' | i18n}} - {{'vessel.table_header_details' | i18n}}
{{item.countryCode}}{{item.externalMarking}}{{item.name}}{{item.ircs}}{{item.cfr}}{{item.gearType | vesselGearTypeTranslation}}{{item.licenseType | vesselLicenseTypeTranslation}} - -
-
-
-
-
\ No newline at end of file + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + {{'vessel.table_header_flag_state' | i18n}} + + {{'vessel.table_header_external_marking' | i18n}} + + {{'vessel.table_header_name' | i18n}} + + {{'vessel.table_header_signal' | i18n}} + + {{'vessel.table_header_cfr' | i18n}} + + {{'vessel.table_header_gear_type' | i18n}} + + {{'vessel.table_header_license_type' | i18n}} + + {{'vessel.table_header_last_report' | i18n}} + {{'vessel.table_header_details' | i18n}}
{{item.countryCode}}{{item.externalMarking}}{{item.name}}{{item.ircs}}{{item.cfr}}{{item.gearType | vesselGearTypeTranslation}}{{item.licenseType | vesselLicenseTypeTranslation}} + +
+
+
+
+
diff --git a/unionvms-web/app/service/common/model/getListRequestModel.js b/unionvms-web/app/service/common/model/getListRequestModel.js index 6796fb75c..10628bbb7 100644 --- a/unionvms-web/app/service/common/model/getListRequestModel.js +++ b/unionvms-web/app/service/common/model/getListRequestModel.js @@ -1,300 +1,330 @@ -/* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . - */ -angular.module('unionvmsWeb') -.factory('GetListRequest', function(SearchField) { - - function GetListRequest(page, listSize, isDynamic, criterias, sorting){ - this.page = angular.isDefined(page) ? page : 1; - this.listSize = angular.isDefined(listSize) ? listSize : 10; - this.isDynamic = angular.isDefined(isDynamic) ? isDynamic : true; - this.criterias = angular.isDefined(criterias) ? criterias : []; - this.sorting = angular.isDefined(sorting) ? sorting : {}; - } - - GetListRequest.prototype.toJson = function(){ - return JSON.stringify({ - pagination : {page: this.page, listSize: this.listSize}, - searchCriteria : {isDynamic: this.isDynamic, criterias: this.criterias}, - sorting : {sortBy: this.sorting.sortBy, reversed: this.sorting.reverse} - }); - }; - - GetListRequest.prototype.DTOForVessel = function(){ - //Add * to all text searches for vessel - var wildcardSearchKeys = ['NAME', 'IRCS', 'CFR', 'EXTERNAL_MARKING', 'HOMEPORT', 'IMO', 'PRODUCER_NAME', 'PRODUCER_CODE', 'CONTACT_NAME', 'CONTACT_NUMBER', 'CONTACT_EMAIL', 'MMSI']; - var updatedCriterias = [], - searchFieldKey, searchFieldValue; - - $.each(this.criterias, function(index, searchField){ - searchFieldKey = searchField.key; - searchFieldValue = searchField.value; - //Add * to the end of the search value? - if(wildcardSearchKeys.indexOf(searchFieldKey) >= 0){ - if(typeof searchFieldValue === 'string' && searchFieldValue.charAt(searchFieldValue.length -1)){ - searchFieldValue = searchFieldValue +'*'; - } - - } - updatedCriterias.push(new SearchField(searchFieldKey, searchFieldValue)); - }); - - return { - pagination : {page: this.page, listSize: this.listSize}, - assetSearchCriteria : { isDynamic : this.isDynamic, criterias : updatedCriterias } - }; - }; - - GetListRequest.prototype.DTOForMobileTerminal = function(){ - var wildcardKeys = ['NAME', 'IRCS', 'EXTERNAL_MARKING', 'CFR', 'HOMEPORT', 'MMSI', 'SERIAL_NUMBER', 'DNID', 'SATELLITE_NUMBER', 'MEMBER_NUMBER']; - var criteria = this.criterias.map(function(criteria) { - if (wildcardKeys.indexOf(criteria.key) >= 0) { - return new SearchField(criteria.key, criteria.value + '*'); - } - else { - return criteria; - } - }); - - return { - pagination : {page: this.page, listSize: this.listSize}, - mobileTerminalSearchCriteria : {isDynamic: this.isDynamic, criterias: criteria} - }; - }; - - GetListRequest.prototype.DTOForPoll = function(){ - return { - pagination : {page: this.page, listSize: this.listSize}, - pollSearchCriteria : {isDynamic: this.isDynamic, criterias: this.criterias} - }; - }; - - GetListRequest.prototype.DTOForMovement = function(){ - - //List of search fields that should be in the movementRangeSearchCriteria object - //Ranges must include both from and to, so that's what the defaultValues are for - var ranges = [ - { - key : 'DATE', - from : {searchKey: 'FROM_DATE', defaultValue: '1970-01-01 00:00:00 +00:00'}, - to : {searchKey: 'TO_DATE', defaultValue: '2070-01-01 00:00:00 +00:00'} - }, - { - key: 'MOVEMENT_SPEED', - from : {searchKey: 'SPEED_MIN', defaultValue: 0}, - to : {searchKey: 'SPEED_MAX', defaultValue: 99999999} - } - ]; - - //Get a range by the search key - function getRangeBySearchKey(key){ - var range; - $.each(ranges, function(i, aRange){ - if(key === aRange.from.searchKey || key === aRange.to.searchKey){ - range = aRange; - return false; - } - }); - return range; - } - - var rangeCriterias = {}; - var criterias = []; - - //Build dict with rangeCriterias - var searchFieldKey, searchFieldValue, range; - $.each(this.criterias, function(index, searchField){ - searchFieldKey = searchField.key; - searchFieldValue = searchField.value; - - //Range search? - range = getRangeBySearchKey(searchFieldKey); - if(range){ - if(angular.isUndefined(rangeCriterias[range.key])){ - rangeCriterias[range.key] = { - from : range.from.defaultValue, - to : range.to.defaultValue, - }; - } - if(searchFieldKey === range.from.searchKey){ - rangeCriterias[range.key]['from'] = searchFieldValue; - } - else{ - rangeCriterias[range.key]['to'] = searchFieldValue; - } - }else{ - criterias.push(searchField); - } - }); - - //Make rangeCriterias a list - var rangeCriteriasList = []; - $.each(rangeCriterias, function(key, value){ - value['key'] = key; - rangeCriteriasList.push(value); - }); - - return { - movementRangeSearchCriteria : rangeCriteriasList, - movementSearchCriteria : criterias, - pagination : {page: this.page, listSize: this.listSize} - }; - }; - - GetListRequest.prototype.DTOForManualPosition = function(){ - return { - movementSearchCriteria : this.criterias, - pagination : {page: this.page, listSize: this.listSize} - }; - }; - - GetListRequest.prototype.DTOForAuditLogList = function() { - return { - auditSearchCriteria: this.criterias, - pagination: {page: this.page, listSize: this.listSize} - }; - }; - - GetListRequest.prototype.DTOForExchangeMessageList = function(){ - return{ - exchangeSearchCriteria : {criterias: this.criterias, isDynamic: false}, - pagination: {page: this.page, listSize: this.listSize}, - sorting: this.sorting - }; - }; - - GetListRequest.prototype.DTOForExchangePollList = function(){ - var fromDateSearchField = this.getCriteria('FROM_DATE'); - var toDateSearchField = this.getCriteria('TO_DATE'); - var statusSearchField = this.getCriteria('STATUS'); - - var searchObj = {}; - if(fromDateSearchField){ - searchObj.statusFromDate = fromDateSearchField.value; - } - if(toDateSearchField){ - searchObj.statusToDate = toDateSearchField.value; - } - if(statusSearchField){ - searchObj.status = statusSearchField.value; - } - return searchObj; - }; - - - GetListRequest.prototype.DTOForAlarms = function(){ - return{ - alarmSearchCriteria : this.criterias, - pagination: {page: this.page, listSize: this.listSize}, - dynamic: this.isDynamic - }; - }; - - GetListRequest.prototype.DTOForTickets = function(){ - return{ - ticketSearchCriteria : this.criterias, - pagination: {page: this.page, listSize: this.listSize} - }; - }; - - GetListRequest.prototype.DTOForRules = function(){ - return{ - customRuleSearchCriteria : this.criterias, - pagination: {page: this.page, listSize: this.listSize} - }; - }; - - GetListRequest.prototype.setPage = function(newPage){ - this.page = newPage; - return this.page; - }; - - GetListRequest.prototype.addSearchCriteria = function(key, value){ - var alreadyExists = false; - - //Only add if it doesnt already exists - $.each(this.criterias, function(index, crit){ - if(key === crit.key && value === crit.value){ - alreadyExists = true; - return false; - } - }); - if(!alreadyExists){ - this.criterias.push(new SearchField(key, value)); - } - }; - - //Removes criterias with the specified key - GetListRequest.prototype.removeSearchCriteria = function(key){ - var idxToRemove = []; - $.each(this.criterias, function(index, crit){ - if(key === crit.key){ - idxToRemove.push(index); - } - }); - - //Remove criterias - for (var i = idxToRemove.length - 1; i >= 0; i--) { - this.criterias.splice(idxToRemove[i],1); - } - }; - - GetListRequest.prototype.getCriteria = function(criteria){ - var found; - $.each(this.criterias, function(i, searchField){ - if(searchField.key === criteria){ - found = searchField; - return false; - } - }); - return found; - }; - - GetListRequest.prototype.setSearchCriterias = function(criterias){ - this.criterias = criterias; - }; - - GetListRequest.prototype.resetCriterias = function(){ - this.criterias = []; - }; - - GetListRequest.prototype.setDynamic = function(dynamic){ - this.isDynamic = dynamic; - }; - - GetListRequest.prototype.setDynamicToFalse = function(){ - this.isDynamic = false; - }; - - GetListRequest.prototype.setDynamicToTrue = function(){ - this.isDynamic = true; - }; - - GetListRequest.prototype.getNumberOfSearchCriterias = function(){ - return this.criterias.length; - }; - - GetListRequest.prototype.copy = function(){ - var copy = new GetListRequest(); - copy.page = this.page; - copy.listSize = this.listSize; - copy.isDynamic = this.isDynamic; - copy.criterias = []; - copy.sorting = this.sorting; - - $.each(this.criterias, function(index, searchField){ - copy.criterias.push(searchField.copy()); - }); - return copy; - }; - - return GetListRequest; -}); +/* +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . + */ +angular.module('unionvmsWeb') +.factory('GetListRequest', function(SearchField) { + + function GetListRequest(page, listSize, isDynamic, criterias, sorting, orderByCriteria){ + this.page = angular.isDefined(page) ? page : 1; + this.listSize = angular.isDefined(listSize) ? listSize : 10; + this.isDynamic = angular.isDefined(isDynamic) ? isDynamic : true; + this.criterias = angular.isDefined(criterias) ? criterias : []; + this.sorting = angular.isDefined(sorting) ? sorting : {}; + this.orderByCriteria = angular.isDefined(orderByCriteria) ? orderByCriteria : {}; + } + + GetListRequest.prototype.toJson = function(){ + return JSON.stringify({ + pagination : {page: this.page, listSize: this.listSize}, + searchCriteria : {isDynamic: this.isDynamic, criterias: this.criterias}, + sorting : {sortBy: this.sorting.sortBy, reversed: this.sorting.reverse}, + orderByCriteria : this.orderByCriteria + }); + }; + + GetListRequest.prototype.DTOForVessel = function(){ + //Add * to all text searches for vessel + var wildcardSearchKeys = ['NAME', 'IRCS', 'CFR', 'EXTERNAL_MARKING', 'HOMEPORT', 'IMO', 'PRODUCER_NAME', 'PRODUCER_CODE', 'CONTACT_NAME', 'CONTACT_NUMBER', 'CONTACT_EMAIL', 'MMSI']; + var updatedCriterias = [], + searchFieldKey, searchFieldValue; + + $.each(this.criterias, function(index, searchField){ + searchFieldKey = searchField.key; + searchFieldValue = searchField.value; + //Add * to the end of the search value? + if(wildcardSearchKeys.indexOf(searchFieldKey) >= 0){ + if(typeof searchFieldValue === 'string' && searchFieldValue.charAt(searchFieldValue.length -1)){ + searchFieldValue = searchFieldValue +'*'; + } + + } + updatedCriterias.push(new SearchField(searchFieldKey, searchFieldValue)); + }); + + var DTOForVessel = { + pagination : {page: this.page, listSize: this.listSize}, + assetSearchCriteria : { isDynamic : this.isDynamic, criterias : updatedCriterias }, + }; + + if(this.orderByCriteria && this.orderByCriteria.orderByParam){ + DTOForVessel.orderByCriteria = this.orderByCriteria; + } + + return DTOForVessel; + }; + + GetListRequest.prototype.DTOForMobileTerminal = function(){ + var wildcardKeys = ['NAME', 'IRCS', 'EXTERNAL_MARKING', 'CFR', 'HOMEPORT', 'MMSI', 'SERIAL_NUMBER', 'DNID', 'SATELLITE_NUMBER', 'MEMBER_NUMBER']; + var criteria = this.criterias.map(function(criteria) { + if (wildcardKeys.indexOf(criteria.key) >= 0) { + return new SearchField(criteria.key, criteria.value + '*'); + } + else { + return criteria; + } + }); + + return { + pagination : {page: this.page, listSize: this.listSize}, + mobileTerminalSearchCriteria : {isDynamic: this.isDynamic, criterias: criteria} + }; + }; + + GetListRequest.prototype.DTOForPoll = function(){ + return { + pagination : {page: this.page, listSize: this.listSize}, + pollSearchCriteria : {isDynamic: this.isDynamic, criterias: this.criterias} + }; + }; + + GetListRequest.prototype.DTOForMovement = function(){ + + //List of search fields that should be in the movementRangeSearchCriteria object + //Ranges must include both from and to, so that's what the defaultValues are for + var ranges = [ + { + key : 'DATE', + from : {searchKey: 'FROM_DATE', defaultValue: '1970-01-01 00:00:00 +00:00'}, + to : {searchKey: 'TO_DATE', defaultValue: '2070-01-01 00:00:00 +00:00'} + }, + { + key: 'MOVEMENT_SPEED', + from : {searchKey: 'SPEED_MIN', defaultValue: 0}, + to : {searchKey: 'SPEED_MAX', defaultValue: 99999999} + } + ]; + + //Get a range by the search key + function getRangeBySearchKey(key){ + var range; + $.each(ranges, function(i, aRange){ + if(key === aRange.from.searchKey || key === aRange.to.searchKey){ + range = aRange; + return false; + } + }); + return range; + } + + var rangeCriterias = {}; + var criterias = []; + + //Build dict with rangeCriterias + var searchFieldKey, searchFieldValue, range; + $.each(this.criterias, function(index, searchField){ + searchFieldKey = searchField.key; + searchFieldValue = searchField.value; + + //Range search? + range = getRangeBySearchKey(searchFieldKey); + if(range){ + if(angular.isUndefined(rangeCriterias[range.key])){ + rangeCriterias[range.key] = { + from : range.from.defaultValue, + to : range.to.defaultValue, + }; + } + if(searchFieldKey === range.from.searchKey){ + rangeCriterias[range.key]['from'] = searchFieldValue; + } + else{ + rangeCriterias[range.key]['to'] = searchFieldValue; + } + }else{ + criterias.push(searchField); + } + }); + + //Make rangeCriterias a list + var rangeCriteriasList = []; + $.each(rangeCriterias, function(key, value){ + value['key'] = key; + rangeCriteriasList.push(value); + }); + + return { + movementRangeSearchCriteria : rangeCriteriasList, + movementSearchCriteria : criterias, + pagination : {page: this.page, listSize: this.listSize} + }; + }; + + GetListRequest.prototype.mapOrderByParam = function (orderByParam){ + var orderByParamMap = { + name: "NAME", + externalMarking: "EXTERNAL_MARKING", + countryCode: "FLAG_STATE", + ircs: "IRCS", + cfr: "CFR", + gearType: "GEAR_TYPE", + licenseType: "LICENSE_TYPE" + }; + return orderByParamMap[orderByParam]; + }; + + GetListRequest.prototype.DTOForManualPosition = function(){ + return { + movementSearchCriteria : this.criterias, + pagination : {page: this.page, listSize: this.listSize} + }; + }; + + GetListRequest.prototype.DTOForAuditLogList = function() { + return { + auditSearchCriteria: this.criterias, + pagination: {page: this.page, listSize: this.listSize} + }; + }; + + GetListRequest.prototype.DTOForExchangeMessageList = function(){ + return{ + exchangeSearchCriteria : {criterias: this.criterias, isDynamic: false}, + pagination: {page: this.page, listSize: this.listSize}, + sorting: this.sorting + }; + }; + + GetListRequest.prototype.DTOForExchangePollList = function(){ + var fromDateSearchField = this.getCriteria('FROM_DATE'); + var toDateSearchField = this.getCriteria('TO_DATE'); + var statusSearchField = this.getCriteria('STATUS'); + + var searchObj = {}; + if(fromDateSearchField){ + searchObj.statusFromDate = fromDateSearchField.value; + } + if(toDateSearchField){ + searchObj.statusToDate = toDateSearchField.value; + } + if(statusSearchField){ + searchObj.status = statusSearchField.value; + } + return searchObj; + }; + + + GetListRequest.prototype.DTOForAlarms = function(){ + return{ + alarmSearchCriteria : this.criterias, + pagination: {page: this.page, listSize: this.listSize}, + dynamic: this.isDynamic + }; + }; + + GetListRequest.prototype.DTOForTickets = function(){ + return{ + ticketSearchCriteria : this.criterias, + pagination: {page: this.page, listSize: this.listSize} + }; + }; + + GetListRequest.prototype.DTOForRules = function(){ + return{ + customRuleSearchCriteria : this.criterias, + pagination: {page: this.page, listSize: this.listSize} + }; + }; + + GetListRequest.prototype.setPage = function(newPage){ + this.page = newPage; + return this.page; + }; + + GetListRequest.prototype.addSearchCriteria = function(key, value){ + var alreadyExists = false; + + //Only add if it doesnt already exists + $.each(this.criterias, function(index, crit){ + if(key === crit.key && value === crit.value){ + alreadyExists = true; + return false; + } + }); + if(!alreadyExists){ + this.criterias.push(new SearchField(key, value)); + } + }; + + GetListRequest.prototype.addOrderByCriteria = function(orderByParam, isOrderByDescOrder){ + this.removeOrderByCriteria(); + this.orderByCriteria = {orderByParam: this.mapOrderByParam(orderByParam), isOrderByDescOrder: isOrderByDescOrder}; + }; + + GetListRequest.prototype.removeOrderByCriteria = function() { + delete this.orderByCriteria; + }; + + //Removes criterias with the specified key + GetListRequest.prototype.removeSearchCriteria = function(key){ + var idxToRemove = []; + $.each(this.criterias, function(index, crit){ + if(key === crit.key){ + idxToRemove.push(index); + } + }); + + //Remove criterias + for (var i = idxToRemove.length - 1; i >= 0; i--) { + this.criterias.splice(idxToRemove[i],1); + } + }; + + GetListRequest.prototype.getCriteria = function(criteria){ + var found; + $.each(this.criterias, function(i, searchField){ + if(searchField.key === criteria){ + found = searchField; + return false; + } + }); + return found; + }; + + GetListRequest.prototype.setSearchCriterias = function(criterias){ + this.criterias = criterias; + }; + + GetListRequest.prototype.resetCriterias = function(){ + this.criterias = []; + }; + + GetListRequest.prototype.setDynamic = function(dynamic){ + this.isDynamic = dynamic; + }; + + GetListRequest.prototype.setDynamicToFalse = function(){ + this.isDynamic = false; + }; + + GetListRequest.prototype.setDynamicToTrue = function(){ + this.isDynamic = true; + }; + + GetListRequest.prototype.getNumberOfSearchCriterias = function(){ + return this.criterias.length; + }; + + GetListRequest.prototype.copy = function(){ + var copy = new GetListRequest(); + copy.page = this.page; + copy.listSize = this.listSize; + copy.isDynamic = this.isDynamic; + copy.criterias = []; + copy.sorting = this.sorting; + + $.each(this.criterias, function(index, searchField){ + copy.criterias.push(searchField.copy()); + }); + return copy; + }; + + return GetListRequest; +}); diff --git a/unionvms-web/app/service/common/searchService.js b/unionvms-web/app/service/common/searchService.js index 48dd1b43b..be744a729 100644 --- a/unionvms-web/app/service/common/searchService.js +++ b/unionvms-web/app/service/common/searchService.js @@ -307,7 +307,7 @@ angular.module('unionvmsWeb').factory('searchService',function($q, $log, searchU } var deferred = $q.defer(), - getListRequestAllItems = new GetListRequest(pageNum, DEFAULT_ITEMS_PER_PAGE, getListRequest.isDynamic, getListRequest.criterias); + getListRequestAllItems = new GetListRequest(pageNum, DEFAULT_ITEMS_PER_PAGE, getListRequest.isDynamic, getListRequest.criterias, undefined, getListRequest.orderByCriteria); searchUtilsService.modifySpanAndTimeZones(getListRequest.criterias); searchUtilsService.replaceCommasWithPoint(getListRequest.criterias); @@ -750,9 +750,16 @@ angular.module('unionvmsWeb').factory('searchService',function($q, $log, searchU addSearchCriteria : function(key, value){ getListRequest.addSearchCriteria(key, value); }, + addOrderByCriteria : function(orderByParam, isOrderByDescOrder){ + getListRequest.addOrderByCriteria(orderByParam, isOrderByDescOrder); + }, removeSearchCriteria : function(key){ getListRequest.removeSearchCriteria(key); }, + removeOrderByCriteria : function(){ + getListRequest.removeOrderByCriteria(); + }, + hasSearchCriteria: function(key) { for (var i = 0; i < getListRequest.criterias.length; i++) { var searchField = getListRequest.criterias[i]; From 99cc667d1aaf26fcacf72a3b2969c9ba93f2db5f Mon Sep 17 00:00:00 2001 From: gmanifavas Date: Fri, 20 Nov 2020 16:22:06 +0200 Subject: [PATCH 31/33] [UNIONVMS-4541] Apply sorting to all pages in assets list. --- unionvms-web/app/partial/vessel/vessel.js | 10 +- .../partial/vessel/vesselList/vesselList.js | 156 +++++++++--------- 2 files changed, 86 insertions(+), 80 deletions(-) diff --git a/unionvms-web/app/partial/vessel/vessel.js b/unionvms-web/app/partial/vessel/vessel.js index 8d759d46d..4a788f5bd 100644 --- a/unionvms-web/app/partial/vessel/vessel.js +++ b/unionvms-web/app/partial/vessel/vessel.js @@ -96,7 +96,7 @@ angular.module('unionvmsWeb').controller('VesselCtrl', function($scope, $log, $s $scope.currentSearchResults.filter = ''; $scope.currentSearchResults.setLoading(true); searchService.searchVessels(page) - .then(updateSearchResults, onGetSearchResultsError).finally(searchService.removeOrderByCriteria); + .then(updateSearchResults, onGetSearchResultsError); var timeoutDisplayNotificationCancelSearch = 3000; $timeout(function(){ @@ -141,9 +141,11 @@ angular.module('unionvmsWeb').controller('VesselCtrl', function($scope, $log, $s $scope.stTable.tableState.pagination.numberOfPages = vesselListPage.totalNumberOfPages; }; - $scope.sortTableData = function(predicate, reverse){ - searchService.addOrderByCriteria(predicate, reverse); - $scope.searchVessels(); + $scope.sortTableData = function(predicate, reverse, options, page){ + if(angular.isDefined(predicate) && angular.isDefined(reverse)) { + searchService.addOrderByCriteria(predicate, reverse); + } + $scope.searchVessels(options, page); }; // Handle error from search results (listing vessel) diff --git a/unionvms-web/app/partial/vessel/vesselList/vesselList.js b/unionvms-web/app/partial/vessel/vesselList/vesselList.js index 6fc7b6a11..f8743b10d 100644 --- a/unionvms-web/app/partial/vessel/vesselList/vesselList.js +++ b/unionvms-web/app/partial/vessel/vesselList/vesselList.js @@ -1,77 +1,81 @@ -/* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . - */ -angular.module('unionvmsWeb').controller('VesselListCtrl',function($scope){ - - //Handle click on the top "check all" checkbox - $scope.checkAll = function(){ - if($scope.isAllChecked()){ - //Remove all - $scope.clearSelection(); - }else{ - //Add all - $scope.clearSelection(); - $.each($scope.currentSearchResults.items, function(index, item) { - $scope.addToSelection(item); - }); - } - }; - - $scope.checkItem = function(item){ - item.Selected = !item.Selected; - if($scope.isChecked(item)){ - //Remove - $scope.removeFromSelection(item); - }else{ - $scope.addToSelection(item); - } - }; - - $scope.isAllChecked = function(){ - if(angular.isUndefined($scope.currentSearchResults.items) || $scope.selectedVessels.length === 0){ - return false; - } - - var allChecked = true; - $.each($scope.currentSearchResults.items, function(index, item) { - if(!$scope.isChecked(item)){ - allChecked = false; - return false; - } - }); - return allChecked; - }; - - $scope.isChecked = function(item){ - var checked = false; - $.each($scope.selectedVessels, function(index, vessel){ - if(vessel.equals(item)){ - checked = true; - return false; - } - }); - return checked; - }; - - $scope.tableCallback = function(tableState){ - $scope.stTable.tableState = tableState; - var pageNumber = $scope.stTable.tableState.pagination.start / $scope.stTable.itemsByPage; - - if (angular.isDefined($scope.stTable.page) && pageNumber + 1 !== $scope.stTable.page){ - $scope.stTable.page = pageNumber + 1; - $scope.searchVessels(undefined, $scope.stTable.page); - } else { - if (angular.isDefined(tableState.sort.predicate) && angular.isDefined($scope.currentSearchResultsByPage) && $scope.currentSearchResultsByPage.length > 0){ - $scope.sortTableData(tableState.sort.predicate, tableState.sort.reverse); - } - } - }; +/* +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . + */ +angular.module('unionvmsWeb').controller('VesselListCtrl',function($scope){ + + //Handle click on the top "check all" checkbox + $scope.checkAll = function(){ + if($scope.isAllChecked()){ + //Remove all + $scope.clearSelection(); + }else{ + //Add all + $scope.clearSelection(); + $.each($scope.currentSearchResults.items, function(index, item) { + $scope.addToSelection(item); + }); + } + }; + + $scope.checkItem = function(item){ + item.Selected = !item.Selected; + if($scope.isChecked(item)){ + //Remove + $scope.removeFromSelection(item); + }else{ + $scope.addToSelection(item); + } + }; + + $scope.isAllChecked = function(){ + if(angular.isUndefined($scope.currentSearchResults.items) || $scope.selectedVessels.length === 0){ + return false; + } + + var allChecked = true; + $.each($scope.currentSearchResults.items, function(index, item) { + if(!$scope.isChecked(item)){ + allChecked = false; + return false; + } + }); + return allChecked; + }; + + $scope.isChecked = function(item){ + var checked = false; + $.each($scope.selectedVessels, function(index, vessel){ + if(vessel.equals(item)){ + checked = true; + return false; + } + }); + return checked; + }; + + $scope.tableCallback = function(tableState){ + $scope.stTable.tableState = tableState; + var pageNumber = $scope.stTable.tableState.pagination.start / $scope.stTable.itemsByPage; + var predicate = undefined; + var reverse = undefined; + var options = undefined; + var page = undefined; + if (angular.isDefined($scope.stTable.page) && pageNumber + 1 !== $scope.stTable.page){ + $scope.stTable.page = pageNumber + 1; + page = $scope.stTable.page; + } + if (angular.isDefined(tableState.sort.predicate) && angular.isDefined($scope.currentSearchResultsByPage) && $scope.currentSearchResultsByPage.length > 0){ + predicate = tableState.sort.predicate; + reverse = tableState.sort.reverse; + } + $scope.sortTableData(predicate, reverse, options, page); + }; }); \ No newline at end of file From 44fd98c4c6cac902b7dbced33553cbb7cbb9cdaa Mon Sep 17 00:00:00 2001 From: cpapatheodorou Date: Tue, 24 Nov 2020 14:09:41 +0200 Subject: [PATCH 32/33] [UNIONVMS-4921] Add platform version at the footer and module version column at the admin configuration page --- unionvms-web/app/i18n/bg-bg/audit.lang.json | 1 + unionvms-web/app/i18n/cs-cz/audit.lang.json | 1 + unionvms-web/app/i18n/da-dk/audit.lang.json | 1 + unionvms-web/app/i18n/de-at/audit.lang.json | 1 + unionvms-web/app/i18n/de-de/audit.lang.json | 1 + unionvms-web/app/i18n/de-lu/audit.lang.json | 1 + unionvms-web/app/i18n/el-cy/audit.lang.json | 1 + unionvms-web/app/i18n/el-gr/audit.lang.json | 1 + unionvms-web/app/i18n/en-gb/audit.lang.json | 1 + unionvms-web/app/i18n/en-ie/audit.lang.json | 1 + unionvms-web/app/i18n/es-es/audit.lang.json | 1 + unionvms-web/app/i18n/fi-fi/audit.lang.json | 1 + unionvms-web/app/i18n/fr-fr/audit.lang.json | 1 + unionvms-web/app/i18n/fr-lu/audit.lang.json | 1 + unionvms-web/app/i18n/hr-hr/audit.lang.json | 1 + unionvms-web/app/i18n/hu-hu/audit.lang.json | 1 + unionvms-web/app/i18n/im-im/audit.lang.json | 1 + unionvms-web/app/i18n/it-it/audit.lang.json | 1 + unionvms-web/app/i18n/lt-lt/audit.lang.json | 1 + unionvms-web/app/i18n/lv-lv/audit.lang.json | 1 + unionvms-web/app/i18n/mt/audit.lang.json | 1 + unionvms-web/app/i18n/nl-be/audit.lang.json | 1 + unionvms-web/app/i18n/nl-nl/audit.lang.json | 1 + unionvms-web/app/i18n/nl/audit.lang.json | 1 + unionvms-web/app/i18n/pl/audit.lang.json | 1 + unionvms-web/app/i18n/pt-pt/audit.lang.json | 1 + unionvms-web/app/i18n/ro-ro/audit.lang.json | 1 + unionvms-web/app/i18n/si-si/audit.lang.json | 1 + unionvms-web/app/i18n/sk-sk/audit.lang.json | 1 + unionvms-web/app/i18n/sv/audit.lang.json | 1 + unionvms-web/app/i18n/tr-cy/audit.lang.json | 1 + .../configurationModule/systemMonitor.html | 82 ++++++++++--------- .../configurationModule/systemMonitor.js | 63 +++++++------- unionvms-web/app/partial/footer/footer.html | 36 ++++---- unionvms-web/app/partial/footer/footer.js | 35 ++++---- 35 files changed, 146 insertions(+), 101 deletions(-) diff --git a/unionvms-web/app/i18n/bg-bg/audit.lang.json b/unionvms-web/app/i18n/bg-bg/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/bg-bg/audit.lang.json +++ b/unionvms-web/app/i18n/bg-bg/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/cs-cz/audit.lang.json b/unionvms-web/app/i18n/cs-cz/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/cs-cz/audit.lang.json +++ b/unionvms-web/app/i18n/cs-cz/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/da-dk/audit.lang.json b/unionvms-web/app/i18n/da-dk/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/da-dk/audit.lang.json +++ b/unionvms-web/app/i18n/da-dk/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/de-at/audit.lang.json b/unionvms-web/app/i18n/de-at/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/de-at/audit.lang.json +++ b/unionvms-web/app/i18n/de-at/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/de-de/audit.lang.json b/unionvms-web/app/i18n/de-de/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/de-de/audit.lang.json +++ b/unionvms-web/app/i18n/de-de/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/de-lu/audit.lang.json b/unionvms-web/app/i18n/de-lu/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/de-lu/audit.lang.json +++ b/unionvms-web/app/i18n/de-lu/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/el-cy/audit.lang.json b/unionvms-web/app/i18n/el-cy/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/el-cy/audit.lang.json +++ b/unionvms-web/app/i18n/el-cy/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/el-gr/audit.lang.json b/unionvms-web/app/i18n/el-gr/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/el-gr/audit.lang.json +++ b/unionvms-web/app/i18n/el-gr/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/en-gb/audit.lang.json b/unionvms-web/app/i18n/en-gb/audit.lang.json index 8bea9ba46..f49b1a24f 100644 --- a/unionvms-web/app/i18n/en-gb/audit.lang.json +++ b/unionvms-web/app/i18n/en-gb/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_activity": "Activity", "system_status_module_audit": "Audit", diff --git a/unionvms-web/app/i18n/en-ie/audit.lang.json b/unionvms-web/app/i18n/en-ie/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/en-ie/audit.lang.json +++ b/unionvms-web/app/i18n/en-ie/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/es-es/audit.lang.json b/unionvms-web/app/i18n/es-es/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/es-es/audit.lang.json +++ b/unionvms-web/app/i18n/es-es/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/fi-fi/audit.lang.json b/unionvms-web/app/i18n/fi-fi/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/fi-fi/audit.lang.json +++ b/unionvms-web/app/i18n/fi-fi/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/fr-fr/audit.lang.json b/unionvms-web/app/i18n/fr-fr/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/fr-fr/audit.lang.json +++ b/unionvms-web/app/i18n/fr-fr/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/fr-lu/audit.lang.json b/unionvms-web/app/i18n/fr-lu/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/fr-lu/audit.lang.json +++ b/unionvms-web/app/i18n/fr-lu/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/hr-hr/audit.lang.json b/unionvms-web/app/i18n/hr-hr/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/hr-hr/audit.lang.json +++ b/unionvms-web/app/i18n/hr-hr/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/hu-hu/audit.lang.json b/unionvms-web/app/i18n/hu-hu/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/hu-hu/audit.lang.json +++ b/unionvms-web/app/i18n/hu-hu/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/im-im/audit.lang.json b/unionvms-web/app/i18n/im-im/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/im-im/audit.lang.json +++ b/unionvms-web/app/i18n/im-im/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/it-it/audit.lang.json b/unionvms-web/app/i18n/it-it/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/it-it/audit.lang.json +++ b/unionvms-web/app/i18n/it-it/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/lt-lt/audit.lang.json b/unionvms-web/app/i18n/lt-lt/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/lt-lt/audit.lang.json +++ b/unionvms-web/app/i18n/lt-lt/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/lv-lv/audit.lang.json b/unionvms-web/app/i18n/lv-lv/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/lv-lv/audit.lang.json +++ b/unionvms-web/app/i18n/lv-lv/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/mt/audit.lang.json b/unionvms-web/app/i18n/mt/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/mt/audit.lang.json +++ b/unionvms-web/app/i18n/mt/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/nl-be/audit.lang.json b/unionvms-web/app/i18n/nl-be/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/nl-be/audit.lang.json +++ b/unionvms-web/app/i18n/nl-be/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/nl-nl/audit.lang.json b/unionvms-web/app/i18n/nl-nl/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/nl-nl/audit.lang.json +++ b/unionvms-web/app/i18n/nl-nl/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/nl/audit.lang.json b/unionvms-web/app/i18n/nl/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/nl/audit.lang.json +++ b/unionvms-web/app/i18n/nl/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/pl/audit.lang.json b/unionvms-web/app/i18n/pl/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/pl/audit.lang.json +++ b/unionvms-web/app/i18n/pl/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/pt-pt/audit.lang.json b/unionvms-web/app/i18n/pt-pt/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/pt-pt/audit.lang.json +++ b/unionvms-web/app/i18n/pt-pt/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/ro-ro/audit.lang.json b/unionvms-web/app/i18n/ro-ro/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/ro-ro/audit.lang.json +++ b/unionvms-web/app/i18n/ro-ro/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/si-si/audit.lang.json b/unionvms-web/app/i18n/si-si/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/si-si/audit.lang.json +++ b/unionvms-web/app/i18n/si-si/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/sk-sk/audit.lang.json b/unionvms-web/app/i18n/sk-sk/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/sk-sk/audit.lang.json +++ b/unionvms-web/app/i18n/sk-sk/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/sv/audit.lang.json b/unionvms-web/app/i18n/sv/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/sv/audit.lang.json +++ b/unionvms-web/app/i18n/sv/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/i18n/tr-cy/audit.lang.json b/unionvms-web/app/i18n/tr-cy/audit.lang.json index 6e6abd96d..f0ba0c45d 100644 --- a/unionvms-web/app/i18n/tr-cy/audit.lang.json +++ b/unionvms-web/app/i18n/tr-cy/audit.lang.json @@ -78,6 +78,7 @@ "system_status_name": "System name", "system_status_online_timestamp": "Date", + "system_status_version": "Version", "system_status_module_audit": "Audit", "system_status_module_exchange": "Exchange", diff --git a/unionvms-web/app/partial/admin/adminConfiguration/configurationModule/systemMonitor.html b/unionvms-web/app/partial/admin/adminConfiguration/configurationModule/systemMonitor.html index 0568ff680..63048edae 100644 --- a/unionvms-web/app/partial/admin/adminConfiguration/configurationModule/systemMonitor.html +++ b/unionvms-web/app/partial/admin/adminConfiguration/configurationModule/systemMonitor.html @@ -1,39 +1,43 @@ - -
-
- - - - - - - - - - - - - - - -
- {{ "audit.system_status_name" | i18n }} - - {{ "audit.system_status_online_timestamp" | i18n }} -
- - {{ statusLabel(status) | i18n | uppercase }} - - {{ "audit.system_status_module_" + system | i18n }}{{ status.lastPing | confDateFormat }}
-
-
\ No newline at end of file + +
+
+ + + + + + + + + + + + + + + + + +
+ {{ "audit.system_status_name" | i18n }} + + {{ "audit.system_status_version" | i18n }} + + {{ "audit.system_status_online_timestamp" | i18n }} +
+ + {{ statusLabel(status) | i18n | uppercase }} + + {{ "audit.system_status_module_" + system | i18n }}{{ platformVersionData[system] }}{{ status.lastPing | confDateFormat }}
+
+
diff --git a/unionvms-web/app/partial/admin/adminConfiguration/configurationModule/systemMonitor.js b/unionvms-web/app/partial/admin/adminConfiguration/configurationModule/systemMonitor.js index 3022502c5..4365c22e1 100644 --- a/unionvms-web/app/partial/admin/adminConfiguration/configurationModule/systemMonitor.js +++ b/unionvms-web/app/partial/admin/adminConfiguration/configurationModule/systemMonitor.js @@ -1,29 +1,34 @@ -/* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . - */ -angular.module('unionvmsWeb').controller('SystemMonitorController', function($scope, $resource, locale) { - - $scope.searchResults = { - loading: true, - zeroResultsErrorMessage: locale.getString('config.no_pings_message') - }; - - $resource("config/rest/pings").get(function(response) { - $scope.searchResults.loading = false; - $scope.searchResults.items = response.data; - $scope.searchResults.showZeroResultsMessage = Object.keys(response.data).length === 0; - }); - - $scope.statusLabel = function(status) { - return status.online ? 'config.online' : 'config.offline'; - }; - -}); \ No newline at end of file +/* +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . + */ +angular.module('unionvmsWeb').controller('SystemMonitorController', function($scope, $resource, locale) { + + $scope.searchResults = { + loading: true, + zeroResultsErrorMessage: locale.getString('config.no_pings_message') + }; + $scope.platformVersionData = {} + + $resource("config/rest/pings").get(function(response) { + $scope.searchResults.loading = false; + $scope.searchResults.items = response.data; + $scope.searchResults.showZeroResultsMessage = Object.keys(response.data).length === 0; + }); + + $resource("config/rest/module/all").get(function(response) { + $scope.platformVersionData = response.data.modules; + }); + + $scope.statusLabel = function(status) { + return status.online ? 'config.online' : 'config.offline'; + }; + +}); diff --git a/unionvms-web/app/partial/footer/footer.html b/unionvms-web/app/partial/footer/footer.html index 82ac82458..6a851e116 100644 --- a/unionvms-web/app/partial/footer/footer.html +++ b/unionvms-web/app/partial/footer/footer.html @@ -1,18 +1,18 @@ - -
-
-
-

© {{fullYear}} UnionVMS - {{envName}}(REST API URL: {{apiURL}})

-
-
-
\ No newline at end of file + +
+
+
+

© {{fullYear}} UnionVMS - {{envName}}(REST API URL: {{apiURL}}) - Platform version: {{platformVersion}}

+
+
+
diff --git a/unionvms-web/app/partial/footer/footer.js b/unionvms-web/app/partial/footer/footer.js index d9bc4fc2f..811884af2 100644 --- a/unionvms-web/app/partial/footer/footer.js +++ b/unionvms-web/app/partial/footer/footer.js @@ -1,16 +1,21 @@ /* -Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries -© European Union, 2015-2016. - -This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can -redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in -the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a -copy of the GNU General Public License along with the IFDM Suite. If not, see . - */ -angular.module('unionvmsWeb').controller('FooterCtrl',function($scope, envConfig){ - $scope.envName = envConfig.env_name; - $scope.apiURL = envConfig.rest_api_base; - $scope.fullYear = new Date().getFullYear(); -}); \ No newline at end of file +Developed with the contribution of the European Commission - Directorate General for Maritime Affairs and Fisheries +© European Union, 2015-2016. + +This file is part of the Integrated Fisheries Data Management (IFDM) Suite. The IFDM Suite is free software: you can +redistribute it and/or modify it under the terms of the GNU General Public License as published by the +Free Software Foundation, either version 3 of the License, or any later version. The IFDM Suite is distributed in +the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a +copy of the GNU General Public License along with the IFDM Suite. If not, see . + */ +angular.module('unionvmsWeb').controller('FooterCtrl',function($scope, $resource, envConfig){ + $scope.envName = envConfig.env_name; + $scope.apiURL = envConfig.rest_api_base; + $scope.fullYear = new Date().getFullYear(); + $scope.platformVersion = "" + + $resource("config/rest/module/all").get(function(response) { + $scope.platformVersion = response.data.platformVersion; + }); +}); From 8ce3541fb458b622b9c2ef35d4c8fa943b086e07 Mon Sep 17 00:00:00 2001 From: PROTOPAPAS Thanasis Date: Fri, 4 Dec 2020 18:04:27 +0200 Subject: [PATCH 33/33] [UNIONVMS-4921] add footer for angular 9 --- .../core/main/footer/footer.component.html | 6 +++++ .../core/main/footer/footer.component.scss | 15 ++++++++++++ .../app/core/main/footer/footer.component.ts | 23 +++++++++++++++++++ .../angular/app/core/main/main-endpoints.ts | 1 + .../angular/app/core/main/main.component.html | 1 + .../src/angular/app/core/main/main.module.ts | 7 +++--- .../src/angular/app/core/main/main.service.ts | 6 ++++- 7 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 unionvms-web-2/src/angular/app/core/main/footer/footer.component.html create mode 100644 unionvms-web-2/src/angular/app/core/main/footer/footer.component.scss create mode 100644 unionvms-web-2/src/angular/app/core/main/footer/footer.component.ts diff --git a/unionvms-web-2/src/angular/app/core/main/footer/footer.component.html b/unionvms-web-2/src/angular/app/core/main/footer/footer.component.html new file mode 100644 index 000000000..57dfd5d22 --- /dev/null +++ b/unionvms-web-2/src/angular/app/core/main/footer/footer.component.html @@ -0,0 +1,6 @@ +
+
+

Platform version: {{platformVersion}}

+
+
+ diff --git a/unionvms-web-2/src/angular/app/core/main/footer/footer.component.scss b/unionvms-web-2/src/angular/app/core/main/footer/footer.component.scss new file mode 100644 index 000000000..ed21e498d --- /dev/null +++ b/unionvms-web-2/src/angular/app/core/main/footer/footer.component.scss @@ -0,0 +1,15 @@ +footer { + bottom: 0; + background-color: #ecf0f1; + color: white; + width: 100%; + padding-top: 4px; + margin-top: 100px; + min-width: 992px; + border-top: 1px solid #dddddd; + p { + margin-bottom: 5px; + font-size: 13px; + color: #666666; + } +} diff --git a/unionvms-web-2/src/angular/app/core/main/footer/footer.component.ts b/unionvms-web-2/src/angular/app/core/main/footer/footer.component.ts new file mode 100644 index 000000000..26c0d0647 --- /dev/null +++ b/unionvms-web-2/src/angular/app/core/main/footer/footer.component.ts @@ -0,0 +1,23 @@ +import { Component, OnInit } from '@angular/core'; +import { MainService } from './../main.service'; + +@Component({ + selector: 'app-footer', + templateUrl: './footer.component.html', + styleUrls: ['./footer.component.scss'] +}) + +export class FooterComponent implements OnInit { + platformVersion: string; + constructor(private mainService: MainService) { } + + ngOnInit() { + this.updatePlatformDependencies(); + } + + async updatePlatformDependencies() { + const result: any = await this.mainService.getPlatformVersion(); + this.platformVersion = result.data.platformVersion; + } + +} diff --git a/unionvms-web-2/src/angular/app/core/main/main-endpoints.ts b/unionvms-web-2/src/angular/app/core/main/main-endpoints.ts index f3a31137d..3ac1260fc 100644 --- a/unionvms-web-2/src/angular/app/core/main/main-endpoints.ts +++ b/unionvms-web-2/src/angular/app/core/main/main-endpoints.ts @@ -1,4 +1,5 @@ export const MAIN_ENDPOINTS = { countOpenAlarms: '/rules/rest/alarms/countopen', countUserOpenTickets: '/rules/rest/tickets/countopen', + getPlatformVersion: '/config/rest/module/all' }; diff --git a/unionvms-web-2/src/angular/app/core/main/main.component.html b/unionvms-web-2/src/angular/app/core/main/main.component.html index f80bd1891..455b678e9 100644 --- a/unionvms-web-2/src/angular/app/core/main/main.component.html +++ b/unionvms-web-2/src/angular/app/core/main/main.component.html @@ -2,4 +2,5 @@
+
diff --git a/unionvms-web-2/src/angular/app/core/main/main.module.ts b/unionvms-web-2/src/angular/app/core/main/main.module.ts index 429397ea4..ed0e49839 100644 --- a/unionvms-web-2/src/angular/app/core/main/main.module.ts +++ b/unionvms-web-2/src/angular/app/core/main/main.module.ts @@ -5,16 +5,15 @@ import { SharedModule } from '../../shared/shared.module'; import { MainRoutingModule } from './main-routing.module'; import { HeaderComponent } from './header/header.component'; import { NavigationComponent } from './navigation/navigation.component'; - - - +import { FooterComponent } from './footer/footer.component' @NgModule({ declarations: [ MainComponent, HeaderComponent, NavigationComponent, - ClockComponent + ClockComponent, + FooterComponent ], imports: [ SharedModule, diff --git a/unionvms-web-2/src/angular/app/core/main/main.service.ts b/unionvms-web-2/src/angular/app/core/main/main.service.ts index aa4c25143..6ecdb58ed 100644 --- a/unionvms-web-2/src/angular/app/core/main/main.service.ts +++ b/unionvms-web-2/src/angular/app/core/main/main.service.ts @@ -5,7 +5,6 @@ import { HttpClient } from '@angular/common/http'; import { environment } from '../../../environments/environment'; import { ResponseDto } from 'app/features/features.model'; - // provide in main module? @Injectable({ providedIn: 'root', @@ -21,4 +20,9 @@ export class MainService { countUserOpenTickets(username): Promise> { return this.http.get>(`${environment.baseURL}${MAIN_ENDPOINTS.countUserOpenTickets}/${username}`).toPromise(); } + + async getPlatformVersion() { + return this.http.get(`${environment.baseURL}${MAIN_ENDPOINTS.getPlatformVersion}`).toPromise(); + } + }