| 123456789101112131415161718192021222324252627282930313233 |
- var parseCode = require("./parseCode");
- var extend = require('./extend');
- var projections = require('./projections');
- var deriveConstants = require('./deriveConstants');
- function Projection(srsCode,callback) {
- if (!(this instanceof Projection)) {
- return new Projection(srsCode);
- }
- callback = callback || function(error){
- if(error){
- throw error;
- }
- };
- var json = parseCode(srsCode);
- if(typeof json !== 'object'){
- callback(srsCode);
- return;
- }
- var modifiedJSON = deriveConstants(json);
- var ourProj = Projection.projections.get(modifiedJSON.projName);
- if(ourProj){
- extend(this, modifiedJSON);
- extend(this, ourProj);
- this.init();
- callback(null, this);
- }else{
- callback(srsCode);
- }
- }
- Projection.projections = projections;
- Projection.projections.start();
- module.exports = Projection;
|