Changeset 214 for js


Ignore:
Timestamp:
04/06/14 12:18:53 (11 years ago)
Author:
mmichalski
Message:

Draw U-Shapes connections

Location:
js/viewer-f0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • js/viewer-f0/css/styles.css

    r208 r214  
    77    height: 500px;
    88    width: 500px;
    9     display: inline;
     9    display: inline-block;
     10    border-style: solid;
    1011}
    1112
  • js/viewer-f0/js/NeuronDrawer.js

    r208 r214  
    1111    this._scale = 1;
    1212    this._min_scale = 0.1;
     13    this._lineDebug = false;
    1314    //Kinetic.js
    1415    this._stage = undefined;
     
    1718
    1819NeuronDrawer.prototype.initializeNewCanvas = function () {
     20
     21    if(typeof (this._canvasWidth) == "undefined" && typeof (this._canvasHeight) == "undefined")
     22        {
     23        var div = $("#" + this._containerContextName);
     24        this._canvasWidth = div.width();
     25        this._canvasHeight = div.height();
     26    }
    1927
    2028    this._stage = new Kinetic.Stage({
     
    150158        yw += this._neurons[neuroId].y;//add position of object to y
    151159
     160        //Inputs
    152161        points.push(this._neurons[neuroId].x);//x
    153162        points.push(yw);//y
     
    156165        points.push(yw);//y
    157166
    158         points.push(n2.x+n2.sizeX);
    159         points.push(n2.y + n2.sizeY/2);
    160 
    161         /*if(diagram?)
     167        //straight line to second neuron
     168        if(this._lineDebug || (this._neurons[neuroId].x > n2.x))
    162169        {
    163             //straight forward
     170            points.push(n2.x+n2.sizeX);
     171            points.push(n2.y + n2.sizeY/2);
    164172        }
    165173        else
    166174        {
    167             //U-shape
    168         }*/
     175            //U - shape
     176            //Vertical
     177            points.push(this._neurons[neuroId].x - xw);//x
     178            points.push(n2.y + n2.sizeY + (input+1)*5);//y
     179
     180            //Horizontal
     181            points.push(n2.x + n2.sizeX);//x
     182            points.push(n2.y + n2.sizeY + (input+1)*5);//y
     183
     184            //Vertical
     185            points.push(n2.x + n2.sizeX);//x
     186            points.push(n2.y + n2.sizeY/2);//y
     187        }
    169188
    170189        var line = new Kinetic.Line({
  • js/viewer-f0/js/Viewer.js

    r209 r214  
    77    };
    88
    9     this._showNeurons = true;
    10     this._showVisualization = true;
    11     this._visualizationContext = undefined;
    12     this._neuronsContext = undefined;
    139    this._context = undefined;
    14     this._urlToXML = "http://www.framsticks.com/files/apps/config/f0def.xml";
     10    this._urlToXML = 'f0def.xml';//"http://www.framsticks.com/files/apps/config/f0def.xml";
    1511    this._xml = undefined;
    1612    this._model = new Model();
     
    2420    this._neuroConns = [];
    2521    this._neuroClasses = {};
    26     this._modelOne = undefined;
    2722    this._graphicsEngine = undefined;
    2823    this._neuronDrawer = undefined;
     
    302297    //var debugCreatureName = "example4";
    303298    //var debugCreatureName = "caterpillar";
    304     var debugCreatureName = "Quadro";
     299    //var debugCreatureName = "Quadro";
     300    var debugCreatureName = "spider";
    305301    //viewer.VisualizationSettings.context = $("#container3");
    306302    //viewer.VisualizationSettings.width = 400;
    307303    //viewer.VisualizationSettings.height = 400;
    308304    viewer.NetworkSettings.context =  "containerNeuron3";
    309     viewer.NetworkSettings.width = 400;
    310     viewer.NetworkSettings.height = 400;
     305    //viewer.NetworkSettings.width = 400;
     306    //viewer.NetworkSettings.height = 400;
    311307    viewer.run(viewer.Mode.LINK, "http://localhost:63343/FramestickFavi/creatures/" + debugCreatureName + ".txt");
    312308}
Note: See TracChangeset for help on using the changeset viewer.