Skip to content
Permalink
Browse files

Rename config_parser to compositions.layerParser module

  • Loading branch information...
raitisbe committed Jul 20, 2019
1 parent 888cc47 commit fd031a744de5f257b3cc540c7124467738546cf9
@@ -1,10 +1,9 @@
import { transform } from 'ol/proj';
import 'hs.source.SparqlJson'
import 'angular-socialshare';
import './config-parsers.module';

export default ['hs.map.service', 'config', 'Core', '$rootScope', '$http', 'hs.utils.service', 'hs.compositions.config_parsers.service',
function (hsMap, config, Core, $rootScope, $http, utils, configParsers) {
export default ['hs.map.service', 'config', 'Core', '$rootScope', '$http', 'hs.utils.service', 'hs.compositions.layerParserService',
function (hsMap, config, Core, $rootScope, $http, utils, layerParserService) {
var me = {
/**
* @ngdoc property
@@ -118,6 +117,7 @@ export default ['hs.map.service', 'config', 'Core', '$rootScope', '$http', 'hs.u
}
$rootScope.$broadcast('compositions.composition_loaded', respError);
},

/**
* @ngdoc method
* @name hs.compositions.service_parser#removeCompositionLayers
@@ -171,6 +171,7 @@ export default ['hs.map.service', 'config', 'Core', '$rootScope', '$http', 'hs.u
second_pair = transform(second_pair, 'EPSG:4326', hsMap.map.getView().getProjection());
return [first_pair[0], first_pair[1], second_pair[0], second_pair[1]];
},

/**
* @ngdoc method
* @name hs.compositions.service_parser#jsonToLayers
@@ -187,27 +188,28 @@ export default ['hs.map.service', 'config', 'Core', '$rootScope', '$http', 'hs.u
layers.push(me.jsonToLayer(lyr_def));
}
return layers;
},

/**
* @ngdoc method
* @name hs.compositions.service_parser#jsonToLayer
* @public
* @param {Object} lyr_def Layer to be created (encapsulated in layer definition object)
* @returns {Function} Parser function to create layer (using config_parsers service)
* @description Select correct layer parser for input data based on layer "className" property (HSLayers.Layer.WMS/OpenLayers.Layer.Vector)
*/
jsonToLayer: function (lyr_def) {
switch (lyr_def.className) {
case "HSLayers.Layer.WMS":
return layerParserService.createWmsLayer(lyr_def);
break;
case 'OpenLayers.Layer.Vector':
return layerParserService.createVectorLayer(lyr_def);
break;
}
}
};

/**
* @ngdoc method
* @name hs.compositions.service_parser#jsonToLayer
* @public
* @param {Object} lyr_def Layer to be created (encapsulated in layer definition object)
* @returns {Function} Parser function to create layer (using config_parsers service)
* @description Select correct layer parser for input data based on layer "className" property (HSLayers.Layer.WMS/OpenLayers.Layer.Vector)
*/
me.jsonToLayer = function (lyr_def) {
switch (lyr_def.className) {
case "HSLayers.Layer.WMS":
return configParsers.createWmsLayer(lyr_def);
break;
case 'OpenLayers.Layer.Vector':
return configParsers.createVectorLayer(lyr_def);
break;
}
}
return me;
}
]
@@ -4,7 +4,7 @@ import compositionsComponent from 'compositions.component';
import SparqlJson from 'hs.source.SparqlJson';
import 'components/utils/utils.module';
import 'angular-socialshare';
import './config-parsers.module';
import './layer-parser.module';
import overwriteDialogDirective from './overwrite-dialog.directive';
import deleteDialogDirective from './delete-dialog.directive';
import shareDialogDirective from './share-dialog.directive';
@@ -16,7 +16,7 @@ import infoDialogDirective from './info-dialog.directive';
* @name hs.compositions
* @description Test composition module
*/
var module = angular.module('hs.compositions', ['720kb.socialshare', 'hs.map', 'hs.core', 'hs.compositions.config_parsers'])
var module = angular.module('hs.compositions', ['720kb.socialshare', 'hs.map', 'hs.core', 'hs.compositions.layerParser'])
/**
* @module hs.compositions
* @name hs.compositions.overwriteDialogDirective

This file was deleted.

@@ -0,0 +1,17 @@
import configParsersService from './layer-parser.service';
import 'angular-socialshare';

/**
* @ngdoc module
* @module hs.compositions.layerParser
* @name hs.compositions.layerParser
*/
var module = angular.module('hs.compositions.layerParser', ['720kb.socialshare', 'hs.map', 'hs.core', 'hs.addLayersVector']);

/**
* @module hs.compositions.layerParserService
* @ngdoc service
* @name hs.compositions.layerParserService
* @description Service for parsing object definition which are invalid for direct use as layers
*/
module.service('hs.compositions.layerParserService', configParsersService)
@@ -220,4 +220,5 @@ export default ['hs.map.service', 'config', 'Core', '$rootScope', 'hs.utils.serv
}
}
}
return me;
}]
@@ -1,4 +1,3 @@
import '../compositions/config-parsers.module';
import moment from 'moment';
global.moment = moment;

@@ -3,7 +3,6 @@ import ImageLayer from 'ol/layer/Image';
import VectorLayer from 'ol/layer/Vector';
import SparqlJson from 'hs.source.SparqlJson'
import 'angular-socialshare';
import '../compositions/config-parsers.module';
import { TileWMS, WMTS } from 'ol/source';
import { ImageWMS, ImageArcGISRest } from 'ol/source';
import { METERS_PER_UNIT } from 'ol/proj';

0 comments on commit fd031a7

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