all files / src/components/map/ projection.service.ts

60% Statements 12/20
100% Branches 0/0
42.86% Functions 3/7
60% Lines 12/20
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34                                60×            
"use strict";
var ol = require('openlayers');
var ProjectionService = (function () {
    function ProjectionService(ol, proj4) {
        this.ol = ol;
        this.proj4 = proj4;
        this['EPSG:27700'] = this.createEPSG27700();
    }
    ProjectionService.prototype.createEPSG27700 = function () {
        this.proj4.defs("EPSG:27700", "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.999601 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894 +datum=OSGB36 +units=m +no_defs");
        function returnSameCoords(coord) {
            return [coord[0], coord[1]];
        }
        this.ol.proj.addCoordinateTransforms('EPSG:27700', 'EPSG:27700', returnSameCoords, returnSameCoords);
        return new ol.proj.Projection({
            code: 'EPSG:27700',
            extent: [-238375.0, 0, 700000, 1300000],
            units: 'm'
        });
    };
    return ProjectionService;
}());
exports.ProjectionService = ProjectionService;
var ProjectionServiceProvider = (function () {
    function ProjectionServiceProvider() {
        this.$get = ['ol', 'proj4', function (ol, proj4) {
                return new ProjectionService(ol, proj4);
            }];
    }
    return ProjectionServiceProvider;
}());
exports.ProjectionServiceProvider = ProjectionServiceProvider;