From a521229d0de25ad85f10010ac477797c9f7487ce Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Mon, 26 Oct 2015 20:41:07 -0400
Subject: [PATCH] renaming

---
 .../{KennyTeqPart.stl => KennyTechPart.stl}   | Bin
 ...rtHighRes.stl => KennyTechPartHighRes.stl} | Bin
 .../parts/{SamTeqPart.stl => SamTechPart.stl} | Bin
 js/API/LatticeAPI.js                          |  18 +++++++++++---
 js/lattice/CompositeEditorLattice.js          |   2 +-
 js/lattice/Lattice.js                         |  22 ++++++++++++------
 js/lattice/LatticeBase.js                     |   9 +++++--
 js/main.js                                    |  12 +++++-----
 ...HighResPart.js => KennyTechHighResPart.js} |   2 +-
 .../{KennyTeqPart.js => KennyTechPart.js}     |   2 +-
 js/parts/{SamTeqPart.js => SamTechPart.js}    |   2 +-
 js/plists/PList.js                            |   6 ++---
 12 files changed, 50 insertions(+), 25 deletions(-)
 rename assets/stls/parts/{KennyTeqPart.stl => KennyTechPart.stl} (100%)
 rename assets/stls/parts/{KennyTeqPartHighRes.stl => KennyTechPartHighRes.stl} (100%)
 rename assets/stls/parts/{SamTeqPart.stl => SamTechPart.stl} (100%)
 rename js/parts/{KennyTeqHighResPart.js => KennyTechHighResPart.js} (82%)
 rename js/parts/{KennyTeqPart.js => KennyTechPart.js} (83%)
 rename js/parts/{SamTeqPart.js => SamTechPart.js} (83%)

diff --git a/assets/stls/parts/KennyTeqPart.stl b/assets/stls/parts/KennyTechPart.stl
similarity index 100%
rename from assets/stls/parts/KennyTeqPart.stl
rename to assets/stls/parts/KennyTechPart.stl
diff --git a/assets/stls/parts/KennyTeqPartHighRes.stl b/assets/stls/parts/KennyTechPartHighRes.stl
similarity index 100%
rename from assets/stls/parts/KennyTeqPartHighRes.stl
rename to assets/stls/parts/KennyTechPartHighRes.stl
diff --git a/assets/stls/parts/SamTeqPart.stl b/assets/stls/parts/SamTechPart.stl
similarity index 100%
rename from assets/stls/parts/SamTeqPart.stl
rename to assets/stls/parts/SamTechPart.stl
diff --git a/js/API/LatticeAPI.js b/js/API/LatticeAPI.js
index e69600a5..86e7155e 100644
--- a/js/API/LatticeAPI.js
+++ b/js/API/LatticeAPI.js
@@ -3,49 +3,59 @@
  */
 
 
