瀏覽代碼

6.0.2.3 release

David Benson 8 年之前
父節點
當前提交
7821a66688

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+13-DEC-2016: 6.0.2.3
+
+- Improves .vsdx import text handling
+
 12-DEC-2016: 6.0.2.2
 
 - Improves .vsdx import

+ 1 - 1
VERSION

@@ -1 +1 @@
-6.0.2.2
+6.0.2.3

+ 6 - 5
src/com/mxgraph/io/mxVsdxCodec.java

@@ -478,9 +478,11 @@ public class mxVsdxCodec
 		String style = mxVsdxUtils.getStyleString(styleMap, "=");
 
 		mxCell group = null;
+		Map<Integer, VsdxShape> children = shape.getChildShapes();
+		boolean hasChildren = false;//children != null && children.size() > 0;
+		boolean subLabel = shape.isDisplacedLabel() || shape.isRotatedLabel() || hasChildren;
 
-
-		if (shape.isDisplacedLabel() || shape.isRotatedLabel())
+		if (subLabel)
 		{
 			group = (mxCell) graph.insertVertex(parent, null, null,
 					o.getX(), o.getY(), d.getX(), d.getY(), style);
@@ -491,8 +493,6 @@ public class mxVsdxCodec
 					o.getX(), o.getY(), d.getX(), d.getY(), style);
 		}
 
-		// Add children
-		Map<Integer, VsdxShape> children = shape.getChildShapes();
 		Iterator<Map.Entry<Integer, VsdxShape>> entries = children.entrySet()
 				.iterator();
 		
@@ -552,7 +552,7 @@ public class mxVsdxCodec
 			}
 		}
 		
-		if (shape.isDisplacedLabel() || shape.isRotatedLabel())
+		if (subLabel)
 		{
 			createLabelSubShape(graph, shape, group);
 		}
@@ -945,6 +945,7 @@ public class mxVsdxCodec
 				styleMap.put("align", "center");
 				styleMap.put("verticalAlign", "middle");
 				styleMap.put("whiteSpace", "wrap");
+				//styleMap.put("html", "1");
 
 				if (!txtAngleV.equals(""))
 				{

+ 1 - 1
src/com/mxgraph/io/vsdx/Shape.java

@@ -1422,7 +1422,7 @@ public class Shape extends Style
 	public String getTextSize(String index)
 	{
 		Element sizeElem = getCellElement(mxVsdxConstants.SIZE, index, mxVsdxConstants.CHARACTER);
-		double size = getValueAsDouble(sizeElem, 12);
+		double size = getScreenNumericalValue(sizeElem, 12);
 		
 		return String.valueOf(size);
 	}

+ 12 - 3
src/com/mxgraph/io/vsdx/VsdxShape.java

@@ -306,11 +306,11 @@ public class VsdxShape extends Shape
 	{
 		// Lazy init
 		paragraphs = new LinkedHashMap<String,Paragraph>();
+		String ch = null;
+		String pg = null;
 
 		for (int index = 0; index < children.getLength(); index++)
 		{
-			String ch = null;
-			String pg = null;
 			String value = null;
 			Node node = children.item(index);
 			
@@ -344,6 +344,7 @@ public class VsdxShape extends Shape
 		
 			if (value != null && value.length() > 0)
 			{
+				// Assumes text is always last
 				// null key is allowed
 				Paragraph para = paragraphs.get(pg);
 				
@@ -356,6 +357,9 @@ public class VsdxShape extends Shape
 				{
 					para.addValue(value, ch);
 				}
+				
+				ch = null;
+				pg = null;
 			}
 		}
 	}
@@ -373,8 +377,13 @@ public class VsdxShape extends Shape
 		this.styleMap.put(mxConstants.STYLE_VERTICAL_ALIGN, getAlignVertical());
 		
 		this.styleMap.put("fontColor", getTextColor(index));
-		this.styleMap.put("fontSize", String.valueOf(Double.parseDouble(this.getTextSize(cp))));
+		this.styleMap.put("fontSize", String.valueOf(Double.parseDouble(this.getTextSize(index))));
 		this.styleMap.put("fontFamily", getTextFont(index));
+		
+		int fontStyle = isBold(index) ? mxConstants.FONT_BOLD : 0;
+		fontStyle |= isItalic(index) ? mxConstants.FONT_ITALIC : 0;
+		fontStyle |= isUnderline(index) ? mxConstants.FONT_UNDERLINE : 0;
+		this.styleMap.put("fontStyle", String.valueOf(fontStyle));
 
 		return para.getValue(0);
 	}

