mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-12-23 03:43:48 +01:00
nlayout refactor.
This commit is contained in:
parent
90644c201a
commit
c7ddfd6135
@ -176,27 +176,27 @@
|
||||
files="widget/Menu.js"/>
|
||||
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="nlayout/EventBusDispatcher.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="nlayout/ChangeEvent.js"/>
|
||||
files="layout/EventBusDispatcher.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="layout/ChangeEvent.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="nlayout/LayoutManager.js"/>
|
||||
files="layout/LayoutManager.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="nlayout/Node.js"/>
|
||||
files="layout/Node.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="nlayout/RootedTreeSet.js"/>
|
||||
files="layout/RootedTreeSet.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="nlayout/ChildrenSorterStrategy.js"/>
|
||||
files="layout/ChildrenSorterStrategy.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="nlayout/AbstractBasicSorter.js"/>
|
||||
files="layout/AbstractBasicSorter.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="nlayout/BalancedSorter.js"/>
|
||||
files="layout/BalancedSorter.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="nlayout/SymmetricSorter.js"/>
|
||||
files="layout/SymmetricSorter.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="nlayout/GridSorter.js"/>
|
||||
files="layout/GridSorter.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="nlayout/OriginalLayout.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="nlayout/EventBus.js"/>
|
||||
files="layout/OriginalLayout.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="layout/EventBus.js"/>
|
||||
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="footer.js"/>
|
||||
</concat>
|
||||
|
@ -56,7 +56,7 @@ mindplot.Designer = new Class({
|
||||
this._relPivot = new mindplot.RelationshipPivot(this._workspace, this);
|
||||
|
||||
// Init layout manager ...
|
||||
this._eventBussDispatcher = new mindplot.nlayout.EventBusDispatcher(this.getModel());
|
||||
this._eventBussDispatcher = new mindplot.layout.EventBusDispatcher(this.getModel());
|
||||
},
|
||||
|
||||
_registerEvents : function() {
|
||||
|
@ -29,4 +29,4 @@ mindplot.collaboration.framework = {};
|
||||
mindplot.collaboration.framework.brix = {};
|
||||
mindplot.collaboration.framework.brix.model = {};
|
||||
|
||||
mindplot.nlayout = {};
|
||||
mindplot.layout = {};
|
||||
|
@ -15,8 +15,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.nlayout.AbstractBasicSorter = new Class({
|
||||
Extends: mindplot.nlayout.ChildrenSorterStrategy,
|
||||
mindplot.layout.AbstractBasicSorter = new Class({
|
||||
Extends: mindplot.layout.ChildrenSorterStrategy,
|
||||
|
||||
computeChildrenIdByHeights: function(treeSet, node) {
|
||||
var result = {};
|
||||
@ -25,7 +25,7 @@ mindplot.nlayout.AbstractBasicSorter = new Class({
|
||||
},
|
||||
|
||||
_computeChildrenHeight : function(treeSet, node, heightCache) {
|
||||
var height = node.getSize().height + (mindplot.nlayout.AbstractBasicSorter.INTERNODE_VERTICAL_PADDING * 2); // 2* Top and down padding;
|
||||
var height = node.getSize().height + (mindplot.layout.AbstractBasicSorter.INTERNODE_VERTICAL_PADDING * 2); // 2* Top and down padding;
|
||||
|
||||
var result;
|
||||
var children = treeSet.getChildren(node);
|
||||
@ -56,5 +56,5 @@ mindplot.nlayout.AbstractBasicSorter = new Class({
|
||||
}
|
||||
});
|
||||
|
||||
mindplot.nlayout.AbstractBasicSorter.INTERNODE_VERTICAL_PADDING = 5;
|
||||
mindplot.nlayout.AbstractBasicSorter.INTERNODE_HORIZONTAL_PADDING = 30;
|
||||
mindplot.layout.AbstractBasicSorter.INTERNODE_VERTICAL_PADDING = 5;
|
||||
mindplot.layout.AbstractBasicSorter.INTERNODE_HORIZONTAL_PADDING = 30;
|
@ -15,8 +15,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.nlayout.BalancedSorter = new Class({
|
||||
Extends: mindplot.nlayout.AbstractBasicSorter,
|
||||
mindplot.layout.BalancedSorter = new Class({
|
||||
Extends: mindplot.layout.AbstractBasicSorter,
|
||||
|
||||
initialize: function() {
|
||||
|
||||
@ -29,7 +29,7 @@ mindplot.nlayout.BalancedSorter = new Class({
|
||||
},
|
||||
|
||||
_computeChildrenHeight : function(treeSet, node, heightCache) {
|
||||
var height = node.getSize().height + (mindplot.nlayout.BalancedSorter.INTERNODE_VERTICAL_PADDING * 2); // 2* Top and down padding;
|
||||
var height = node.getSize().height + (mindplot.layout.BalancedSorter.INTERNODE_VERTICAL_PADDING * 2); // 2* Top and down padding;
|
||||
|
||||
var result;
|
||||
var children = treeSet.getChildren(node);
|
||||
@ -63,7 +63,7 @@ mindplot.nlayout.BalancedSorter = new Class({
|
||||
|
||||
// No children?
|
||||
if (children.length == 0) {
|
||||
return [0, {x:parent.getPosition().x + parent.getSize().width + mindplot.nlayout.BalancedSorter.INTERNODE_HORIZONTAL_PADDING * 2, y:parent.getPosition().y}];
|
||||
return [0, {x:parent.getPosition().x + parent.getSize().width + mindplot.layout.BalancedSorter.INTERNODE_HORIZONTAL_PADDING * 2, y:parent.getPosition().y}];
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ mindplot.nlayout.BalancedSorter = new Class({
|
||||
var cpos = child.getPosition();
|
||||
if (position.y > cpos.y) {
|
||||
yOffset = child == last ?
|
||||
child.getSize().height + mindplot.nlayout.BalancedSorter.INTERNODE_VERTICAL_PADDING * 2 :
|
||||
child.getSize().height + mindplot.layout.BalancedSorter.INTERNODE_VERTICAL_PADDING * 2 :
|
||||
(children[index + 1].getPosition().y - child.getPosition().y)/2;
|
||||
result = [child.getOrder() + 2,{x:cpos.x, y:cpos.y + yOffset}];
|
||||
}
|
||||
@ -86,7 +86,7 @@ mindplot.nlayout.BalancedSorter = new Class({
|
||||
var first = children[0];
|
||||
result = [position.x > 0 ? 0 : 1, {
|
||||
x:first.getPosition().x,
|
||||
y:first.getPosition().y - first.getSize().height - mindplot.nlayout.BalancedSorter.INTERNODE_VERTICAL_PADDING * 2
|
||||
y:first.getPosition().y - first.getSize().height - mindplot.layout.BalancedSorter.INTERNODE_VERTICAL_PADDING * 2
|
||||
}];
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ mindplot.nlayout.BalancedSorter = new Class({
|
||||
}
|
||||
|
||||
var yOffset = ysum + heights[i].height / 2;
|
||||
var xOffset = direction * (node.getSize().width/2 + heights[i].width/2 + + mindplot.nlayout.BalancedSorter.INTERNODE_HORIZONTAL_PADDING);
|
||||
var xOffset = direction * (node.getSize().width/2 + heights[i].width/2 + + mindplot.layout.BalancedSorter.INTERNODE_HORIZONTAL_PADDING);
|
||||
|
||||
$assert(!isNaN(xOffset), "xOffset can not be null");
|
||||
$assert(!isNaN(yOffset), "yOffset can not be null");
|
||||
@ -208,5 +208,5 @@ mindplot.nlayout.BalancedSorter = new Class({
|
||||
}
|
||||
});
|
||||
|
||||
mindplot.nlayout.BalancedSorter.INTERNODE_VERTICAL_PADDING = 5;
|
||||
mindplot.nlayout.BalancedSorter.INTERNODE_HORIZONTAL_PADDING = 30;
|
||||
mindplot.layout.BalancedSorter.INTERNODE_VERTICAL_PADDING = 5;
|
||||
mindplot.layout.BalancedSorter.INTERNODE_HORIZONTAL_PADDING = 30;
|
||||
|
@ -15,7 +15,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.nlayout.ChangeEvent = new Class({
|
||||
mindplot.layout.ChangeEvent = new Class({
|
||||
initialize:function(id) {
|
||||
$assert(!isNaN(id), "id can not be null");
|
||||
this._id = id;
|
||||
|
@ -15,7 +15,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.nlayout.ChildrenSorterStrategy = new Class({
|
||||
mindplot.layout.ChildrenSorterStrategy = new Class({
|
||||
initialize:function() {
|
||||
|
||||
},
|
||||
|
@ -15,14 +15,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.nlayout.EventBusDispatcher = new Class({
|
||||
mindplot.layout.EventBusDispatcher = new Class({
|
||||
|
||||
initialize:function(designerModel) {
|
||||
$assert(designerModel, "designerModel cannot be null");
|
||||
this.registerBusEvents();
|
||||
|
||||
var size = {width:25,height:25};
|
||||
this._layoutManager = new mindplot.nlayout.LayoutManager(0, size);
|
||||
this._layoutManager = new mindplot.layout.LayoutManager(0, size);
|
||||
|
||||
this._layoutManager.addEvent('change', function(event) {
|
||||
var id = event.getId();
|
||||
@ -51,7 +51,7 @@ mindplot.nlayout.EventBusDispatcher = new Class({
|
||||
},
|
||||
|
||||
_nodeMoveEvent: function(node) {
|
||||
console.log("mindplot.nlayout.EventBusDispatcher._nodeMoveEvent: Not Implemented yet");
|
||||
console.log("mindplot.layout.EventBusDispatcher._nodeMoveEvent: Not Implemented yet");
|
||||
|
||||
},
|
||||
|
||||
@ -65,7 +65,7 @@ mindplot.nlayout.EventBusDispatcher = new Class({
|
||||
},
|
||||
|
||||
_nodeRepositionateEvent: function(node) {
|
||||
console.log("mindplot.nlayout.EventBusDispatcher._nodeRepositionateEvent: Not Implemented yet");
|
||||
console.log("mindplot.layout.EventBusDispatcher._nodeRepositionateEvent: Not Implemented yet");
|
||||
|
||||
},
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.nlayout.GridSorter = new Class({
|
||||
Extends: mindplot.nlayout.AbstractBasicSorter,
|
||||
mindplot.layout.GridSorter = new Class({
|
||||
Extends: mindplot.layout.AbstractBasicSorter,
|
||||
|
||||
computeOffsets: function(treeSet, node) {
|
||||
$assert(treeSet, "treeSet can no be null.");
|
||||
@ -43,7 +43,7 @@ mindplot.nlayout.GridSorter = new Class({
|
||||
var finalHeight = i == 0 ? 0 : heights[i].height/2 * even;
|
||||
|
||||
var yOffset = zeroHeight + middleHeight +finalHeight;
|
||||
var xOffset = node.getSize().width + mindplot.nlayout.GridSorter.GRID_HORIZONTAR_SIZE;
|
||||
var xOffset = node.getSize().width + mindplot.layout.GridSorter.GRID_HORIZONTAR_SIZE;
|
||||
|
||||
$assert(!isNaN(xOffset), "xOffset can not be null");
|
||||
$assert(!isNaN(yOffset), "yOffset can not be null");
|
||||
@ -60,6 +60,6 @@ mindplot.nlayout.GridSorter = new Class({
|
||||
|
||||
});
|
||||
|
||||
mindplot.nlayout.GridSorter.GRID_HORIZONTAR_SIZE = 20;
|
||||
mindplot.nlayout.GridSorter.INTER_NODE_VERTICAL_DISTANCE = 50;
|
||||
mindplot.layout.GridSorter.GRID_HORIZONTAR_SIZE = 20;
|
||||
mindplot.layout.GridSorter.INTER_NODE_VERTICAL_DISTANCE = 50;
|
||||
|
||||
|
@ -15,14 +15,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.nlayout.LayoutManager = new Class({
|
||||
mindplot.layout.LayoutManager = new Class({
|
||||
Extends: Events,
|
||||
initialize: function(rootNodeId, rootSize) {
|
||||
$assert($defined(rootNodeId), "rootNodeId can not be null");
|
||||
$assert(rootSize, "rootSize can not be null");
|
||||
|
||||
this._treeSet = new mindplot.nlayout.RootedTreeSet();
|
||||
this._layout = new mindplot.nlayout.OriginalLayout(this._treeSet);
|
||||
this._treeSet = new mindplot.layout.RootedTreeSet();
|
||||
this._layout = new mindplot.layout.OriginalLayout(this._treeSet);
|
||||
|
||||
var rootNode = this._layout.createNode(rootNodeId, rootSize, {x:0,y:0}, 'root');
|
||||
this._treeSet.setRoot(rootNode);
|
||||
@ -145,7 +145,7 @@ mindplot.nlayout.LayoutManager = new Class({
|
||||
return event.id == id;
|
||||
});
|
||||
if (!event) {
|
||||
event = new mindplot.nlayout.ChangeEvent(id);
|
||||
event = new mindplot.layout.ChangeEvent(id);
|
||||
}
|
||||
|
||||
// Update nodes ...
|
||||
|
@ -15,7 +15,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.nlayout.Node = new Class({
|
||||
mindplot.layout.Node = new Class({
|
||||
initialize:function(id, size, position, sorter) {
|
||||
$assert(typeof id === 'number' && isFinite(id), "id can not be null");
|
||||
$assert(size, "size can not be null");
|
||||
|
@ -15,7 +15,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.nlayout.OriginalLayout = new Class({
|
||||
mindplot.layout.OriginalLayout = new Class({
|
||||
initialize: function(treeSet) {
|
||||
this._treeSet = treeSet;
|
||||
},
|
||||
@ -27,9 +27,9 @@ mindplot.nlayout.OriginalLayout = new Class({
|
||||
$assert(type, "type can not be null");
|
||||
|
||||
var strategy = type === 'root' ?
|
||||
mindplot.nlayout.OriginalLayout.BALANCED_SORTER :
|
||||
mindplot.nlayout.OriginalLayout.SYMMETRIC_SORTER;
|
||||
return new mindplot.nlayout.Node(id, size, position, strategy);
|
||||
mindplot.layout.OriginalLayout.BALANCED_SORTER :
|
||||
mindplot.layout.OriginalLayout.SYMMETRIC_SORTER;
|
||||
return new mindplot.layout.Node(id, size, position, strategy);
|
||||
},
|
||||
|
||||
connectNode: function(parentId, childId, order) {
|
||||
@ -121,8 +121,8 @@ mindplot.nlayout.OriginalLayout = new Class({
|
||||
|
||||
});
|
||||
|
||||
mindplot.nlayout.OriginalLayout.SYMMETRIC_SORTER = new mindplot.nlayout.SymmetricSorter();
|
||||
mindplot.nlayout.OriginalLayout.BALANCED_SORTER = new mindplot.nlayout.BalancedSorter();
|
||||
mindplot.layout.OriginalLayout.SYMMETRIC_SORTER = new mindplot.layout.SymmetricSorter();
|
||||
mindplot.layout.OriginalLayout.BALANCED_SORTER = new mindplot.layout.BalancedSorter();
|
||||
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.nlayout.RootedTreeSet = new Class({
|
||||
mindplot.layout.RootedTreeSet = new Class({
|
||||
initialize:function() {
|
||||
this._rootNodes = [];
|
||||
},
|
||||
|
@ -15,8 +15,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.nlayout.SymmetricSorter = new Class({
|
||||
Extends: mindplot.nlayout.AbstractBasicSorter,
|
||||
mindplot.layout.SymmetricSorter = new Class({
|
||||
Extends: mindplot.layout.AbstractBasicSorter,
|
||||
initialize:function() {
|
||||
|
||||
},
|
||||
@ -29,7 +29,7 @@ mindplot.nlayout.SymmetricSorter = new Class({
|
||||
if (children.length == 0) {
|
||||
position = position || {x:parent.getPosition().x + direction, y:parent.getPosition().y};
|
||||
var position = {
|
||||
x: parent.getPosition().x + direction * (parent.getSize().width + mindplot.nlayout.SymmetricSorter.INTERNODE_HORIZONTAL_PADDING),
|
||||
x: parent.getPosition().x + direction * (parent.getSize().width + mindplot.layout.SymmetricSorter.INTERNODE_HORIZONTAL_PADDING),
|
||||
y:parent.getPosition().y
|
||||
}
|
||||
return [0, position];
|
||||
@ -43,7 +43,7 @@ mindplot.nlayout.SymmetricSorter = new Class({
|
||||
var cpos = child.getPosition();
|
||||
if (position.y > cpos.y) {
|
||||
yOffset = child == last ?
|
||||
child.getSize().height + mindplot.nlayout.SymmetricSorter.INTERNODE_VERTICAL_PADDING * 2 :
|
||||
child.getSize().height + mindplot.layout.SymmetricSorter.INTERNODE_VERTICAL_PADDING * 2 :
|
||||
(children[index + 1].getPosition().y + children[index + 1].getSize().height/2 - child.getPosition().y)/2;
|
||||
result = [child.getOrder() + 1,{x:cpos.x, y:cpos.y + yOffset}];
|
||||
}
|
||||
@ -54,7 +54,7 @@ mindplot.nlayout.SymmetricSorter = new Class({
|
||||
var first = children[0];
|
||||
result = [0, {
|
||||
x:first.getPosition().x,
|
||||
y:first.getPosition().y - first.getSize().height - mindplot.nlayout.SymmetricSorter.INTERNODE_VERTICAL_PADDING * 2
|
||||
y:first.getPosition().y - first.getSize().height - mindplot.layout.SymmetricSorter.INTERNODE_VERTICAL_PADDING * 2
|
||||
}];
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ mindplot.nlayout.SymmetricSorter = new Class({
|
||||
var direction = parent.getPosition().x > 0 ? 1 : -1;
|
||||
|
||||
var yOffset = ysum + heights[i].height / 2;
|
||||
var xOffset = direction * (heights[i].width/2 + node.getSize().width/2 + mindplot.nlayout.SymmetricSorter.INTERNODE_HORIZONTAL_PADDING);
|
||||
var xOffset = direction * (heights[i].width/2 + node.getSize().width/2 + mindplot.layout.SymmetricSorter.INTERNODE_HORIZONTAL_PADDING);
|
||||
|
||||
$assert(!isNaN(xOffset), "xOffset can not be null");
|
||||
$assert(!isNaN(yOffset), "yOffset can not be null");
|
||||
@ -140,7 +140,7 @@ mindplot.nlayout.SymmetricSorter = new Class({
|
||||
}
|
||||
});
|
||||
|
||||
mindplot.nlayout.SymmetricSorter.INTERNODE_VERTICAL_PADDING = 5;
|
||||
mindplot.nlayout.SymmetricSorter.INTERNODE_HORIZONTAL_PADDING = 30;
|
||||
mindplot.layout.SymmetricSorter.INTERNODE_VERTICAL_PADDING = 5;
|
||||
mindplot.layout.SymmetricSorter.INTERNODE_HORIZONTAL_PADDING = 30;
|
||||
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
mindplot.nlayout.TestSuite = new Class({
|
||||
Extends: mindplot.nlayout.ChildrenSorterStrategy,
|
||||
mindplot.layout.TestSuite = new Class({
|
||||
Extends: mindplot.layout.ChildrenSorterStrategy,
|
||||
|
||||
initialize:function() {
|
||||
this.testAligned();
|
||||
@ -35,12 +35,12 @@ mindplot.nlayout.TestSuite = new Class({
|
||||
testAligned: function() {
|
||||
|
||||
var position = {x:0,y:0};
|
||||
var manager = new mindplot.nlayout.LayoutManager(0, mindplot.nlayout.TestSuite.ROOT_NODE_SIZE);
|
||||
var manager = new mindplot.layout.LayoutManager(0, mindplot.layout.TestSuite.ROOT_NODE_SIZE);
|
||||
|
||||
manager.addNode(1, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(1, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(0, 1, 0);
|
||||
manager.connectNode(1, 2, 0);
|
||||
manager.connectNode(2, 3, 0);
|
||||
@ -58,22 +58,22 @@ mindplot.nlayout.TestSuite = new Class({
|
||||
|
||||
testSymmetry: function() {
|
||||
var position = {x:0,y:0};
|
||||
var manager = new mindplot.nlayout.LayoutManager(0, mindplot.nlayout.TestSuite.ROOT_NODE_SIZE);
|
||||
var manager = new mindplot.layout.LayoutManager(0, mindplot.layout.TestSuite.ROOT_NODE_SIZE);
|
||||
|
||||
manager.addNode(1, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(6, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(7, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(8, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(9, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(10, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(11, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(12, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(13, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(14, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(1, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(6, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(7, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(8, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(9, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(10, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(11, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(12, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(13, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(14, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(0, 14, 0);
|
||||
manager.connectNode(14, 13, 0);
|
||||
manager.connectNode(13, 1, 0);
|
||||
@ -103,79 +103,79 @@ mindplot.nlayout.TestSuite = new Class({
|
||||
testBalanced: function() {
|
||||
var position = {x:0, y:0};
|
||||
var plotsize = {width:1000, height:200};
|
||||
var manager = new mindplot.nlayout.LayoutManager(0, mindplot.nlayout.TestSuite.ROOT_NODE_SIZE);
|
||||
var manager = new mindplot.layout.LayoutManager(0, mindplot.layout.TestSuite.ROOT_NODE_SIZE);
|
||||
|
||||
manager.addNode(1, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(1, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(0, 1, 0);
|
||||
manager.layout();
|
||||
manager.plot("testBalanced1", plotsize);
|
||||
|
||||
manager.addNode(2, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(0, 2, 1);
|
||||
manager.layout();
|
||||
manager.plot("testBalanced2", plotsize);
|
||||
|
||||
manager.addNode(3, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(0, 3, 2);
|
||||
manager.layout();
|
||||
manager.plot("testBalanced3", plotsize);
|
||||
|
||||
manager.addNode(4, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(0, 4, 3);
|
||||
manager.layout();
|
||||
manager.plot("testBalanced4", plotsize);
|
||||
|
||||
manager.addNode(5, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(0, 5, 4);
|
||||
manager.layout();
|
||||
manager.plot("testBalanced5", plotsize);
|
||||
|
||||
manager.addNode(6, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(6, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(0, 6, 5);
|
||||
manager.layout();
|
||||
manager.plot("testBalanced6", plotsize);
|
||||
|
||||
manager.addNode(7, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(8, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(9, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(7, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(8, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(9, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(3, 7, 0)
|
||||
manager.connectNode(7, 8, 0)
|
||||
manager.connectNode(7, 9, 1);
|
||||
manager.layout();
|
||||
manager.plot("testBalanced7", plotsize);
|
||||
|
||||
manager.addNode(10, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(11, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(12, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(10, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(11, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(12, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(6, 10, 0)
|
||||
manager.connectNode(10, 11, 0)
|
||||
manager.connectNode(10, 12, 1);
|
||||
manager.layout();
|
||||
manager.plot("testBalanced8", plotsize);
|
||||
|
||||
manager.addNode(13, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(13, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(0, 13, 4);
|
||||
manager.layout();
|
||||
manager.plot("testBalanced9", {width:1000, height:400});
|
||||
|
||||
manager.addNode(14, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(14, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(0, 14, 5);
|
||||
manager.layout();
|
||||
manager.plot("testBalanced10", {width:1000, height:400});
|
||||
|
||||
manager.addNode(15, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(15, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(0, 15, 4);
|
||||
manager.layout();
|
||||
manager.plot("testBalanced11", {width:1000, height:400});
|
||||
|
||||
manager.addNode(16, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(16, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(0, 16, 25);
|
||||
manager.layout();
|
||||
manager.plot("testBalanced12", {width:1000, height:400});
|
||||
|
||||
manager.addNode(17, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(18, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(19, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(17, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(18, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(19, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(0, 17, 11);
|
||||
manager.connectNode(0, 18, 13);
|
||||
manager.connectNode(0, 19, 10);
|
||||
@ -202,13 +202,13 @@ mindplot.nlayout.TestSuite = new Class({
|
||||
testEvents: function() {
|
||||
console.log("testEvents:");
|
||||
var position = {x:0,y:0};
|
||||
var manager = new mindplot.nlayout.LayoutManager(0, mindplot.nlayout.TestSuite.ROOT_NODE_SIZE);
|
||||
var manager = new mindplot.layout.LayoutManager(0, mindplot.layout.TestSuite.ROOT_NODE_SIZE);
|
||||
|
||||
// Add 3 nodes...
|
||||
manager.addNode(1, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.nlayout.TestSuite.NODE_SIZE, {x:0, y: 60});
|
||||
manager.addNode(1, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.layout.TestSuite.NODE_SIZE, {x:0, y: 60});
|
||||
|
||||
// Now connect one with two....
|
||||
manager.connectNode(0, 1, 0);
|
||||
@ -239,15 +239,15 @@ mindplot.nlayout.TestSuite = new Class({
|
||||
testEventsComplex: function() {
|
||||
console.log("testEventsComplex:");
|
||||
var position = {x:0,y:0};
|
||||
var manager = new mindplot.nlayout.LayoutManager(0, mindplot.nlayout.TestSuite.ROOT_NODE_SIZE);
|
||||
var manager = new mindplot.layout.LayoutManager(0, mindplot.layout.TestSuite.ROOT_NODE_SIZE);
|
||||
|
||||
// Add 3 nodes...
|
||||
manager.addNode(1, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(6, mindplot.nlayout.TestSuite.NODE_SIZE, {x:0, y:60});
|
||||
manager.addNode(1, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(6, mindplot.layout.TestSuite.NODE_SIZE, {x:0, y:60});
|
||||
|
||||
// Now connect one with two....
|
||||
manager.connectNode(0, 1, 0);
|
||||
@ -283,16 +283,16 @@ mindplot.nlayout.TestSuite = new Class({
|
||||
testDisconnect: function() {
|
||||
console.log("testDisconnect:");
|
||||
var position = {x:0,y:0};
|
||||
var manager = new mindplot.nlayout.LayoutManager(0, mindplot.nlayout.TestSuite.ROOT_NODE_SIZE);
|
||||
var manager = new mindplot.layout.LayoutManager(0, mindplot.layout.TestSuite.ROOT_NODE_SIZE);
|
||||
|
||||
// Prepare a sample graph ...
|
||||
manager.addNode(1, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(6, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(7, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(1, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(6, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(7, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
|
||||
manager.connectNode(0, 1, 0);
|
||||
manager.connectNode(1, 2, 0);
|
||||
@ -341,20 +341,20 @@ mindplot.nlayout.TestSuite = new Class({
|
||||
|
||||
testReconnect: function() {
|
||||
var position = {x:0,y:0};
|
||||
var manager = new mindplot.nlayout.LayoutManager(0, mindplot.nlayout.TestSuite.ROOT_NODE_SIZE);
|
||||
var manager = new mindplot.layout.LayoutManager(0, mindplot.layout.TestSuite.ROOT_NODE_SIZE);
|
||||
|
||||
manager.addNode(1, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(6, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(7, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(8, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(9, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(10, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(11, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(12, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(1, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(6, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(7, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(8, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(9, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(10, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(11, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(12, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.connectNode(0, 1, 0);
|
||||
manager.connectNode(0, 2, 1);
|
||||
manager.connectNode(0, 3, 2);
|
||||
@ -389,18 +389,18 @@ mindplot.nlayout.TestSuite = new Class({
|
||||
testRemoveNode: function() {
|
||||
console.log("testRemoveNode:");
|
||||
var position = {x:0,y:0};
|
||||
var manager = new mindplot.nlayout.LayoutManager(0, mindplot.nlayout.TestSuite.ROOT_NODE_SIZE);
|
||||
var manager = new mindplot.layout.LayoutManager(0, mindplot.layout.TestSuite.ROOT_NODE_SIZE);
|
||||
|
||||
// Prepare a sample graph ...
|
||||
manager.addNode(1, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(6, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(7, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(8, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(9, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(1, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(6, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(7, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(8, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(9, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
|
||||
manager.connectNode(0, 1, 0);
|
||||
manager.connectNode(0, 5, 1);
|
||||
@ -447,20 +447,20 @@ mindplot.nlayout.TestSuite = new Class({
|
||||
testSymmetricPredict: function() {
|
||||
console.log("testSymmetricPredict:");
|
||||
var position = {x:0,y:0};
|
||||
var manager = new mindplot.nlayout.LayoutManager(0, mindplot.nlayout.TestSuite.ROOT_NODE_SIZE);
|
||||
var manager = new mindplot.layout.LayoutManager(0, mindplot.layout.TestSuite.ROOT_NODE_SIZE);
|
||||
|
||||
// Prepare a sample graph ...
|
||||
manager.addNode(1, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(6, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(7, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(8, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(9, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(10, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(11, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(1, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(6, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(7, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(8, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(9, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(10, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(11, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
|
||||
manager.connectNode(0, 1, 0);
|
||||
manager.connectNode(0, 2, 1);
|
||||
@ -513,18 +513,18 @@ mindplot.nlayout.TestSuite = new Class({
|
||||
testBalancedPredict: function() {
|
||||
console.log("testBalancedPredict");
|
||||
var position = {x:0, y:0};
|
||||
var manager = new mindplot.nlayout.LayoutManager(0, mindplot.nlayout.TestSuite.ROOT_NODE_SIZE);
|
||||
var manager = new mindplot.layout.LayoutManager(0, mindplot.layout.TestSuite.ROOT_NODE_SIZE);
|
||||
|
||||
manager.addNode(1, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(7, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(8, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(9, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(10, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(11, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(1, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(7, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(8, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(9, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(10, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(11, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
|
||||
manager.connectNode(0,1,0);
|
||||
manager.connectNode(0,2,1);
|
||||
@ -581,31 +581,31 @@ mindplot.nlayout.TestSuite = new Class({
|
||||
|
||||
_plotPrediction: function(canvas, prediction) {
|
||||
console.log("\t\tprediction {order:" + prediction[0] + ", position: (" + prediction.getLast().x + "," + prediction.getLast().y + ")}");
|
||||
var cx = prediction.getLast().x + canvas.width / 2 - mindplot.nlayout.TestSuite.NODE_SIZE.width / 2;
|
||||
var cy = prediction.getLast().y + canvas.height / 2 - mindplot.nlayout.TestSuite.NODE_SIZE.height / 2;
|
||||
canvas.rect(cx, cy, mindplot.nlayout.TestSuite.NODE_SIZE.width, mindplot.nlayout.TestSuite.NODE_SIZE.height);
|
||||
var cx = prediction.getLast().x + canvas.width / 2 - mindplot.layout.TestSuite.NODE_SIZE.width / 2;
|
||||
var cy = prediction.getLast().y + canvas.height / 2 - mindplot.layout.TestSuite.NODE_SIZE.height / 2;
|
||||
canvas.rect(cx, cy, mindplot.layout.TestSuite.NODE_SIZE.width, mindplot.layout.TestSuite.NODE_SIZE.height);
|
||||
},
|
||||
|
||||
testSize: function() {
|
||||
var position = {x:0, y:0};
|
||||
var manager = new mindplot.nlayout.LayoutManager(0, mindplot.nlayout.TestSuite.ROOT_NODE_SIZE);
|
||||
var manager = new mindplot.layout.LayoutManager(0, mindplot.layout.TestSuite.ROOT_NODE_SIZE);
|
||||
|
||||
manager.addNode(1, {width: 60, height: 60}, position);
|
||||
manager.addNode(2, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(2, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(3, {width: 260, height: 30}, position);
|
||||
manager.addNode(4, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(4, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(5, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(7, {width: 80, height: 80}, position);
|
||||
manager.addNode(8, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(8, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(9, {width: 30, height: 30}, position);
|
||||
manager.addNode(10, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(11, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(10, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(11, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(12, {width: 100, height: 70}, position);
|
||||
manager.addNode(13, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(14, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(15, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(16, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(17, mindplot.nlayout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(13, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(14, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(15, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(16, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
manager.addNode(17, mindplot.layout.TestSuite.NODE_SIZE, position);
|
||||
|
||||
manager.connectNode(0,1,0);
|
||||
manager.connectNode(1,16,0);
|
||||
@ -641,6 +641,6 @@ mindplot.nlayout.TestSuite = new Class({
|
||||
}
|
||||
});
|
||||
|
||||
mindplot.nlayout.TestSuite.NODE_SIZE = {width:80, height:30},
|
||||
mindplot.nlayout.TestSuite.ROOT_NODE_SIZE = {width:120, height:40}
|
||||
mindplot.layout.TestSuite.NODE_SIZE = {width:80, height:30},
|
||||
mindplot.layout.TestSuite.ROOT_NODE_SIZE = {width:120, height:40}
|
||||
|
||||
|
@ -7,17 +7,17 @@
|
||||
|
||||
|
||||
<script type='text/javascript' src='../../../main/javascript/header.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/nlayout/Node.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/nlayout/RootedTreeSet.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/layout/Node.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/layout/RootedTreeSet.js'></script>
|
||||
|
||||
<script type='text/javascript' src='../../../main/javascript/nlayout/LayoutManager.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/nlayout/ChildrenSorterStrategy.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/nlayout/AbstractBasicSorter.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/nlayout/SymmetricSorter.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/nlayout/GridSorter.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/nlayout/BalancedSorter.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/nlayout/OriginalLayout.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/nlayout/ChangeEvent.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/layout/LayoutManager.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/layout/ChildrenSorterStrategy.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/layout/AbstractBasicSorter.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/layout/SymmetricSorter.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/layout/GridSorter.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/layout/BalancedSorter.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/layout/OriginalLayout.js'></script>
|
||||
<script type='text/javascript' src='../../../main/javascript/layout/ChangeEvent.js'></script>
|
||||
|
||||
<script type="text/javascript" src="raphael-min.js"></script>
|
||||
<script type="text/javascript" src="raphael-plugins.js"></script>
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
<script type='text/javascript'>
|
||||
window.addEvent('domready', function() {
|
||||
var test = new mindplot.nlayout.TestSuite();
|
||||
var test = new mindplot.layout.TestSuite();
|
||||
})
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user