-define(['lattice', 'plist'], function(lattice){
+define(['lattice', 'plist', 'console'], function(lattice, plist, myConsole){
 
     return {
 
         //getters
 
         getUnits: function(){
+            myConsole.write("lattice.getUnits()");
             return lattice.getUnits();
         },
 
         getScale: function(){
+            myConsole.write("lattice.getScale()");
             return lattice.getScale();
         },
 
         getNumCells: function(){
+            myConsole.write("lattice.getNumCells()");
             return lattice.getNumCells();
         },
 
         getSize: function(){
+            myConsole.write("lattice.getSize()");
             return lattice.getSize();
         },
 
         getBoundingBox: function(){
+            myConsole.write("lattice.getBoundingBox()");
             return lattice.getBoundingBox();
         },
 
         getAspectRatio: function(){
+            myConsole.write("lattice.getAspectRatio()");
             return lattice.getAspectRatio();
         },
 
         getCellType: function(){
+            myConsole.write("lattice.getCellType()");
             return lattice.getCellType();
         },
 
         getConnectionType: function(){
+            myConsole.write("lattice.getConnectionType()");
             return lattice.getConnectionType();
         },
 
         getApplicationType: function(){
+            myConsole.write("lattice.getApplicationType()");
             return lattice.getApplicationType();
         },
 
         getPartType: function(){
+            myConsole.write("lattice.getPartType()");
             return lattice.getPartType();
         },
 
@@ -84,6 +94,7 @@ define(['lattice', 'plist'], function(lattice){
         },
 
         getSparseCells: function(){
+            myConsole.write("lattice.getSparseCells()");
             return lattice.sparseCells;
         },
 
@@ -92,14 +103,16 @@ define(['lattice', 'plist'], function(lattice){
         },
 
         getCells: function(){
+            myConsole.write("lattice.getCells()");
             return lattice.cells;
         },
 
         loopSparseCells: function(){
-
+            myConsole.write("lattice.loopSparseCells()");
         },
 
         loopCells: function(){
+            myConsole.write("lattice.loopCells()");
 
         },
 
@@ -124,7 +137,6 @@ define(['lattice', 'plist'], function(lattice){
         //general
 
         save: function(filename){
-
         }
     }
 
diff --git a/js/lattice/CompositeEditorLattice.js b/js/lattice/CompositeEditorLattice.js
index 0a9b17aa..77fdeb61 100644
--- a/js/lattice/CompositeEditorLattice.js
+++ b/js/lattice/CompositeEditorLattice.js
@@ -122,7 +122,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
         },
 
         destroy: function(){
-            this.clearCells(true);
+            this._clearCells(true);
             var self = this;
             _.each(_.keys(this.attributes), function(key){
                 self.set(key, null, {silent:true});
diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js
index c9745d96..03dfa973 100644
--- a/js/lattice/Lattice.js
+++ b/js/lattice/Lattice.js
@@ -107,17 +107,19 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis
 
         setAspectRatio: function(aspectRatio, silent){
             if (!aspectRatio.x || !aspectRatio.y || !aspectRatio.z || aspectRatio.x<0 || aspectRatio.y<0 || aspectRatio.z<0) {//no 0, undefined, null, or neg #'s
-                console.warn("invalid aspect ratio params");
+                myConsole.warn("invalid aspect ratio params, lattice.setAspectRatio operation cancelled");
                 return;
             }
+            myConsole.write("lattice.setAspectRatio(" + aspectRatio.x + ", " + aspectRatio.y + ", " + aspectRatio.z +")");
             return this.setProperty("aspectRatio", new THREE.Vector3(aspectRatio.x, aspectRatio.y, aspectRatio.z), silent);
         },
 
         setCellType: function(cellType, silent){
             if (plist.allLattices[cellType] === undefined){
-                console.warn("no cell type " + cellType);
+                myConsole.warn("no cell type " + cellType + ", lattice.setCellType operation cancelled");
                 return;
             }
+            myConsole.write("lattice.setCellType('" + cellType + "')");
             return this.setProperty("cellType", cellType, silent);
         },
 
@@ -125,9 +127,11 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis
             var cellType = this.get("cellType");
             var plistCellData = plist.allLattices[cellType];
             if (plistCellData.connection[connectionType] === undefined){
-                console.warn("no connection type " + connectionType + " for cell type " + plistCellData.name);
+                myConsole.warn("no connection type " + connectionType + " for cell type " + cellType +
+                    ", lattice.setConnectionType operation cancelled");
                 return;
             }
+            myConsole.write("lattice.setConnectionType('" + connectionType + "')");
             return this.setProperty("connectionType", connectionType, silent);
         },
 
@@ -137,9 +141,11 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis
             var connectionType = this.get("connectionType");
             var plistConnectionData = plistCellData.connection[connectionType];
             if (plistConnectionData.type[applicationType] === undefined){
-                console.warn("no application type " + applicationType + " for cell type " + plistCellData.name + " and connection type " + plistConnectionData.name);
+                myConsole.warn("no application type " + applicationType + " for cell type " + cellType + " and connection type " + connectionType +
+                ", lattice.setApplicationType operation cancelled");
                 return;
             }
+            myConsole.write("lattice.setApplicationType('" + applicationType + "')");
             return this.setProperty("applicationType", applicationType, silent);
         },
 
@@ -151,9 +157,11 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis
             var applicationType = this.get("applicationType");
             var plistAppData = plistConnectionData.type[applicationType];
             if (plistAppData.parts[partType] === undefined){
-                console.warn("no part type " + partType + " for cell type " + plistCellData.name + " and connection type " + plistConnectionData.name + " and application type " + plistAppData.name);
+                myConsole.warn("no part type " + partType + " for cell type " + plistCellData.name + " and connection type " + plistConnectionData.name + " and application type " + plistAppData.name +
+                ", lattice.setPartType operation cancelled");
                 return;
             }
+            myConsole.write("lattice.setPartType('" + partType + "')");
             return this.setProperty("partType", partType, silent);
         },
 
@@ -200,7 +208,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis
 
         _setSparseCells: function(cells, subclass){
 
-            if ((this.get("connectionType") == "gik" || this.previous("connectionType") == "gik")) this.clearCells();
+            if ((this.get("numCells") > 0 && (this.get("connectionType") == "gik" || this.previous("connectionType") == "gik"))) this.clearCells();
 
             this._setDefaultCellMode();//cell mode
 
@@ -208,7 +216,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis
             var cellsMax = this.get("cellsMax");
             var numCells = this.get("numCells");
 
-            this.clearCells();
+            this._clearCells();
             if (this._undo) this._undo();//undo subclass methods
             if (globals.basePlane) globals.basePlane.destroy();
             if (globals.highlighter) globals.highlighter.destroy();
diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js
index 5ed4da4c..0ce171b8 100644
--- a/js/lattice/LatticeBase.js
+++ b/js/lattice/LatticeBase.js
@@ -59,7 +59,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
 
         _setSparseCells: function(cells, subclass){
 
-            this.clearCells();//composite lattice should always be empty
+            this._clearCells();//composite lattice should always be empty
 
             console.log(this.get("numCells"));
             var numCells = this.get("numCells");
@@ -235,7 +235,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
                 myConsole.warn("no cell, lattice.removeCell operation cancelled");
                 return;
             }
-            myConsole.write("removeCell(" + cell + ")");
+            myConsole.write("lattice.removeCell(" + cell + ")");
             this._removeCell(cell);
             three.render();
         },
@@ -256,6 +256,11 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
         },
 
         clearCells: function(silent){
+            myConsole.write("lattice.clearCells()");
+            this._clearCells(silent);
+        },
+
+        _clearCells: function(silent){
             if (silent === undefined) silent = false;
             this._loopCells(this.sparseCells, function(cell){//send destroy to top level
                 cell.destroy();
diff --git a/js/main.js b/js/main.js
index e7839f8b..9e22a0ad 100644
--- a/js/main.js
+++ b/js/main.js
@@ -109,9 +109,9 @@ require.config({
         octaEdgeVoxPartLowPoly: 'parts/OctaEdgeVoxPartLowPoly',
         gikPart: 'parts/GIKPart',
         gikPartLowPoly: 'parts/GIKPartLowPoly',
-        kennyTeqPart: 'parts/KennyTeqPart',
-        kennyTeqHighResPart: 'parts/KennyTeqHighResPart',
-        samTeqPart: 'parts/SamTeqPart',
+        kennyTechPart: 'parts/KennyTechPart',
+        kennyTechHighResPart: 'parts/KennyTechHighResPart',
+        samTechPart: 'parts/SamTechPart',
         legoPart: 'parts/LegoPart',
         dnaStraightPart: 'parts/DNAStraightPart',
         dnaLegoPart: 'parts/DNALegoPart',
@@ -167,9 +167,9 @@ require.config({
         gikEndPartSTL: 'assets/stls/parts/GIKEndPart.stl',
         gikPartLowPolySTL: 'assets/stls/parts/GIKPartLowPoly.stl',
         gikEndPartLowPolySTL: 'assets/stls/parts/GIKEndPartLowPoly.stl',
-        kennyTeqPartSTL: 'assets/stls/parts/KennyTeqPart.stl',
-        kennyTeqPartHighResSTL: 'assets/stls/parts/KennyTeqPartHighRes.stl',
-        samTeqPartSTL: 'assets/stls/parts/SamTeqPart.stl',
+        kennyTechPartSTL: 'assets/stls/parts/KennyTechPart.stl',
+        kennyTechPartHighResSTL: 'assets/stls/parts/KennyTechPartHighRes.stl',
+        samTechPartSTL: 'assets/stls/parts/SamTechPart.stl',
         legoBrickSTL: 'assets/stls/parts/legoBrick1x1.stl',
         dnaLegoBrickSTL: 'assets/stls/parts/DNALegoBrick1x2.stl',
         dnaLegoBrick1x1STL: 'assets/stls/parts/DNALegoBrick1x1.stl'
diff --git a/js/parts/KennyTeqHighResPart.js b/js/parts/KennyTechHighResPart.js
similarity index 82%
rename from js/parts/KennyTeqHighResPart.js
rename to js/parts/KennyTechHighResPart.js
index f47dbce4..9e96b680 100644
--- a/js/parts/KennyTeqHighResPart.js
+++ b/js/parts/KennyTechHighResPart.js
@@ -2,7 +2,7 @@
  * Created by aghassaei on 6/29/15.
  */
 
-define(['underscore', 'stlLoader', 'part', 'bin!kennyTeqPartHighResSTL'], function(_, THREE, DMAPart, stl){
+define(['underscore', 'stlLoader', 'part', 'bin!kennyTechPartHighResSTL'], function(_, THREE, DMAPart, stl){
 
     var loader = new THREE.STLLoader();
     var unitGeo = loader.parse(stl);
diff --git a/js/parts/KennyTeqPart.js b/js/parts/KennyTechPart.js
similarity index 83%
rename from js/parts/KennyTeqPart.js
rename to js/parts/KennyTechPart.js
index 402c92a0..fc266b5c 100644
--- a/js/parts/KennyTeqPart.js
+++ b/js/parts/KennyTechPart.js
@@ -2,7 +2,7 @@
  * Created by aghassaei on 6/26/15.
  */
 
-define(['underscore', 'stlLoader', 'part', 'bin!kennyTeqPartSTL'], function(_, THREE, DMAPart, stl){
+define(['underscore', 'stlLoader', 'part', 'bin!kennyTechPartSTL'], function(_, THREE, DMAPart, stl){
 
     var loader = new THREE.STLLoader();
     var unitGeo = loader.parse(stl);
diff --git a/js/parts/SamTeqPart.js b/js/parts/SamTechPart.js
similarity index 83%
rename from js/parts/SamTeqPart.js
rename to js/parts/SamTechPart.js
index ff682892..5a7b6ea3 100644
--- a/js/parts/SamTeqPart.js
+++ b/js/parts/SamTechPart.js
@@ -3,7 +3,7 @@
  */
 
 
-define(['underscore', 'stlLoader', 'part', 'bin!samTeqPartSTL'], function(_, THREE, DMAPart, stl){
+define(['underscore', 'stlLoader', 'part', 'bin!samTechPartSTL'], function(_, THREE, DMAPart, stl){
 
     var loader = new THREE.STLLoader();
     var unitGeo = loader.parse(stl);
diff --git a/js/plists/PList.js b/js/plists/PList.js
index 19f4628f..c6703ae0 100644
--- a/js/plists/PList.js
+++ b/js/plists/PList.js
@@ -178,13 +178,13 @@ define(['three'], function(THREE){
                             kennyVertex: {
                                 name: "Kenny's Lattice",
                                 parts: {
-                                    kennyTeq: {
+                                    kennyTech: {
                                         name: "Kenny Tech"
                                     },
-                                    kennyTeqHighRes: {
+                                    kennyTechHighRes: {
                                         name: "Kenny Tech (High Res)"
                                     },
-                                    samTeq: {
+                                    samTech: {
                                         name: "Square"
                                     }
                 //                   xShape:"X"
-- 
GitLab