diff --git a/mindplot/src/main/javascript/MindmapDesigner.js b/mindplot/src/main/javascript/MindmapDesigner.js index cc48b115..c41d10fa 100644 --- a/mindplot/src/main/javascript/MindmapDesigner.js +++ b/mindplot/src/main/javascript/MindmapDesigner.js @@ -554,7 +554,7 @@ mindplot.MindmapDesigner.prototype._nodeModelToNodeGraph = function(nodeModel) var children = nodeModel.getChildren().slice(); // Sort children by order to solve adding order ... - if (children.length > 0) + if (nodeGraph.getTopicType()!=mindplot.NodeModel.CENTRAL_TOPIC_TYPE && children.length > 0) { var oldChildren = children; children = []; diff --git a/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java b/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java index 0300addc..5def58b7 100755 --- a/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java +++ b/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java @@ -33,6 +33,7 @@ import javax.xml.bind.JAXBException; import java.io.InputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.math.BigInteger; @@ -60,11 +61,12 @@ public class FreemindImporter centralTopic.setCentral(true); setNodePropertiesToTopic(centralTopic,centralNode); - centralTopic.setShape(ShapeStyle.ROUNDED_RETAGLE.getStyle()); + centralTopic.setShape(ShapeStyle.ELIPSE.getStyle()); mindmapMap.getTopic().add(centralTopic); mindmapMap.setName(mapName); addTopicFromNode(centralNode,centralTopic); + fixCentralTopicChildOrder(centralTopic); ByteArrayOutputStream out = new ByteArrayOutputStream(); JAXBUtils.saveMap(mindmapMap,out,"com.wisemapping.xml.mindmap"); @@ -84,6 +86,84 @@ public class FreemindImporter return map; } + private void fixCentralTopicChildOrder(TopicType centralTopic){ + List topics = centralTopic.getTopic(); + List leftTopics = new ArrayList(); + List rightTopics = new ArrayList(); + + for (TopicType topic : topics){ + if(isOnLeftSide(topic)){ + leftTopics.add(topic); + } else { + rightTopics.add(topic); + } + } + + if(leftTopics.size()>0){ + int size = leftTopics.size(); + int index = 0; + int center = size/2; + if(size %2==0){ //Even number, then place middle point in 1 index + index = 1; + center--; + } + int index2=index; + + leftTopics.get(center).setOrder(index); + for(int i = center-1; i>=0; i--){ + if(index==0){ + index++; + }else{ + index+=2; + } + leftTopics.get(i).setOrder(index); + } + index=index2; + for(int i = center+1; i0){ + int size = rightTopics.size(); + int index = 0; + int center = size/2; + if(size %2==0){ //Even number, then place middle point in 1 index + index = 1; + center--; + } + int index2=index; + rightTopics.get(center).setOrder(index); + for(int i = center-1; i>=0; i--){ + if(index==0){ + index++; + }else{ + index+=2; + } + rightTopics.get(i).setOrder(index); + } + index=index2; + for(int i = center+1; i freemindNodes = mainNode.getArrowlinkOrCloudOrEdge();