Changeset 143 for js/viewer-f0
- Timestamp:
- 02/26/14 11:19:05 (11 years ago)
- Location:
- js/viewer-f0
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
js/viewer-f0/css/styles.css
r133 r143 2 2 display: inline; 3 3 position: fixed; 4 left: 560px;4 left: 1050px; 5 5 } 6 6 7 7 8 #container{8 .cont{ 9 9 height: 500px; 10 10 width: 500px; -
js/viewer-f0/index.html
r134 r143 15 15 <script src="js/Structures/NeuroConn.js"></script> 16 16 <script src="js/graphicsEngine.js"></script> 17 <script src="js/NeuronDrawer.js"></script> 18 <script src="js/SmartLayout.js"></script> 19 <script src="js/Structures/NeuroClass.js"></script> 17 20 <script src="js/main.js"></script> 18 21 19 22 23 <div class="cont" id="container"></div> 24 <div class="cont" id="containerNeuron"></div> 20 25 21 22 <div id="container"></div>23 26 <div id="menu"> 24 27 <textarea id="geno">//0 p:</textarea> -
js/viewer-f0/js/Structures/Neuro.js
r134 r143 5 5 6 6 Neuro.prototype = new Model(); 7 8 Neuro.prototype.getXPos = function()9 {10 11 } -
js/viewer-f0/js/Structures/NeuroConn.js
r134 r143 5 5 6 6 NeuroConn.prototype.getDestination = function(){ 7 return parseInt(this._properties["n1"]["VALUE"]); 8 } 9 10 NeuroConn.prototype.getSource = function(){ 7 11 return parseInt(this._properties["n2"]["VALUE"]); 8 12 } -
js/viewer-f0/js/graphicsEngine.js
r134 r143 253 253 } 254 254 255 GraphicsEngine.prototype.drawNeuron = function(){256 var scheme = [4,4,26,27,26,73,73,73,73,27,26,27,1,73,50,100,50,1,56,68,46,68,2,41,47,51,32,51,68];257 //pobieranie schematu258 //inne określenie położeń259 260 261 var obj = new THREE.Object3D();262 263 var material = new THREE.LineBasicMaterial({264 color: 0x0000ff265 });266 var position = 0;267 var noOfBlocks = 0;//number of "blocks" to draw268 var noOfLines = 0;//number of line to draw269 noOfBlocks = scheme[position++];270 for (var i = 0; i < noOfBlocks; i++)271 {272 noOfLines = scheme[position++];273 274 for (var j = 0; j < noOfLines; j++)275 {276 var geometry = new THREE.Geometry();277 geometry.vertices.push(new THREE.Vector3(scheme[position++], scheme[position++], 0));278 geometry.vertices.push(new THREE.Vector3(scheme[position++], scheme[position++], 0));279 position = position - 2; //get to last point in list280 var line = new THREE.Line(geometry, material);281 obj.add(line);282 }283 position = position + 2;//move to value which define number of lines to draw284 }285 286 obj.scale.set(0.1,0.1,0.1)287 this._scene.add(obj)288 }289 290 GraphicsEngine.prototype.drawConnection = function(connection, id, connestions, neurons){291 292 var destination = connection.getDestination();293 var numberOfConnToDest = 0;294 var numberOfDrawenCon = 0;295 296 //check how many conenctions have the same destination297 for(var i = 0; i < connestions.length; i++){298 if(connestions[i].getDestination() == destination)299 numberOfConnToDest++;300 }301 302 //check how many connections had been drawen303 for(var i = 0; i < id; i++){304 if(connestions[i].getDestination() == destination)305 numberOfDrawenCon++;306 }307 308 var positionY = (numberOfDrawenCon + 1) * 100 / (numberOfConnToDest + 1);309 var positionX = (numberOfDrawenCon + 1) * 10 / (numberOfConnToDest + 1);310 311 /*var x1 =312 var x2313 var y1314 var y2*/315 316 }317 318 255 GraphicsEngine.prototype.debugTest = function() 319 256 { 320 this.drawNeuron(); 321 322 323 } 324 257 258 } 259 -
js/viewer-f0/js/main.js
r134 r143 14 14 neurons: [], 15 15 neuroConns: [], 16 neuroClasses: [], 16 17 modelOne: undefined, 17 18 _graphicsEngine: new GraphicsEngine(), 19 _neuronDrawer: new NeuronDrawer(), 18 20 downloadXML: function () { 19 21 var local = this; 20 22 $.ajax({ 21 url: "http:// localhost:63342/FramestickFavi/f0def.xml",23 url: "http://www.framsticks.com/files/dev/files/f0def.xml", 22 24 dataType: "xml", 23 25 async: false, … … 31 33 } 32 34 }) 33 34 35 }, 35 36 parseGeneXml: function () { 36 var nodes = $(this.xml.find("CLASS")); 37 this._parseClass($(this.xml.find("CLASS"))); 38 this._parseNeuroClass($(this.xml.find("NEUROCLASS"))) 39 }, 40 _parseClass: function(nodes){ 37 41 var local = this; 38 42 … … 56 60 57 61 }); 62 }, 63 _parseNeuroClass: function(data){ 64 65 for(var i = 0; i < data.length; i++) 66 { 67 var neuroClass = new NeuroClass(); 68 neuroClass.setModel(data); 69 this.neuroClasses.push(neuroClass); 70 } 58 71 }, 59 72 analyseLine: function (line) { … … 108 121 downloadCreature: function () { 109 122 var lines; 110 /*$.ajax({111 url: "http://localhost:6334 2/FramestickFavi/creatures/" + this.debugCreatureName + ".txt",123 $.ajax({ 124 url: "http://localhost:63343/FramestickFavi/creatures/" + this.debugCreatureName + ".txt", 112 125 async: false, 113 126 dataType: "text", … … 120 133 } 121 134 122 }); */135 }); 123 136 124 lines = $("#geno").val();125 lines = lines.split("\n");137 //lines = $("#geno").val(); 138 //lines = lines.split("\n"); 126 139 127 140 return lines; … … 153 166 //this._graphicsEngine.debugTest(); 154 167 this._graphicsEngine.renderScene(); 168 169 this._neuronDrawer.initializeScene(); 170 new SmartLayout(this.neurons, this.neuroConns); 171 this._neuronDrawer.drawNetwork(this.neurons, this.neuroConns, einfos); 172 this._neuronDrawer.renderScene(); 173 155 174 } 156 175 … … 162 181 geneWindow.parseCreature(); 163 182 geneWindow.mainLoop(); 164 //geneWindow.context = window.open("window.html", "Window", "width=200,height=100");165 183 166 184 }
Note: See TracChangeset
for help on using the changeset viewer.