mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-08-20 12:30:44 +02:00
predict method refactored: it now includes the node for the prediction
This commit is contained in:
parent
23f3ef71bb
commit
cb23c48740
@ -323,7 +323,7 @@ mindplot.Designer = new Class({
|
||||
|
||||
// Create a new node ...
|
||||
var layoutManager = this._eventBussDispatcher.getLayoutManager();
|
||||
var result = layoutManager.predict(topic.getId(), mousePos);
|
||||
var result = layoutManager.predict(topic.getId(), null, mousePos);
|
||||
childModel.setOrder(result.order);
|
||||
|
||||
var position = result.position;
|
||||
|
@ -41,7 +41,7 @@ mindplot.DragTopic = new Class({
|
||||
if (this.isFreeLayoutOn() && this.isConnected()) {
|
||||
var _layoutManager = this._layoutManager;
|
||||
var par = this.getConnectedToTopic();
|
||||
position = _layoutManager.predict(par.getId(), position, true).position;
|
||||
position = _layoutManager.predict(par.getId(), null, position, true).position;
|
||||
}
|
||||
this._position.setValue(position.x, position.y);
|
||||
|
||||
@ -56,7 +56,7 @@ mindplot.DragTopic = new Class({
|
||||
// In case is not free, pivot must be draw ...
|
||||
if (this.isConnected() && !this.isFreeLayoutOn()) {
|
||||
var parent = this.getConnectedToTopic();
|
||||
var predict = this._layoutManager.predict(parent.getId(), this.getPosition());
|
||||
var predict = this._layoutManager.predict(parent.getId(), this._draggedNode.getId(), this.getPosition());
|
||||
if (this._order != predict.order) {
|
||||
var dragPivot = this._getDragPivot();
|
||||
var pivotPosition = predict.position;
|
||||
@ -122,7 +122,7 @@ mindplot.DragTopic = new Class({
|
||||
$assert(parent, 'Parent connection node can not be null.');
|
||||
|
||||
// Where it should be connected ?
|
||||
var predict = designer._eventBussDispatcher._layoutManager.predict(parent.getId(), this.getPosition());
|
||||
var predict = designer._eventBussDispatcher._layoutManager.predict(parent.getId(), this._draggedNode.getId(), this.getPosition());
|
||||
|
||||
// Connect pivot ...
|
||||
var dragPivot = this._getDragPivot();
|
||||
|
@ -22,7 +22,23 @@ mindplot.layout.BalancedSorter = new Class({
|
||||
|
||||
},
|
||||
|
||||
predict : function(parent, graph, position) {
|
||||
predict : function(graph, parent, node, position, free) {
|
||||
// If its a free node...
|
||||
if (free) {
|
||||
$assert($defined(position), "position cannot be null for predict in free positioning");
|
||||
|
||||
//TODO(gb): check this. Should direction be obtained by the sorter?
|
||||
var rootNode = graph.getRootNode(parent);
|
||||
var direction = parent.getPosition().x > rootNode.getPosition().x ? 1 : -1;
|
||||
|
||||
var xPos = direction > 0 ?
|
||||
(position.x >= parent.getPosition().x ? position.x : parent.getPosition().x) :
|
||||
(position.x <= parent.getPosition().x ? position.x : parent.getPosition().x);
|
||||
|
||||
return {order:0, position:{x: xPos, y:position.y}};
|
||||
}
|
||||
|
||||
// Regular node
|
||||
var rootNode = graph.getRootNode(parent);
|
||||
|
||||
if (!position) {
|
||||
|
@ -36,7 +36,7 @@ mindplot.layout.ChildrenSorterStrategy = new Class({
|
||||
throw "Method must be implemented";
|
||||
},
|
||||
|
||||
predict:function(treeSet, parent, position) {
|
||||
predict:function(treeSet, parent, node, position, free) {
|
||||
throw "Method must be implemented";
|
||||
},
|
||||
|
||||
|
@ -102,27 +102,13 @@ mindplot.layout.LayoutManager = new Class({
|
||||
return this;
|
||||
},
|
||||
|
||||
predict: function(parentId, position, free) {
|
||||
predict: function(parentId, nodeId, position, free) {
|
||||
$assert($defined(parentId), "parentId can not be null");
|
||||
|
||||
var parent = this._treeSet.find(parentId);
|
||||
var node = nodeId == null ? null : this._treeSet.find(nodeId);
|
||||
var sorter = parent.getSorter();
|
||||
|
||||
if (free) {
|
||||
$assert($defined(position), "position cannot be null for predict in free positioning");
|
||||
|
||||
//TODO(gb): check this. Should direction be obtained by the sorter?
|
||||
var rootNode = this._treeSet.getRootNode(parent);
|
||||
var direction = parent.getPosition().x > rootNode.getPosition().x ? 1 : -1;
|
||||
|
||||
var xPos = direction > 0 ?
|
||||
(position.x >= parent.getPosition().x ? position.x : parent.getPosition().x) :
|
||||
(position.x <= parent.getPosition().x ? position.x : parent.getPosition().x);
|
||||
|
||||
return {order:0, position:{x: xPos, y:position.y}};
|
||||
}
|
||||
|
||||
|
||||
var result = sorter.predict(parent, this._treeSet, position);
|
||||
var result = sorter.predict(this._treeSet, parent, node, position, free);
|
||||
return {order:result[0],position:result[1]};
|
||||
},
|
||||
|
||||
|
@ -21,7 +21,23 @@ mindplot.layout.SymmetricSorter = new Class({
|
||||
|
||||
},
|
||||
|
||||
predict : function(parent, graph, position) {
|
||||
predict : function(graph, parent, node, position, free) {
|
||||
// If its a free node...
|
||||
if (free) {
|
||||
$assert($defined(position), "position cannot be null for predict in free positioning");
|
||||
|
||||
//TODO(gb): check this. Should direction be obtained by the sorter?
|
||||
var rootNode = graph.getRootNode(parent);
|
||||
var direction = parent.getPosition().x > rootNode.getPosition().x ? 1 : -1;
|
||||
|
||||
var xPos = direction > 0 ?
|
||||
(position.x >= parent.getPosition().x ? position.x : parent.getPosition().x) :
|
||||
(position.x <= parent.getPosition().x ? position.x : parent.getPosition().x);
|
||||
|
||||
return [0, {x: xPos, y:position.y}];
|
||||
}
|
||||
|
||||
// Regular node
|
||||
var rootNode = graph.getRootNode(parent);
|
||||
var direction = parent.getPosition().x > rootNode.getPosition().x ? 1 : -1;
|
||||
|
||||
|
@ -184,14 +184,14 @@ mindplot.layout.BalancedTestSuite = new Class({
|
||||
var graph1 = manager.plot("testBalancedPredict1", {width:1000, height:400});
|
||||
|
||||
console.log("\tAdded as child of node 0 and dropped at (165, -70):");
|
||||
var prediction1a = manager.predict(0, {x:165, y:-70});
|
||||
var prediction1a = manager.predict(0, null, {x:165, y:-70});
|
||||
this._plotPrediction(graph1, prediction1a);
|
||||
$assert(prediction1a.position.y < manager.find(1).getPosition().y &&
|
||||
prediction1a.position.x == manager.find(1).getPosition().x, "Prediction is incorrectly positioned");
|
||||
$assert(prediction1a.order == 0, "Prediction order should be 0");
|
||||
|
||||
console.log("\tAdded as child of node 0 and dropped at (165, -10):");
|
||||
var prediction1b = manager.predict(0, {x:165, y:-10});
|
||||
var prediction1b = manager.predict(0, null, {x:165, y:-10});
|
||||
this._plotPrediction(graph1, prediction1b);
|
||||
$assert(prediction1b.position.y > manager.find(1).getPosition().y &&
|
||||
prediction1b.position.y < manager.find(3).getPosition().y &&
|
||||
@ -199,7 +199,7 @@ mindplot.layout.BalancedTestSuite = new Class({
|
||||
$assert(prediction1b.order == 2, "Prediction order should be 2");
|
||||
|
||||
console.log("\tAdded as child of node 0 and dropped at (145, 15):");
|
||||
var prediction1c = manager.predict(0, {x:145, y:15});
|
||||
var prediction1c = manager.predict(0, null, {x:145, y:15});
|
||||
this._plotPrediction(graph1, prediction1c);
|
||||
$assert(prediction1c.position.y > manager.find(3).getPosition().y &&
|
||||
prediction1c.position.y < manager.find(5).getPosition().y &&
|
||||
@ -207,7 +207,7 @@ mindplot.layout.BalancedTestSuite = new Class({
|
||||
$assert(prediction1c.order == 4, "Prediction order should be 4");
|
||||
|
||||
console.log("\tAdded as child of node 0 and dropped at (145, 70):");
|
||||
var prediction1d = manager.predict(0, {x:145, y:70});
|
||||
var prediction1d = manager.predict(0, null, {x:145, y:70});
|
||||
this._plotPrediction(graph1, prediction1d);
|
||||
$assert(prediction1d.position.y > manager.find(5).getPosition().y &&
|
||||
prediction1d.position.x == manager.find(5).getPosition().x, "Prediction is incorrectly positioned");
|
||||
@ -217,14 +217,14 @@ mindplot.layout.BalancedTestSuite = new Class({
|
||||
var graph2 = manager.plot("testBalancedPredict2", {width:1000, height:400});
|
||||
|
||||
console.log("\tAdded as child of node 0 and dropped at (-145, -50):");
|
||||
var prediction2a = manager.predict(0, {x:-145, y:-50});
|
||||
var prediction2a = manager.predict(0, null, {x:-145, y:-50});
|
||||
this._plotPrediction(graph2, prediction2a);
|
||||
$assert(prediction2a.position.y < manager.find(2).getPosition().y &&
|
||||
prediction2a.position.x == manager.find(2).getPosition().x, "Prediction is incorrectly positioned");
|
||||
$assert(prediction2a.order == 1, "Prediction order should be 1");
|
||||
|
||||
console.log("\tAdded as child of node 0 and dropped at (-145, -10):");
|
||||
var prediction2b = manager.predict(0, {x:-145, y:-10});
|
||||
var prediction2b = manager.predict(0, null, {x:-145, y:-10});
|
||||
this._plotPrediction(graph2, prediction2b);
|
||||
$assert(prediction2b.position.y > manager.find(2).getPosition().y &&
|
||||
prediction2b.position.y < manager.find(4).getPosition().y &&
|
||||
@ -232,7 +232,7 @@ mindplot.layout.BalancedTestSuite = new Class({
|
||||
$assert(prediction2b.order == 3, "Prediction order should be 3");
|
||||
|
||||
console.log("\tAdded as child of node 0 and dropped at (-145, 40):");
|
||||
var prediction2c = manager.predict(0, {x:-145, y:400});
|
||||
var prediction2c = manager.predict(0, null, {x:-145, y:400});
|
||||
this._plotPrediction(graph2, prediction2c);
|
||||
$assert(prediction2c.position.y > manager.find(4).getPosition().y &&
|
||||
prediction2c.position.x == manager.find(4).getPosition().x, "Prediction is incorrectly positioned");
|
||||
@ -241,7 +241,7 @@ mindplot.layout.BalancedTestSuite = new Class({
|
||||
// Graph 3
|
||||
console.log("\tPredict nodes added with no position:");
|
||||
var graph3 = manager.plot("testBalancedPredict3", {width:1000, height:400});
|
||||
var prediction3 = manager.predict(0, null);
|
||||
var prediction3 = manager.predict(0, null, null);
|
||||
this._plotPrediction(graph3, prediction3);
|
||||
$assert(prediction3.position.y > manager.find(4).getPosition().y &&
|
||||
prediction3.position.x == manager.find(4).getPosition().x, "Prediction is incorrectly positioned");
|
||||
@ -252,7 +252,7 @@ mindplot.layout.BalancedTestSuite = new Class({
|
||||
manager.connectNode(0,6,prediction3.order);
|
||||
manager.layout();
|
||||
var graph4 = manager.plot("testBalancedPredict4", {width:1000, height:400});
|
||||
var prediction4 = manager.predict(0, null);
|
||||
var prediction4 = manager.predict(0, null, null);
|
||||
this._plotPrediction(graph4, prediction4);
|
||||
$assert(prediction4.position.y > manager.find(5).getPosition().y &&
|
||||
prediction4.position.x == manager.find(5).getPosition().x, "Prediction is incorrectly positioned");
|
||||
@ -262,8 +262,8 @@ mindplot.layout.BalancedTestSuite = new Class({
|
||||
manager.removeNode(1).removeNode(2).removeNode(3).removeNode(4).removeNode(5);
|
||||
manager.layout();
|
||||
var graph5 = manager.plot("testBalancedPredict5", {width:1000, height:400});
|
||||
var prediction5a = manager.predict(0, null);
|
||||
var prediction5b = manager.predict(0, {x: 40, y: 100});
|
||||
var prediction5a = manager.predict(0, null, null);
|
||||
var prediction5b = manager.predict(0, null, {x:40, y:100});
|
||||
this._plotPrediction(graph5, prediction5a);
|
||||
this._plotPrediction(graph5, prediction5b);
|
||||
$assert(prediction5a.position.x > manager.find(0).getPosition().x &&
|
||||
@ -285,7 +285,25 @@ mindplot.layout.BalancedTestSuite = new Class({
|
||||
manager.layout();
|
||||
var graph = manager.plot("testBalancedSingleNodePredict1", {width:800, height:400});
|
||||
|
||||
var prediction1 = manager.predict(0, {x:50, y:50});
|
||||
var prediction1 = manager.predict(0, null, {x:50, y:50});
|
||||
this._plotPrediction(graph, prediction1);
|
||||
var prediction2 = manager.predict(0, null, {x:50, y:-50});
|
||||
this._plotPrediction(graph, prediction2);
|
||||
var prediction3 = manager.predict(0, null, {x:-50, y:50});
|
||||
this._plotPrediction(graph, prediction3);
|
||||
var prediction4 = manager.predict(0, null, {x:-50, y:-50});
|
||||
this._plotPrediction(graph, prediction4);
|
||||
|
||||
// Only one postion should be predicted for this scenario
|
||||
//TODO(gb): Fix this. It's not working
|
||||
// $assert(prediction1.position.x == prediction2.position.x &&
|
||||
// prediction2.position.x == prediction3.position.x &&
|
||||
// prediction3.position.x == prediction4.position.x,
|
||||
// "Only one position should be predicted for this scenario");
|
||||
// $assert(prediction1.position.y == prediction2.position.y &&
|
||||
// prediction2.position.y == prediction3.position.y &&
|
||||
// prediction3.position.y == prediction4.position.y,
|
||||
// "Only one position should be predicted for this scenario");
|
||||
|
||||
}
|
||||
});
|
@ -160,21 +160,21 @@ mindplot.layout.FreeTestSuite = new Class({
|
||||
var graph = manager.plot("testFreePredict1", {width:1000, height:400});
|
||||
|
||||
var pos1 = {x: 370, y:80};
|
||||
var predict1 = manager.predict(11, pos1, true);
|
||||
var predict1 = manager.predict(11, null, pos1, true);
|
||||
$assert(predict1.position.x == pos1.x && predict1.position.y == pos1.y, "free predict should return the same position");
|
||||
|
||||
var pos2 = {x: -200, y:80};
|
||||
var predict2 = manager.predict(2, pos2, true);
|
||||
var predict2 = manager.predict(2, null, pos2, true);
|
||||
$assert(predict2.position.x == pos2.x && predict2.position.y == pos2.y, "free predict should return the same position");
|
||||
|
||||
var pos3 = {x: 200, y:30};
|
||||
var node5 = manager.find(5);
|
||||
var predict3 = manager.predict(5, pos3, true);
|
||||
var predict3 = manager.predict(5, null, pos3, true);
|
||||
$assert(predict3.position.x == node5.getPosition().x && predict3.position.y == pos3.y, "free predict should return the x-coordinate of the node");
|
||||
|
||||
var pos4 = {x: -100, y:45};
|
||||
var node10 = manager.find(10);
|
||||
var predict4 = manager.predict(10, pos4, true);
|
||||
var predict4 = manager.predict(10, null, pos4, true);
|
||||
$assert(predict4.position.x == node10.getPosition().x && predict4.position.y == pos4.y, "free predict should return the x-coordinate of the node");
|
||||
|
||||
this._plotPrediction(graph, predict1);
|
||||
|
@ -111,14 +111,14 @@ mindplot.layout.SymmetricTestSuite = new Class({
|
||||
var graph1 = manager.plot("testSymmetricPredict1", {width:1000, height:400});
|
||||
|
||||
console.log("\tAdded as child of node 9 and dropped at (-280, 45):");
|
||||
var prediction1a = manager.predict(9, {x:-280, y:45});
|
||||
var prediction1a = manager.predict(9, null, {x:-280, y:45});
|
||||
this._plotPrediction(graph1, prediction1a);
|
||||
$assert(prediction1a.position.x < manager.find(9).getPosition().x &&
|
||||
prediction1a.position.y == manager.find(9).getPosition().y, "Prediction incorrectly positioned");
|
||||
$assert(prediction1a.order == 0, "Prediction order should be 0");
|
||||
|
||||
console.log("\tAdded as child of node 1 and dropped at (155, -90):");
|
||||
var prediction1b = manager.predict(1, {x:-155, y:-90});
|
||||
var prediction1b = manager.predict(1, null, {x:-155, y:-90});
|
||||
this._plotPrediction(graph1, prediction1b);
|
||||
$assert(prediction1b.position.x > manager.find(1).getPosition().x &&
|
||||
prediction1b.position.y == manager.find(1).getPosition().y, "Prediction is incorrectly positioned");
|
||||
@ -128,14 +128,14 @@ mindplot.layout.SymmetricTestSuite = new Class({
|
||||
var graph2 = manager.plot("testSymmetricPredict2", {width:1000, height:400});
|
||||
|
||||
console.log("\tAdded as child of node 5 and dropped at (380, -30):");
|
||||
var prediction2d = manager.predict(5, {x:380, y:-30});
|
||||
var prediction2d = manager.predict(5, null, {x:380, y:-30});
|
||||
this._plotPrediction(graph2, prediction2d);
|
||||
$assert(prediction2d.position.y < manager.find(7).getPosition().y &&
|
||||
prediction2d.position.x == manager.find(7).getPosition().x, "Prediction is incorrectly positioned" );
|
||||
$assert(prediction2d.order == 0, "Prediction order should be 0");
|
||||
|
||||
console.log("\tAdded as child of node 5 and dropped at (375, 15):");
|
||||
var prediction2a = manager.predict(5, {x:375, y:15});
|
||||
var prediction2a = manager.predict(5, null, {x:375, y:15});
|
||||
this._plotPrediction(graph2, prediction2a);
|
||||
$assert(prediction2a.position.y > manager.find(7).getPosition().y &&
|
||||
prediction2a.position.y < manager.find(8).getPosition().y &&
|
||||
@ -143,7 +143,7 @@ mindplot.layout.SymmetricTestSuite = new Class({
|
||||
$assert(prediction2a.order == 1, "Prediction order should be 1");
|
||||
|
||||
console.log("\tAdded as child of node 5 and dropped at (375, 45):");
|
||||
var prediction2b = manager.predict(5, {x:375, y:45});
|
||||
var prediction2b = manager.predict(5, null, {x:375, y:45});
|
||||
this._plotPrediction(graph2, prediction2b);
|
||||
$assert(prediction2b.position.y > manager.find(8).getPosition().y &&
|
||||
prediction2b.position.y < manager.find(11).getPosition().y &&
|
||||
@ -151,7 +151,7 @@ mindplot.layout.SymmetricTestSuite = new Class({
|
||||
$assert(prediction2b.order == 2, "Prediction order should be 2");
|
||||
|
||||
console.log("\tAdded as child of node 5 and dropped at (375, 45):");
|
||||
var prediction2c = manager.predict(5, {x:375, y:65});
|
||||
var prediction2c = manager.predict(5, null, {x:375, y:65});
|
||||
this._plotPrediction(graph2, prediction2c);
|
||||
$assert(prediction2c.position.y > manager.find(11).getPosition().y &&
|
||||
prediction2c.position.x == manager.find(11).getPosition().x, "Prediction is incorrectly positioned");
|
||||
@ -161,7 +161,7 @@ mindplot.layout.SymmetricTestSuite = new Class({
|
||||
var graph3 = manager.plot("testSymmetricPredict3", {width:1000, height:400});
|
||||
|
||||
console.log("\tAdded as child of node 3 and dropped at (280, 45):");
|
||||
var prediction3a = manager.predict(3, {x:280, y:45});
|
||||
var prediction3a = manager.predict(3, null, {x:280, y:45});
|
||||
this._plotPrediction(graph3, prediction3a);
|
||||
$assert(prediction3a.position.y > manager.find(5).getPosition().y &&
|
||||
prediction3a.position.y < manager.find(6).getPosition().y &&
|
||||
@ -169,7 +169,7 @@ mindplot.layout.SymmetricTestSuite = new Class({
|
||||
$assert(prediction3a.order == 2, "Prediction order should be 2");
|
||||
|
||||
console.log("\tAdded as child of node 3 and dropped at (255, 110):");
|
||||
var prediction3b = manager.predict(3, {x:255, y:110});
|
||||
var prediction3b = manager.predict(3, null, {x:255, y:110});
|
||||
this._plotPrediction(graph3, prediction3b);
|
||||
$assert(prediction3b.position.y > manager.find(6).getPosition().y &&
|
||||
prediction3b.position.x == manager.find(6).getPosition().x, "Prediction incorrectly positioned");
|
||||
@ -178,7 +178,7 @@ mindplot.layout.SymmetricTestSuite = new Class({
|
||||
// Graph 4
|
||||
console.log("\tAdded as child of node 2 and dropped at (-260, 0):");
|
||||
var graph4 = manager.plot("testSymmetricPredict4", {width:1000, height:400});
|
||||
var prediction4 = manager.predict(2, {x:-260, y:0});
|
||||
var prediction4 = manager.predict(2, null, {x:-260, y:0});
|
||||
this._plotPrediction(graph4, prediction4);
|
||||
$assert(prediction4.position.y > manager.find(9).getPosition().y &&
|
||||
prediction4.position.y < manager.find(10).getPosition().y &&
|
||||
@ -188,27 +188,27 @@ mindplot.layout.SymmetricTestSuite = new Class({
|
||||
// Graph 5
|
||||
console.log("\tPredict nodes added with no position:");
|
||||
var graph5 = manager.plot("testSymmetricPredict5", {width:1000, height:400});
|
||||
var prediction5a = manager.predict(1, null);
|
||||
var prediction5a = manager.predict(1, null, null);
|
||||
this._plotPrediction(graph5, prediction5a);
|
||||
$assert(prediction5a.position.y == manager.find(1).getPosition().y &&
|
||||
prediction5a.position.x > manager.find(1).getPosition().x, "Prediction is incorrectly positioned");
|
||||
$assert(prediction5a.order == 0, "Prediction order should be 0");
|
||||
|
||||
var prediction5b = manager.predict(2, null);
|
||||
var prediction5b = manager.predict(2, null, null);
|
||||
this._plotPrediction(graph5, prediction5b);
|
||||
$assert(prediction5b.position.y > manager.find(10).getPosition().y &&
|
||||
prediction5b.position.x < manager.find(2).getPosition().x &&
|
||||
prediction5b.position.x == manager.find(10).getPosition().x, "Prediction is incorrectly positioned");
|
||||
$assert(prediction5b.order == 2, "Prediction order should be 2");
|
||||
|
||||
var prediction5c = manager.predict(3, null);
|
||||
var prediction5c = manager.predict(3, null, null);
|
||||
this._plotPrediction(graph5, prediction5c);
|
||||
$assert(prediction5c.position.y > manager.find(6).getPosition().y &&
|
||||
prediction5c.position.x > manager.find(3).getPosition().x &&
|
||||
prediction5c.position.x == manager.find(6).getPosition().x, "Prediction is incorrectly positioned");
|
||||
$assert(prediction5c.order == 3, "Prediction order should be 3");
|
||||
|
||||
var prediction5d = manager.predict(10, null);
|
||||
var prediction5d = manager.predict(10, null, null);
|
||||
this._plotPrediction(graph5, prediction5d);
|
||||
$assert(prediction5d.position.y == manager.find(10).getPosition().y &&
|
||||
prediction5d.position.x < manager.find(10).getPosition().x, "Prediction is incorrectly positioned");
|
||||
|
@ -354,17 +354,17 @@ mindplot.layout.TestSuite = new Class({
|
||||
$assert(xPosNode8 - manager.find(8).getPosition().x == 20, "Node 8 should have been shifted by 20");
|
||||
|
||||
var graph2 = manager.plot("testSize3", {width: 1400, height: 400});
|
||||
this._plotPrediction(graph2, manager.predict(0, {x:-145, y:400}));
|
||||
this._plotPrediction(graph2, manager.predict(9, {x:-330, y:70}));
|
||||
this._plotPrediction(graph2, manager.predict(9, {x:-330, y:120}));
|
||||
this._plotPrediction(graph2, manager.predict(0, {x:15, y:20}));
|
||||
this._plotPrediction(graph2, manager.predict(0, null, {x:-145, y:400}));
|
||||
this._plotPrediction(graph2, manager.predict(9, null, {x:-330, y:70}));
|
||||
this._plotPrediction(graph2, manager.predict(9, null, {x:-330, y:120}));
|
||||
this._plotPrediction(graph2, manager.predict(0, null, {x:15, y:20}));
|
||||
//TODO(gb): make asserts
|
||||
|
||||
var graph3 = manager.plot("testSize4", {width: 1400, height: 400});
|
||||
this._plotPrediction(graph3, manager.predict(0, null));
|
||||
this._plotPrediction(graph3, manager.predict(9, null));
|
||||
this._plotPrediction(graph3, manager.predict(3, null));
|
||||
this._plotPrediction(graph3, manager.predict(1, null));
|
||||
this._plotPrediction(graph3, manager.predict(0, null, null));
|
||||
this._plotPrediction(graph3, manager.predict(9, null, null));
|
||||
this._plotPrediction(graph3, manager.predict(3, null, null));
|
||||
this._plotPrediction(graph3, manager.predict(1, null, null));
|
||||
//TODO(gb): make asserts
|
||||
|
||||
var yPosNode2 = manager.find(2).getPosition().y;
|
||||
@ -388,7 +388,7 @@ mindplot.layout.TestSuite = new Class({
|
||||
manager.connectNode(0, 1, 0);
|
||||
manager.layout();
|
||||
var graph = manager.plot("testReconnectSingleNode1", {width:1000, height:400});
|
||||
var prediction = manager.predict(0, {x:-50, y:0});
|
||||
var prediction = manager.predict(0, null, {x:-50, y:0});
|
||||
this._plotPrediction(graph, prediction);
|
||||
|
||||
// Check prediction is to the left of the root node
|
||||
|
Loading…
Reference in New Issue
Block a user