Skip to content
Snippets Groups Projects
LatticeAPI.js 2.51 KiB
Newer Older
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
/**
 * Created by aghassaei on 9/25/15.
 */


Amanda Ghassaei's avatar
Amanda Ghassaei committed
define(['lattice', 'plist'], function(lattice){
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed

    return {

        //getters

Amanda Ghassaei's avatar
Amanda Ghassaei committed
        getUnits: function(){
            return lattice.getUnits();
        },

        getScale: function(){
            return lattice.getScale();
        },

        getNumCells: function(){
            return lattice.getNumCells();
        },

Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        getSize: function(){
Amanda Ghassaei's avatar
Amanda Ghassaei committed
            return lattice.getSize();
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        },
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed

Amanda Ghassaei's avatar
Amanda Ghassaei committed
        getBoundingBox: function(){
            return lattice.calculateBoundingBox();
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        },

        getAspectRatio: function(){
Amanda Ghassaei's avatar
Amanda Ghassaei committed
            return lattice.getAspectRatio();
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        },

        getCellType: function(){
Amanda Ghassaei's avatar
Amanda Ghassaei committed
            return lattice.getCellType();
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        },

        getConnectionType: function(){
Amanda Ghassaei's avatar
Amanda Ghassaei committed
            return lattice.getConnectionType();
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        },

        getApplicationType: function(){
Amanda Ghassaei's avatar
Amanda Ghassaei committed
            return lattice.getApplicationType();
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        },

        getPartType: function(){
Amanda Ghassaei's avatar
Amanda Ghassaei committed
            return lattice.getPartType();
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        },


        //setters

        setAspectRatio: function(x, y, z){
Amanda Ghassaei's avatar
Amanda Ghassaei committed
            lattice.setAspectRatio({x:x, y:y, z:z}, false);
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        },

        setCellType: function(cellType){
Amanda Ghassaei's avatar
Amanda Ghassaei committed
            lattice.setCellType(cellType, false);
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        },

        setConnectionType: function(connectionType){
Amanda Ghassaei's avatar
Amanda Ghassaei committed
            lattice.setConnectionType(connectionType, false);
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        },

        setApplicationType: function(applicationType){
Amanda Ghassaei's avatar
Amanda Ghassaei committed
            lattice.setApplicationType(applicationType, false);
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        },

        setPartType: function(partType){
Amanda Ghassaei's avatar
Amanda Ghassaei committed
            lattice.setPartType(partType, false);
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        },

Amanda Ghassaei's avatar
Amanda Ghassaei committed
        set: function(data){
            lattice.setLatticeMetaData(data);
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        },


        //cells

        clearCells: function(){
            lattice.clearCells();
        },

        getSparseCells: function(){
Amanda Ghassaei's avatar
Amanda Ghassaei committed
            return lattice.sparseCells;
        },
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed

Amanda Ghassaei's avatar
Amanda Ghassaei committed
        setSparseCells: function(cells){
Amanda Ghassaei's avatar
Amanda Ghassaei committed
            lattice.setSparseCells(cells);
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        },

        getCells: function(){
Amanda Ghassaei's avatar
Amanda Ghassaei committed
            return lattice.cells;
Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed
        },

        loopSparseCells: function(){

        },

        loopCells: function(){

        },

        addCellAtIndex: function(x, y, z, data){
            //parse x, y, z
            //check data is valid json

            lattice.addCellAtIndex(new THREE.Vector3(x, y, z), data);
Amanda Ghassaei's avatar
Amanda Ghassaei committed
        },

Amanda Ghassaei's avatar
Amanda Ghassaei committed
        removeCell: function(cell){
            lattice.removeCell(cell);
        },

Amanda Ghassaei's avatar
Amanda Ghassaei committed
        removeCellAtIndex: function(){

        },



Amanda Ghassaei's avatar
eod
Amanda Ghassaei committed

        //general

        save: function(filename){

        }
    }

});