mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +01:00
Add migrator for Pela to Tango
This commit is contained in:
parent
7ec7c18524
commit
0e07e28b4c
@ -95,6 +95,8 @@
|
||||
files="XMLMindmapSerializer_Pela.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="XMLMindmapSerializer_Tango.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="Pela2TangoMigrator.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/"
|
||||
files="XMLMindmapSerializer_Beta.js"/>
|
||||
<filelist dir="${basedir}/src/main/javascript/" files="Beta2PelaMigrator.js"/>
|
||||
|
@ -330,7 +330,6 @@ mindplot.Designer = new Class({
|
||||
var layoutManager = this._eventBussDispatcher.getLayoutManager();
|
||||
var result = layoutManager.predict(topic.getId(), mousePos);
|
||||
childModel.setOrder(result.order);
|
||||
console.log(result.order);
|
||||
|
||||
var position = result.position;
|
||||
childModel.setPosition(position.x, position.y);
|
||||
@ -420,6 +419,18 @@ mindplot.Designer = new Class({
|
||||
$assert(mindmapModel, "mindmapModel can not be null");
|
||||
this._mindmap = mindmapModel;
|
||||
|
||||
// Init layout manager ...
|
||||
var size = {width:25,height:25};
|
||||
var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size);
|
||||
layoutManager.addEvent('change', function(event) {
|
||||
var id = event.getId();
|
||||
var topic = this.getModel().findTopicById(id);
|
||||
topic.setPosition(event.getPosition());
|
||||
topic.setOrder(event.getOrder());
|
||||
}.bind(this));
|
||||
this._eventBussDispatcher.setLayoutManager(layoutManager);
|
||||
|
||||
|
||||
// Building node graph ...
|
||||
var branches = mindmapModel.getBranches();
|
||||
for (var i = 0; i < branches.length; i++) {
|
||||
|
@ -29,9 +29,38 @@ mindplot.Pela2TangoMigrator = new Class({
|
||||
$assert($defined(mapId), "mapId can not be null");
|
||||
var mindmap = this._pelaSerializer.loadFromDom(dom, mapId);
|
||||
mindmap.setVersion(mindplot.ModelCodeName.TANGO);
|
||||
|
||||
// @todo: Cocinar los ordenes ....
|
||||
|
||||
this._fixOrder(mindmap);
|
||||
return mindmap;
|
||||
},
|
||||
|
||||
_fixOrder : function(mindmap) {
|
||||
// First level node policies has been changed.
|
||||
var centralNode = mindmap.getBranches()[0];
|
||||
var children = centralNode.getChildren();
|
||||
var leftNodes = [];
|
||||
var rightNodes = [];
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
var position = child.getPosition();
|
||||
if (position.x < 0) {
|
||||
leftNodes.push(child);
|
||||
} else {
|
||||
rightNodes.push(child);
|
||||
}
|
||||
}
|
||||
rightNodes.sort(function(a, b) {
|
||||
return a.getOrder() > b.getOrder()
|
||||
});
|
||||
leftNodes.sort(function(a, b) {
|
||||
return a.getOrder() > b.getOrder();
|
||||
});
|
||||
|
||||
for (i = 0; i < rightNodes.length; i++) {
|
||||
rightNodes[i].setOrder(i*2);
|
||||
}
|
||||
|
||||
for (i = 0; i < leftNodes.length; i++) {
|
||||
leftNodes[i].setOrder(i*2+1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -194,11 +194,11 @@ mindplot.Topic = new Class({
|
||||
};
|
||||
|
||||
var setStrokeFunction = result.setStroke;
|
||||
result.setFill = function(color) {
|
||||
result.setFill = function() {
|
||||
|
||||
};
|
||||
|
||||
result.setStroke = function(color) {
|
||||
result.setStroke = function() {
|
||||
|
||||
};
|
||||
}
|
||||
@ -1091,7 +1091,7 @@ mindplot.Topic = new Class({
|
||||
var size = this.getFontSize();
|
||||
this.setFontSize(size, false);
|
||||
}
|
||||
var textShape = this.getTextShape();
|
||||
this.getTextShape();
|
||||
|
||||
// Display connection node...
|
||||
var connector = targetTopic.getShrinkConnector();
|
||||
@ -1141,7 +1141,9 @@ mindplot.Topic = new Class({
|
||||
var elem = this.get2DElement();
|
||||
workspace.appendChild(elem);
|
||||
if (!this.isInWorkspace()) {
|
||||
if (this.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeAdded, this.getModel());
|
||||
}
|
||||
|
||||
if (this.getModel().isConnected())
|
||||
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeConnectEvent, {parentNode:this.getOutgoingConnectedTopic().getModel(), childNode: this.getModel()});
|
||||
|
@ -17,19 +17,12 @@
|
||||
*/
|
||||
mindplot.layout.EventBusDispatcher = new Class({
|
||||
|
||||
initialize:function(designerModel) {
|
||||
$assert(designerModel, "designerModel cannot be null");
|
||||
initialize:function() {
|
||||
this.registerBusEvents();
|
||||
},
|
||||
|
||||
var size = {width:25,height:25};
|
||||
this._layoutManager = new mindplot.layout.LayoutManager(0, size);
|
||||
|
||||
this._layoutManager.addEvent('change', function(event) {
|
||||
var id = event.getId();
|
||||
var topic = designerModel.findTopicById(id);
|
||||
topic.setPosition(event.getPosition());
|
||||
topic.setOrder(event.getOrder());
|
||||
});
|
||||
setLayoutManager : function(layoutManager) {
|
||||
this._layoutManager = layoutManager;
|
||||
},
|
||||
|
||||
registerBusEvents:function () {
|
||||
|
@ -25,7 +25,7 @@
|
||||
$(document).fireEvent('loadcomplete', 'brix');
|
||||
};
|
||||
|
||||
var mapId = 'mapId'; // @todo: Must be changed ...
|
||||
var mapId = 'welcome'; // @todo: Must be changed ...
|
||||
var brixReady = false;
|
||||
var mindReady = false;
|
||||
var collab = 'standalone';
|
||||
@ -59,12 +59,12 @@
|
||||
// Load map from XML ...
|
||||
var persitence = mindplot.PersitenceManager.getInstance();
|
||||
var mindmap;
|
||||
try {
|
||||
// try {
|
||||
mindmap = persitence.load(mapId);
|
||||
} catch(e) {
|
||||
// If the map could not be loaded, create a new empty map...
|
||||
mindmap = mindplot.model.Mindmap.buildEmpty(mapId);
|
||||
}
|
||||
// } catch(e) {
|
||||
// // If the map could not be loaded, create a new empty map...
|
||||
// mindmap = mindplot.model.Mindmap.buildEmpty(mapId);
|
||||
// }
|
||||
|
||||
designer.loadMap(mindmap);
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
<map name="mapId" version="pela">
|
||||
<topic central="true" id="0">
|
||||
<topic position="127,-163" order="0" id="1"/>
|
||||
<topic position="-127,-33" order="1" id="2"/>
|
||||
<topic position="127,-130" order="2" id="3"/>
|
||||
<topic position="-127,0" order="3" id="4"/>
|
||||
<topic position="127,94" order="6" id="5">
|
||||
<topic position="251,94" order="0" text="ddddddddddddddddddddd" id="8">
|
||||
<topic position="364,55" order="0" id="9"/>
|
||||
<topic position="364,81" order="1" id="10"/>
|
||||
<topic position="364,107" order="2" id="11"/>
|
||||
<topic position="364,133" order="3" id="12"/>
|
||||
</topic>
|
||||
</topic>
|
||||
<topic position="-127,33" order="5" id="6"/>
|
||||
<topic position="127,163" order="8" id="7"/>
|
||||
<topic position="127,-35" order="4" id="13">
|
||||
<topic position="216,-100" order="0" id="14"/>
|
||||
<topic position="216,-74" order="1" id="15"/>
|
||||
<topic position="216,3" order="4" id="16"/>
|
||||
<topic position="216,-48" order="2" id="17"/>
|
||||
<topic position="216,29" order="5" id="18"/>
|
||||
<topic position="216,-22" order="3" id="19"/>
|
||||
</topic>
|
||||
</topic>
|
||||
</map>
|
@ -33,7 +33,7 @@
|
||||
<topic position="266,0" order="0" text="Try it Now!" id="11" fontStyle=";;#ffffff;;;" bgColor="#250be3"
|
||||
brColor="#080559">
|
||||
<topic position="358,-33" order="0" text="Double Click" id="12" fontStyle=";;#001be6;;italic;"/>
|
||||
<topic position="362,-9" order="1" text="" INS" to insert" id="13" fontStyle=";;#001be6;;italic;"/>
|
||||
<topic position="362,-9" order="1" text=" INS to insert" id="13" fontStyle=";;#001be6;;italic;"/>
|
||||
<topic position="371,15" order="2" text="Drag map to move" id="14" fontStyle=";;#001be6;;italic;"/>
|
||||
</topic>
|
||||
<topic position="299,-100" order="3" text="Mind Mapping" id="6" fontStyle=";;#602378;;;" bgColor="#edabff">
|
||||
|
Loading…
Reference in New Issue
Block a user