Changeset 208 for js/viewer-f0/js/Viewer.js
- Timestamp:
- 04/03/14 17:07:28 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
js/viewer-f0/js/Viewer.js
r193 r208 12 12 this._neuronsContext = undefined; 13 13 this._context = undefined; 14 this._urlToXML = "http://www.framsticks.com/files/apps/config/f0def.xml";14 this._urlToXML = 'f0def.xml';//"http://www.framsticks.com/files/apps/config/f0def.xml"; 15 15 this._xml = undefined; 16 16 this._model = new Model(); … … 29 29 this.downloadXML(); 30 30 this.parseGeneXml(); 31 } 32 33 Viewer.prototype.showVisualization = function(value, context){ 34 this._showVisualization = value; 35 this._visualizationContext = context; 36 } 37 38 Viewer.prototype.showNeuron = function(value, context) 39 { 40 this._showNeurons = true; 41 this._neuronsContext = context; 31 this.VisualizationSettings = { 32 context: undefined, 33 width: undefined, 34 height: undefined 35 }; 36 this.NetworkSettings = { 37 context: undefined, 38 width: undefined, 39 height: undefined 40 }; 42 41 } 43 42 … … 165 164 }; 166 165 167 168 166 Viewer.prototype._getCreatureFromLink = function (link) { 169 167 var lines = undefined; … … 239 237 }; 240 238 241 Viewer.prototype.mainLoop = function () {242 this._graphicsEngine.initializeScene();243 this.renderCreature();244 this._graphicsEngine.debugTest();245 this._graphicsEngine.renderScene();246 247 this._neuronDrawer.initializeScene();248 new SmartLayout(this._neurons, this._neuroConns);249 this._neuronDrawer.drawNetwork(this._neurons, this._neuroConns, einfos, this._neuroClasses);250 this._neuronDrawer.renderScene();251 252 };253 254 239 Viewer.prototype.run = function (mode, content) { 255 240 this.parseCreature(mode, content); 256 241 257 if (this. _showVisualization) {258 this._graphicsEngine = new GraphicsEngine(this. _visualizationContext)242 if (this.VisualizationSettings.context) { 243 this._graphicsEngine = new GraphicsEngine(this.VisualizationSettings.context, this.VisualizationSettings.width, this.VisualizationSettings.height); 259 244 this._graphicsEngine.initializeScene(); 260 245 this.renderCreature(); … … 262 247 this._graphicsEngine.renderScene(); 263 248 } 264 if (this._showNeurons) { 265 this._neuronDrawer = new NeuronDrawer(this._neuronsContext); 249 if (this.NetworkSettings.context) { 250 this._neuronDrawer = new NeuronDrawer(this.NetworkSettings.context, this.NetworkSettings.width, this.NetworkSettings.height ); 251 this._neuronDrawer.initializeNewCanvas(); 252 new SmartLayout(this._neurons, this._neuroConns); 253 this._neuronDrawer.drawNeuralNetwork(this._neurons, this._neuroConns, einfos, this._neuroClasses); 254 this._neuronDrawer.finalize(); 255 256 /*this._neuronDrawer = new NeuronDrawer(this._neuronsContext); 266 257 this._neuronDrawer.initializeScene(); 267 258 new SmartLayout(this._neurons, this._neuroConns); 268 this._neuronDrawer.drawNe twork(this._neurons, this._neuroConns, einfos, this._neuroClasses);269 this._neuronDrawer.renderScene(); 259 this._neuronDrawer.drawNeuralNetwork(this._neurons, this._neuroConns, einfos, this._neuroClasses); 260 this._neuronDrawer.renderScene();*/ 270 261 } 271 262 } … … 274 265 var viewer = new Viewer(); 275 266 276 viewer.showVisualization(true, $("#container")); 277 viewer.showNeuron(true, $("#containerNeuron")); 267 viewer.VisualizationSettings.context = $("#container"); 268 viewer.VisualizationSettings.width = 400; 269 viewer.VisualizationSettings.height = 400; 270 271 viewer.NetworkSettings.context = "containerNeuron"; 272 viewer.NetworkSettings.width = 400; 273 viewer.NetworkSettings.height = 400; 278 274 viewer.run(viewer.Mode.TEXTAREA, $("#geno")); 279 275 } … … 281 277 function openEmbeddedCreature() { 282 278 var viewer = new Viewer(); 283 viewer.showVisualization(true, $("#container1")); 284 viewer.showNeuron(true, $("#containerNeuron1")); 279 viewer.VisualizationSettings.context = $("#container1"); 280 viewer.VisualizationSettings.width = 400; 281 viewer.VisualizationSettings.height = 400; 282 283 viewer.NetworkSettings.context = "containerNeuron1"; 284 viewer.NetworkSettings.width = 400; 285 viewer.NetworkSettings.height = 400; 285 286 viewer.run(viewer.Mode.EMBEDDED, "http://ec.framsticks.com/www/index.php?PAGE=view_genotype&ID=55"); 286 287 } … … 288 289 function openCodeCreature() { 289 290 var viewer = new Viewer(); 290 291 viewer.showVisualization(true, $("#container2")); 292 viewer.showNeuron(true, $("#containerNeuron2")); 291 viewer.VisualizationSettings.context = $("#container2"); 292 viewer.VisualizationSettings.width = 400; 293 viewer.VisualizationSettings.height = 400; 294 viewer.NetworkSettings.context = "containerNeuron2"; 295 viewer.NetworkSettings.width = 400; 296 viewer.NetworkSettings.height = 400; 293 297 viewer.run(viewer.Mode.CODE, "//0\np:\np: x=1"); 294 298 } … … 296 300 function openFileCreature() { 297 301 var viewer = new Viewer(); 298 299 var debugCreatureName = "example4"; 300 viewer.showVisualization(true, $("#container3")); 301 viewer.showNeuron(true, $("#containerNeuron3")); 302 //var debugCreatureName = "example4"; 303 //var debugCreatureName = "caterpillar"; 304 var debugCreatureName = "Quadro"; 305 //viewer.VisualizationSettings.context = $("#container3"); 306 //viewer.VisualizationSettings.width = 400; 307 //viewer.VisualizationSettings.height = 400; 308 viewer.NetworkSettings.context = "containerNeuron3"; 309 viewer.NetworkSettings.width = 400; 310 viewer.NetworkSettings.height = 400; 302 311 viewer.run(viewer.Mode.LINK, "http://localhost:63343/FramestickFavi/creatures/" + debugCreatureName + ".txt"); 303 312 }
Note: See TracChangeset
for help on using the changeset viewer.