+ 28 - 23
src/com/mxgraph/io/vsdx/mxVsdxPage.java

@@ -1,5 +1,6 @@
 package com.mxgraph.io.vsdx;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -61,30 +62,18 @@ public class mxVsdxPage {
 		
 		parseNodes(pageElem, model, "pages");
 		
-		Node child = pageElem.getFirstChild();
+		ArrayList<Element> pageSheets = mxVsdxUtils.getDirectChildNamedElements(pageElem, "PageSheet");
 		
-		while (child != null)
+		if (pageSheets.size() > 0)
 		{
-			if (child instanceof Element && ((Element)child).getTagName().equals("PageSheet"))
+			Element pageSheet = pageSheets.get(0);
+			ArrayList<Element> cells = mxVsdxUtils.getDirectChildNamedElements(pageSheet, "Cell");
+			
+			for (Element cellElem : cells)
 			{
-				Node childNode = child.getFirstChild();
-				
-				while (childNode != null)
-				{
-					if (childNode instanceof Element && ((Element)childNode).getTagName().equals("Cell"))
-					{
-						Element childElem = (Element) childNode;
-						String n = childElem.getAttribute("N");
-						cellElements.put(n, childElem);
-					}
-					
-					childNode = childNode.getNextSibling();
-				}
-				
-				break;
+				String n = cellElem.getAttribute("N");
+				this.cellElements.put(n, cellElem);		
 			}
-			
-			child = child.getNextSibling();
 		}
 	}
 
@@ -295,15 +284,15 @@ public class mxVsdxPage {
 
 	/**
 	 * Returns the width and height of a Page expressed as an mxPoint.
-	 * @return mxPoint that represents the dimensions of the shape
+	 * @return mxPoint that represents the dimensions of the page
 	 */
 	public mxPoint getPageDimensions()
 	{
 		double pageH = 0;
 		double pageW = 0;
 
-		Element height = cellElements.get("PageHeight");
-		Element width = cellElements.get("PageWidth");
+		Element height = this.cellElements.get("PageHeight");
+		Element width = this.cellElements.get("PageWidth");
 		
 		if (height != null)
 		{
@@ -320,6 +309,22 @@ public class mxVsdxPage {
 		return new mxPoint(pageW, pageH);
 	}
 	
+	/**
+	 * Returns the drawing scale attribute of this page
+	 * @return the DrawingScale
+	 */
+	public double getDrawingScale()
+	{
+		Element scale = this.cellElements.get("DrawingScale");
+		
+		if (scale != null)
+		{
+			return Double.valueOf(scale.getAttribute("V")) * mxVsdxUtils.conversionFactor;
+		}
+		
+		return 1;
+	}
+
 	/**
 	 * Returns the ID of the page
 	 * @return the ID of the page

+ 1 - 1
war/WEB-INF/appengine-web.xml

@@ -2,7 +2,7 @@
 <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
 	<application>drawdotio</application>
 	<!-- IMPORTANT! DO NOT CHANGE THIS VALUE IN SOURCE CONTROL! -->
-	<version>test</version>
+	<version>6-0-2-3</version>
 	
 	<!-- Configure java.util.logging -->
 	<system-properties>

+ 1 - 1
war/cache.manifest

@@ -1,7 +1,7 @@
 CACHE MANIFEST
 
 # THIS FILE WAS GENERATED. DO NOT MODIFY!
-# 12/12/2016 10:06 PM
+# 12/13/2016 04:10 PM
 
 /app.html
 /index.html?offline=1

File diff suppressed because it is too large
+ 1 - 1
war/js/app.min.js


File diff suppressed because it is too large
+ 1 - 1
war/js/atlas.min.js


File diff suppressed because it is too large
+ 1 - 1
war/js/embed-static.min.js


File diff suppressed because it is too large
+ 1 - 1
war/js/reader.min.js