Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from AMD and CommonJS to ES6 modules #44

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["es2015"],
"plugins": ["transform-runtime"]
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

/node_modules/
/dist/
/nbproject/
/lib/
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist/
src/
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
"name": "itowns2",
"version": "1.0.0",
"description": "A JS/WebGL framework for 3D geospatial data visualization",
"main": "dist/itowns2.js",
"main": "lib/Main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack -p",
"start": "webpack-dev-server -d --inline --hot"
"start": "webpack-dev-server -d --inline --hot",
"prepublish": "babel -d lib/ src/"
},
"repository": {
"type": "git",
Expand All @@ -26,6 +27,12 @@
"when": "^1.7.1"
},
"devDependencies": {
"babel-cli": "^6.5.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, babel-cli is useless here. It's meant to be installed globally (I personally just added ./node_modules/.bin to my $PATH)

"babel-core": "^6.5.1",
"babel-loader": "^6.2.2",
"babel-plugin-transform-runtime": "^6.5.0",
"babel-preset-es2015": "^6.5.0",
"babel-runtime": "^6.5.0",
"js-beautify": "^1.6.2",
"raw-loader": "^0.5.1",
"webpack": "^1.12.12",
Expand Down
58 changes: 27 additions & 31 deletions src/Core/Commander/Command.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,33 @@
* Description: Cette object contient une commande à executer. Elle porte également les buffers résultants.
*/

define('Core/Commander/Command', [], function() {
function Command() {
//Constructor

this.name = null;
this.priority = 0.0; //Math.floor((Math.random()*100));
this.state = null;
this.inParallel = null;
this.inBuffers = null;
this.outBuffers = null;
this.paramsFunction = [];
this.processFunction = null;
this.async = null;
this.force = null;
this.type = null;
this.addInHistory = null;
this.source = null;
this.requester = null;

}

Command.prototype.constructor = Command;

/**
*/
Command.prototype.instance = function() {
//TODO: Implement Me

function Command() {
//Constructor

this.name = null;
this.priority = 0.0; //Math.floor((Math.random()*100));
this.state = null;
this.inParallel = null;
this.inBuffers = null;
this.outBuffers = null;
this.paramsFunction = [];
this.processFunction = null;
this.async = null;
this.force = null;
this.type = null;
this.addInHistory = null;
this.source = null;
this.requester = null;

}

Command.prototype.constructor = Command;

/**
*/
Command.prototype.instance = function() {
//TODO: Implement Me

};
};

return Command;
});
export default Command;
4 changes: 2 additions & 2 deletions src/Core/Commander/History.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ History.prototype.delete = function(id) {



module.exports = {
History: History
export {
History
};
81 changes: 40 additions & 41 deletions src/Core/Commander/InterfaceCommander.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,60 @@
* Description: Cette Classe construit une commande. Cette Command ensuite pousser dans une file d'attente.
*/

define('Core/Commander/InterfaceCommander', ['Core/Commander/ManagerCommands', 'Core/Commander/Command'], function(ManagerCommands, Command) {
import ManagerCommands from 'Core/Commander/ManagerCommands';
import Command from 'Core/Commander/Command';

function InterfaceCommander(type, param) {
//Constructor
function InterfaceCommander(type, param) {
//Constructor

this.managerCommands = ManagerCommands();
this.type = type;
this.managerCommands = ManagerCommands();
this.type = type;

this.managerCommands.createProvider(this.type, param);
this.managerCommands.createProvider(this.type, param);

}
}

InterfaceCommander.prototype.constructor = InterfaceCommander;
InterfaceCommander.prototype.constructor = InterfaceCommander;

/**
* @param com {[object Object]}
*/
InterfaceCommander.prototype.request = function(com) {
//TODO: Implement Me

};
/**
* @param com {[object Object]}
*/
InterfaceCommander.prototype.request = function(com) {
//TODO: Implement Me

/**
* @return {[object Object]}
*/
InterfaceCommander.prototype.buildCommand = function() {
//TODO: Implement Me
this._builderCommand();
};
};

InterfaceCommander.prototype.getTextureBil = function(coWMTS) {
//TODO: Implement Me
return this.managerCommands.getTextureBil(coWMTS);
};
/**
* @return {[object Object]}
*/
InterfaceCommander.prototype.buildCommand = function() {
//TODO: Implement Me
this._builderCommand();
};

InterfaceCommander.prototype.getTextureOrtho = function(coWMTS) {
//TODO: Implement Me
return this.managerCommands.getTextureOrtho(coWMTS);
};
InterfaceCommander.prototype.getTextureBil = function(coWMTS) {
//TODO: Implement Me
return this.managerCommands.getTextureBil(coWMTS);
};

InterfaceCommander.prototype.getTile = function(bbox, parent) {
InterfaceCommander.prototype.getTextureOrtho = function(coWMTS) {
//TODO: Implement Me
return this.managerCommands.getTextureOrtho(coWMTS);
};

var command = new Command();
command.type = this.type;
command.requester = parent;
command.paramsFunction.push(bbox);
InterfaceCommander.prototype.getTile = function(bbox, parent) {

//command.priority = parent.sse === undefined ? 1 : Math.floor(parent.visible ? parent.sse * 10000 : 1.0) * (parent.visible ? Math.abs(19 - parent.level) : Math.abs(parent.level) ) *10000;
var command = new Command();
command.type = this.type;
command.requester = parent;
command.paramsFunction.push(bbox);

command.priority = parent.sse === undefined ? 1 : Math.floor(parent.visible && parent.material.visible ? parent.sse * parent.sse * 100000 : 1.0);
//command.priority = parent.sse === undefined ? 1 : Math.floor(parent.visible ? parent.sse * 10000 : 1.0) * (parent.visible ? Math.abs(19 - parent.level) : Math.abs(parent.level) ) *10000;

this.managerCommands.addCommand(command);
};
command.priority = parent.sse === undefined ? 1 : Math.floor(parent.visible && parent.material.visible ? parent.sse * parent.sse * 100000 : 1.0);

this.managerCommands.addCommand(command);
};

return InterfaceCommander;

});
export default InterfaceCommander;
75 changes: 37 additions & 38 deletions src/Core/Commander/Interfaces/ApiInterface/ApiGlobe.js
Original file line number Diff line number Diff line change
@@ -1,62 +1,61 @@
/**
* Generated On: 2015-10-5
* Class: ApiGlobe
* Description: Classe façade pour attaquer les fonctionnalités du code.
* Description: Classe fa�ade pour attaquer les fonctionnalit�s du code.
*/


define('Core/Commander/Interfaces/ApiInterface/ApiGlobe', ['Core/Commander/Interfaces/EventsManager', 'Scene/Scene'], function(EventsManager, Scene) {
import EventsManager from 'Core/Commander/Interfaces/EventsManager';
import Scene from 'Scene/Scene';

function ApiGlobe() {
//Constructor
function ApiGlobe() {
//Constructor

this.scene = null;
this.commandsTree = null;
this.scene = null;
this.commandsTree = null;

};
};

ApiGlobe.prototype = new EventsManager();
ApiGlobe.prototype = new EventsManager();

/**
* @param Command
*/
ApiGlobe.prototype.add = function(Command) {
//TODO: Implement Me

};
/**
* @param Command
*/
ApiGlobe.prototype.add = function(Command) {
//TODO: Implement Me

};

/**
* @param commandTemplate
*/
ApiGlobe.prototype.createCommand = function(commandTemplate) {
//TODO: Implement Me

};
/**
* @param commandTemplate
*/
ApiGlobe.prototype.createCommand = function(commandTemplate) {
//TODO: Implement Me

/**
*/
ApiGlobe.prototype.execute = function() {
//TODO: Implement Me
};

};
/**
*/
ApiGlobe.prototype.execute = function() {
//TODO: Implement Me

ApiGlobe.createSceneGlobe = function(pos) {
//TODO: Normalement la creation de scene ne doit pas etre ici....
// A� deplacer plus tard
};

this.scene = Scene();
this.scene.init(pos);
ApiGlobe.createSceneGlobe = function(pos) {
//TODO: Normalement la creation de scene ne doit pas etre ici....
// A� deplacer plus tard

return this.scene;
this.scene = Scene();
this.scene.init(pos);

};
return this.scene;

ApiGlobe.showClouds = function(value) {
};

this.scene.layers[0].showClouds(value);
};
ApiGlobe.showClouds = function(value) {

return ApiGlobe;
this.scene.layers[0].showClouds(value);
};

});
export default ApiGlobe;
4 changes: 2 additions & 2 deletions src/Core/Commander/Interfaces/Event.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ Event.prototype.xmlToEvents = function() {



module.exports = {
Event: Event
export {
Event
};
54 changes: 25 additions & 29 deletions src/Core/Commander/Interfaces/EventsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,38 @@



define('Core/Commander/Interfaces/EventsManager', [], function() {
function EventsManager() {
//Constructor

function EventsManager() {
//Constructor
this.commands = null;
this.events = null;
this.timer = null;

this.commands = null;
this.events = null;
this.timer = null;

}

}

/**
* @param pevent {[object Object]}
* @param com {[object Object]}
*/
EventsManager.prototype.connect = function(pevent, com) {
//TODO: Implement Me

};
/**
* @param pevent {[object Object]}
* @param com {[object Object]}
*/
EventsManager.prototype.connect = function(pevent, com) {
//TODO: Implement Me

EventsManager.prototype.command = function() {
};

};
EventsManager.prototype.command = function() {

EventsManager.prototype.wait = function() {
var waitTime = 250;
if (this.timer === null) {
this.timer = window.setTimeout(this.command, waitTime);
} else {
window.clearInterval(this.timer);
this.timer = window.setTimeout(this.command, waitTime);
}
};

};
EventsManager.prototype.wait = function() {
var waitTime = 250;
if (this.timer === null) {
this.timer = window.setTimeout(this.command, waitTime);
} else {
window.clearInterval(this.timer);
this.timer = window.setTimeout(this.command, waitTime);
}

return EventsManager;
};

});
export default EventsManager;
Loading