6.4.2 release

This commit is contained in:
David Benson 2017-04-03 14:55:48 +01:00
parent bffc9f4ee3
commit babedf4938
14 changed files with 688 additions and 58 deletions

View file

@ -19,8 +19,6 @@ Running
-------
The simplest way to run draw.io initially is to fork this project, [publish the master branch to GitHub pages](https://help.github.com/categories/github-pages-basics/) and the [pages sites](https://jgraph.github.io/draw.io/war/index.html) will have the full editor functionality (sans the integrations).
The full packaged .war of the client and servlets is built when the project is tagged and available on the [releases page](https://github.com/jgraph/draw.io/releases).
Supported Browsers
------------------
draw.io supports IE 9+, Chrome 30+, Firefox 31+, Safari versions actively patched by Apple (6.2.x, 7.1.x, 8.0.x and 9.x at time of writing), Opera 20+, Native Android browser 5.x+, the default browser in the current and previous major iOS versions (e.g. 9.x and 8.x) and Edge 20+.

Binary file not shown.

View file

@ -370,6 +370,14 @@ public class GliffyDiagramConverter
style.append("opacity=" + shape.opacity * 100).append(";");
style.append(DashStyleMapping.get(shape.dashStyle));
}
style.append(DashStyleMapping.get(shape.dashStyle));
if(gliffyObject.isSubRoutine())
{
//Gliffy's subroutine maps to drawio process, whose inner boundary, unlike subroutine's, is relative to it's width so here we set it to 10px
style.append("size=" + 10 / gliffyObject.width).append(";");
}
}
else if (gliffyObject.isLine())
{

View file

@ -295,6 +295,15 @@ public class GliffyObject
(uid.startsWith("com.gliffy.shape.venn.outline") ||
uid.startsWith("com.gliffy.shape.venn.flat"));
}
/**
* Returns a boolean indicating if this object is a subroutine
* @return true if subroutine, false otherwise
*/
public boolean isSubRoutine()
{
return uid.equals("com.gliffy.shape.flowchart.flowchart_v1.default.subroutine");
}
public boolean isUnrecognizedGraphicType()
{

View file

@ -4,6 +4,7 @@
*/
package com.mxgraph.io.vsdx;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
@ -68,6 +69,8 @@ public class Style
styleTypes.put(mxVsdxConstants.LINE_WEIGHT, mxVsdxConstants.LINE_STYLE);
styleTypes.put("QuickStyleLineColor", mxVsdxConstants.LINE_STYLE);
styleTypes.put("QuickStyleLineMatrix", mxVsdxConstants.LINE_STYLE);
styleTypes.put(mxVsdxConstants.BEGIN_ARROW_SIZE, mxVsdxConstants.LINE_STYLE);
styleTypes.put(mxVsdxConstants.END_ARROW_SIZE, mxVsdxConstants.LINE_STYLE);
styleTypes.put(mxVsdxConstants.TEXT_BKGND, mxVsdxConstants.TEXT_STYLE);
styleTypes.put(mxVsdxConstants.BOTTOM_MARGIN, mxVsdxConstants.TEXT_STYLE);
@ -109,6 +112,11 @@ public class Style
return null;
}
public boolean isVertex()
{
return false;
}
public void styleDebug(String debug)
{
if (vsdxStyleDebug)
@ -271,9 +279,8 @@ public class Style
try
{
double parsedValue = Double.parseDouble(value);
parsedValue = parsedValue * mxVsdxUtils.conversionFactor;
return Math.round(parsedValue * 100.0) / 100.0;
return getScreenNumericalValue(parsedValue);
}
catch (NumberFormatException e)
{
@ -284,7 +291,13 @@ public class Style
return defaultValue;
}
protected double getScreenNumericalValue(double val)
{
double conVal = val * mxVsdxUtils.conversionFactor;
return Math.round(conVal * 100.0) / 100.0;
}
/**
* Returns the value of the element with tag name = 'tag' in the children
* of 'primary' in his double representation.<br/>
@ -455,7 +468,10 @@ public class Style
{
//Handle theme here
//FIXME this is a very hacky way to test themes until fully integrating themes
if ("FillForegnd".equals(key) || mxVsdxConstants.LINE_COLOR.equals(key) || mxVsdxConstants.LINE_PATTERN.equals(key)) return elem;
if ("FillForegnd".equals(key) || mxVsdxConstants.LINE_COLOR.equals(key) || mxVsdxConstants.LINE_PATTERN.equals(key)
|| mxVsdxConstants.BEGIN_ARROW_SIZE.equals(key) || mxVsdxConstants.END_ARROW_SIZE.equals(key)
|| mxVsdxConstants.BEGIN_ARROW.equals(key) || mxVsdxConstants.END_ARROW.equals(key)
|| mxVsdxConstants.LINE_WEIGHT.equals(key)) return elem;
// Use "no style" style
Element themeElem = style.getCellElement(key);
@ -514,7 +530,7 @@ public class Style
{
int styleLineClr = Integer.parseInt(this.getValue(this.getCellElement("QuickStyleLineColor"), "1"));
int styleLineMtx = Integer.parseInt(this.getValue(this.getCellElement("QuickStyleLineMatrix"), "0"));
Color colorObj = theme.getLineColor(styleLineClr, styleLineMtx);
Color colorObj = isVertex()? theme.getLineColor(styleLineClr, styleLineMtx) : theme.getConnLineColor(styleLineClr, styleLineMtx);
color = colorObj.toHexStr();
}
else
@ -666,7 +682,7 @@ public class Style
{
int styleFontClr = Integer.parseInt(this.getValue(this.getCellElement("QuickStyleFontColor"), "1"));
int styleFontMtx = Integer.parseInt(this.getValue(this.getCellElement("QuickStyleFontMatrix"), "0"));
Color colorObj = theme.getFontColor(styleFontClr, styleFontMtx);
Color colorObj = isVertex()? theme.getFontColor(styleFontClr, styleFontMtx) : theme.getConnFontColor(styleFontClr, styleFontMtx);
color = colorObj.toHexStr();
}
else
@ -917,4 +933,175 @@ public class Style
public void setShape(Element shape) {
this.shape = shape;
}
private final static double SPACE = 4.0, SHORT_SPACE = 2.0, LONG_SPACE = 6.0, DOT = 1.0, DASH = 8.0, LONG_DASH = 12.0, SHORT_DASH = 4.0, XLONG_DASH = 20.0, XSHORT_DASH = 2.0;
private final static ArrayList<ArrayList<Double>> lineDashPatterns = new ArrayList<>();
static
{
//0 no pattern, 1 solid, 2 similar to mxGraph default dash
lineDashPatterns.add(new ArrayList<Double>());
lineDashPatterns.add(new ArrayList<Double>());
lineDashPatterns.add(new ArrayList<Double>());
//3
ArrayList<Double> lineDashPattern = new ArrayList<>();
lineDashPattern.add(DOT);
lineDashPattern.add(SPACE);
lineDashPatterns.add(lineDashPattern);
//4
lineDashPattern = new ArrayList<>();
lineDashPattern.add(DASH);
lineDashPattern.add(SPACE);
lineDashPattern.add(DOT);
lineDashPattern.add(SPACE);
lineDashPatterns.add(lineDashPattern);
//5
lineDashPattern = new ArrayList<>();
lineDashPattern.add(DASH);
lineDashPattern.add(SPACE);
lineDashPattern.add(DOT);
lineDashPattern.add(SPACE);
lineDashPattern.add(DOT);
lineDashPattern.add(SPACE);
lineDashPatterns.add(lineDashPattern);
//6
lineDashPattern = new ArrayList<>();
lineDashPattern.add(DASH);
lineDashPattern.add(SPACE);
lineDashPattern.add(DASH);
lineDashPattern.add(SPACE);
lineDashPattern.add(DOT);
lineDashPattern.add(SPACE);
lineDashPatterns.add(lineDashPattern);
//7
lineDashPattern = new ArrayList<>();
lineDashPattern.add(LONG_DASH);
lineDashPattern.add(SPACE);
lineDashPattern.add(SHORT_DASH);
lineDashPattern.add(SPACE);
lineDashPatterns.add(lineDashPattern);
//8
lineDashPattern = new ArrayList<>();
lineDashPattern.add(LONG_DASH);
lineDashPattern.add(SPACE);
lineDashPattern.add(SHORT_DASH);
lineDashPattern.add(SPACE);
lineDashPattern.add(SHORT_DASH);
lineDashPattern.add(SPACE);
lineDashPatterns.add(lineDashPattern);
//9
lineDashPattern = new ArrayList<>();
lineDashPattern.add(SHORT_DASH);
lineDashPattern.add(SHORT_SPACE);
lineDashPatterns.add(lineDashPattern);
//10
lineDashPattern = new ArrayList<>();
lineDashPattern.add(DOT);
lineDashPattern.add(SHORT_SPACE);
lineDashPatterns.add(lineDashPattern);
//11
lineDashPattern = new ArrayList<>();
lineDashPattern.add(SHORT_DASH);
lineDashPattern.add(SHORT_SPACE);
lineDashPattern.add(DOT);
lineDashPattern.add(SHORT_SPACE);
lineDashPatterns.add(lineDashPattern);
//12
lineDashPattern = new ArrayList<>();
lineDashPattern.add(SHORT_DASH);
lineDashPattern.add(SHORT_SPACE);
lineDashPattern.add(DOT);
lineDashPattern.add(SHORT_SPACE);
lineDashPattern.add(DOT);
lineDashPattern.add(SHORT_SPACE);
lineDashPatterns.add(lineDashPattern);
//13
lineDashPattern = new ArrayList<>();
lineDashPattern.add(SHORT_DASH);
lineDashPattern.add(SHORT_SPACE);
lineDashPattern.add(SHORT_DASH);
lineDashPattern.add(SHORT_SPACE);
lineDashPattern.add(DOT);
lineDashPattern.add(SHORT_SPACE);
lineDashPatterns.add(lineDashPattern);
//14
lineDashPattern = new ArrayList<>();
lineDashPattern.add(DASH);
lineDashPattern.add(SHORT_SPACE);
lineDashPattern.add(SHORT_DASH);
lineDashPattern.add(SHORT_SPACE);
lineDashPatterns.add(lineDashPattern);
//15
lineDashPattern = new ArrayList<>();
lineDashPattern.add(DASH);
lineDashPattern.add(SHORT_SPACE);
lineDashPattern.add(SHORT_DASH);
lineDashPattern.add(SHORT_SPACE);
lineDashPattern.add(SHORT_DASH);
lineDashPattern.add(SHORT_SPACE);
lineDashPatterns.add(lineDashPattern);
//16
lineDashPattern = new ArrayList<>();
lineDashPattern.add(LONG_DASH);
lineDashPattern.add(LONG_SPACE);
lineDashPatterns.add(lineDashPattern);
//17
lineDashPattern = new ArrayList<>();
lineDashPattern.add(DOT);
lineDashPattern.add(LONG_SPACE);
lineDashPatterns.add(lineDashPattern);
//18
lineDashPattern = new ArrayList<>();
lineDashPattern.add(LONG_DASH);
lineDashPattern.add(LONG_SPACE);
lineDashPattern.add(DOT);
lineDashPattern.add(LONG_SPACE);
lineDashPatterns.add(lineDashPattern);
//19
lineDashPattern = new ArrayList<>();
lineDashPattern.add(LONG_DASH);
lineDashPattern.add(LONG_SPACE);
lineDashPattern.add(DOT);
lineDashPattern.add(LONG_SPACE);
lineDashPattern.add(DOT);
lineDashPattern.add(LONG_SPACE);
lineDashPatterns.add(lineDashPattern);
//20
lineDashPattern = new ArrayList<>();
lineDashPattern.add(LONG_DASH);
lineDashPattern.add(LONG_SPACE);
lineDashPattern.add(LONG_DASH);
lineDashPattern.add(LONG_SPACE);
lineDashPattern.add(DOT);
lineDashPattern.add(LONG_SPACE);
lineDashPatterns.add(lineDashPattern);
//21
lineDashPattern = new ArrayList<>();
lineDashPattern.add(XLONG_DASH);
lineDashPattern.add(LONG_SPACE);
lineDashPattern.add(DASH);
lineDashPattern.add(LONG_SPACE);
lineDashPatterns.add(lineDashPattern);
//22
lineDashPattern = new ArrayList<>();
lineDashPattern.add(XLONG_DASH);
lineDashPattern.add(LONG_SPACE);
lineDashPattern.add(DASH);
lineDashPattern.add(LONG_SPACE);
lineDashPattern.add(DASH);
lineDashPattern.add(LONG_SPACE);
lineDashPatterns.add(lineDashPattern);
//23
lineDashPattern = new ArrayList<>();
lineDashPattern.add(XSHORT_DASH);
lineDashPattern.add(SHORT_SPACE);
lineDashPatterns.add(lineDashPattern);
}
public static ArrayList<Double> getLineDashPattern(int pattern)
{
if (pattern >= 0 && pattern <= 23)
return lineDashPatterns.get(pattern);
else
return lineDashPatterns.get(0);
}
}

View file

@ -99,7 +99,7 @@ public class VsdxShape extends Shape
public static final float[] arrowSizes = {2, 3, 5, 7, 9, 22, 45};
public static final Map<String, String> arrowTypes;
public static final Map<Integer, String> arrowTypes;
static
{
@ -116,13 +116,13 @@ public class VsdxShape extends Shape
// todo
}
arrowTypes = new HashMap<String, String>();
arrowTypes.put("0", mxConstants.NONE);
arrowTypes.put("1", mxConstants.ARROW_OPEN);
arrowTypes.put("4", mxConstants.ARROW_BLOCK);
arrowTypes.put("5", mxConstants.ARROW_CLASSIC);
arrowTypes.put("10", mxConstants.ARROW_OVAL);
arrowTypes.put("13", mxConstants.ARROW_BLOCK);
arrowTypes = new HashMap<Integer, String>();
arrowTypes.put(0, mxConstants.NONE);
arrowTypes.put(1, mxConstants.ARROW_OPEN);
arrowTypes.put(4, mxConstants.ARROW_BLOCK);
arrowTypes.put(5, mxConstants.ARROW_CLASSIC);
arrowTypes.put(10, mxConstants.ARROW_OVAL);
arrowTypes.put(13, mxConstants.ARROW_BLOCK);
}
@ -923,23 +923,34 @@ public class VsdxShape extends Shape
}
private String getDashPattern() {
mxVsdxTheme theme = getTheme();
ArrayList<Double> pattern = null;
if (theme != null)
String linePattern = this.getValue(this.getCellElement(mxVsdxConstants.LINE_PATTERN), "0");
if (linePattern.equals("Themed"))
{
int styleLineMtx = Integer.parseInt(this.getValue(this.getCellElement("QuickStyleLineMatrix"), "0"));
ArrayList<Double> pattern = theme.getLineDashPattern(styleLineMtx);
mxVsdxTheme theme = getTheme();
if (pattern != null && !pattern.isEmpty())
if (theme != null)
{
StringBuilder str = new StringBuilder();
for (Double len : pattern)
{
str.append(String.format("%.2f ", 1.0));
}
return str.toString();
int styleLineMtx = Integer.parseInt(this.getValue(this.getCellElement("QuickStyleLineMatrix"), "0"));
pattern = isVertex()? theme.getLineDashPattern(styleLineMtx) : theme.getConnLineDashPattern(styleLineMtx);
}
}
else
{
pattern = getLineDashPattern(Integer.parseInt(linePattern));
}
if (pattern != null && !pattern.isEmpty())
{
StringBuilder str = new StringBuilder();
for (Double len : pattern)
{
str.append(String.format("%.2f ", len));
}
return str.toString().trim();
}
return null;
}
@ -960,7 +971,7 @@ public class VsdxShape extends Shape
if (theme != null)
{
int styleLineMtx = Integer.parseInt(this.getValue(this.getCellElement("QuickStyleLineMatrix"), "0"));
return theme.isLineDashed(styleLineMtx);
return isVertex()? theme.isLineDashed(styleLineMtx) : theme.isConnLineDashed(styleLineMtx);
}
}
else if (!(linePattern.equals("0") || linePattern.equals("1")))
@ -978,8 +989,32 @@ public class VsdxShape extends Shape
*/
public double getLineWidth()
{
double lWeight = this.getLineWeight();
String lineWeight = getValue(this.getCellElement(mxVsdxConstants.LINE_WEIGHT), "0");
double lWeight = 0;
try
{
if (lineWeight.equals("Themed"))
{
mxVsdxTheme theme = getTheme();
if (theme != null)
{
int styleLineMtx = Integer.parseInt(this.getValue(this.getCellElement("QuickStyleLineMatrix"), "0"));
lWeight = (isVertex()? theme.getLineWidth(styleLineMtx) : theme.getConnLineWidth(styleLineMtx)) / 10000.0;
}
}
else
{
lWeight = Double.parseDouble(lineWeight);
lWeight = getScreenNumericalValue(lWeight);
}
}
catch (Exception e)
{
// ignore
}
//Value is fixed for weight < 1
if (lWeight < 1)
{
@ -1001,7 +1036,24 @@ public class VsdxShape extends Shape
try
{
return VsdxShape.arrowSizes[Integer.valueOf(baSize).intValue()];
int size = 4;
if (baSize.equals("Themed"))
{
mxVsdxTheme theme = getTheme();
if (theme != null)
{
int styleLineMtx = Integer.parseInt(this.getValue(this.getCellElement("QuickStyleLineMatrix"), "0"));
size = isVertex()? theme.getStartSize(styleLineMtx) : theme.getConnStartSize(styleLineMtx);
}
}
else
{
size = Integer.valueOf(baSize);
}
return VsdxShape.arrowSizes[size];
}
catch (Exception e)
{
@ -1023,7 +1075,24 @@ public class VsdxShape extends Shape
try
{
return VsdxShape.arrowSizes[Integer.valueOf(eaSize).intValue()];
int size = 4;
if (eaSize.equals("Themed"))
{
mxVsdxTheme theme = getTheme();
if (theme != null)
{
int styleLineMtx = Integer.parseInt(this.getValue(this.getCellElement("QuickStyleLineMatrix"), "0"));
size = isVertex()? theme.getEndSize(styleLineMtx) : theme.getConnEndSize(styleLineMtx);
}
}
else
{
size = Integer.valueOf(eaSize);
}
return VsdxShape.arrowSizes[size];
}
catch (Exception e)
{
@ -1873,11 +1942,16 @@ public class VsdxShape extends Shape
}
//Defines Pattern
String dashed = isDashed() ? "1" : "0";
if (dashed.equals("1"))
if (isDashed())
{
styleMap.put(mxConstants.STYLE_DASHED, dashed);
styleMap.put(mxConstants.STYLE_DASHED, "1");
String dashPattern = getDashPattern();
if (dashPattern != null)
{
styleMap.put(mxConstants.STYLE_DASH_PATTERN, dashPattern);
}
}
//Defines Begin Arrow
@ -2004,7 +2078,39 @@ public class VsdxShape extends Shape
public String getEdgeMarker(boolean start)
{
String marker = this.getValue(this.getCellElement(start ? mxVsdxConstants.BEGIN_ARROW : mxVsdxConstants.END_ARROW), "0");
return VsdxShape.arrowTypes.get(marker);
int val = 0;
try
{
if (marker.equals("Themed"))
{
mxVsdxTheme theme = getTheme();
if (theme != null)
{
int styleLineMtx = Integer.parseInt(this.getValue(this.getCellElement("QuickStyleLineMatrix"), "0"));
val = isVertex()? theme.getEdgeMarker(start, styleLineMtx) : theme.getConnEdgeMarker(start, styleLineMtx);
}
}
else
{
val = Integer.parseInt(marker);
}
}
catch (Exception e)
{
// ignore
}
String type = VsdxShape.arrowTypes.get(val);
if (val > 0 && type == null)
{
//if arrow head type is not supported, use the open arrow instead
type = VsdxShape.arrowTypes.get(1);
}
return type;
}
/**

View file

@ -12,6 +12,7 @@ import com.mxgraph.io.vsdx.theme.FillStyle;
import com.mxgraph.io.vsdx.theme.FillStyleFactory;
import com.mxgraph.io.vsdx.theme.GradFill;
import com.mxgraph.io.vsdx.theme.LineStyle;
import com.mxgraph.io.vsdx.theme.LineStyleExt;
import com.mxgraph.io.vsdx.theme.OoxmlColor;
import com.mxgraph.io.vsdx.theme.OoxmlColorFactory;
@ -91,12 +92,26 @@ public class mxVsdxTheme
//fill styles
private ArrayList<FillStyle> fillStyles = new ArrayList<>(6);
//connector fill styles
//TODO what is the use of it?
private ArrayList<FillStyle> connFillStyles = new ArrayList<>(6);
//line styles
private ArrayList<LineStyle> lineStyles = new ArrayList<>(6);
//cpnector line styles
private ArrayList<LineStyle> connLineStyles = new ArrayList<>(6);
//line styles extensions
private ArrayList<LineStyleExt> lineStylesExt = new ArrayList<>(7);
//connector line styles extensions
private ArrayList<LineStyleExt> connLineStylesExt = new ArrayList<>(7);
//connector font color & styles
private ArrayList<OoxmlColor> connectorFontColors = new ArrayList<>(3);
private ArrayList<Integer> connectorFontStyles = new ArrayList<>(6);
private ArrayList<OoxmlColor> connFontColors = new ArrayList<>(6);
private ArrayList<Integer> connFontStyles = new ArrayList<>(6);
//font color & styles
private ArrayList<OoxmlColor> fontColors = new ArrayList<>(6);
@ -196,10 +211,56 @@ public class mxVsdxTheme
switch (vt.getNodeName())
{
case "vt:fmtConnectorScheme":
//TODO implement connector format scheme
ArrayList<Element> connSchemes = mxVsdxUtils.getDirectChildElements(vt);
for (Element scheme : connSchemes)
{
String name = scheme.getNodeName();
switch (name)
{
case "a:fillStyleLst":
ArrayList<Element> fillStyleElems = mxVsdxUtils.getDirectChildElements(scheme);
for (Element fillStyle : fillStyleElems)
{
connFillStyles.add(FillStyleFactory.getFillStyle(fillStyle));
}
break;
case "a:lnStyleLst":
ArrayList<Element> lineStyleElems = mxVsdxUtils.getDirectChildElements(scheme);
for (Element lineStyle : lineStyleElems)
{
connLineStyles.add(new LineStyle(lineStyle));
}
break;
}
}
break;
case "vt:lineStyles":
//TODO implement line styles
ArrayList<Element> styles = mxVsdxUtils.getDirectChildElements(vt);
for (Element style : styles)
{
String name = style.getNodeName();
switch (name)
{
case "vt:fmtConnectorSchemeLineStyles":
ArrayList<Element> connStylesElems = mxVsdxUtils.getDirectChildElements(style);
for (Element connStyle : connStylesElems)
{
connLineStylesExt.add(new LineStyleExt(connStyle));
}
break;
case "vt:fmtSchemeLineStyles":
ArrayList<Element> schemeStyleElems = mxVsdxUtils.getDirectChildElements(style);
for (Element schemeStyle : schemeStyleElems)
{
lineStylesExt.add(new LineStyleExt(schemeStyle));
}
break;
}
}
break;
case "vt:fontStylesGroup":
ArrayList<Element> fontStyleElems = mxVsdxUtils.getDirectChildElements(vt);
@ -211,7 +272,7 @@ public class mxVsdxTheme
switch (name)
{
case "vt:connectorFontStyles":
fillFontStyles(fontStyle, connectorFontColors, connectorFontStyles);
fillFontStyles(fontStyle, connFontColors, connFontStyles);
break;
case "vt:fontStyles":
fillFontStyles(fontStyle, fontColors, fontStyles);
@ -282,16 +343,17 @@ public class mxVsdxTheme
}
break;
case "a:effectStyleLst":
//TODO effects most probably are not used by vsdx
break;
case "a:bgFillStyleLst":
//TODO background effects most probably are not used by vsdx
break;
}
}
}
private void processFonts(Element element) {
// TODO Auto-generated method stub
// TODO Fonts has only the name of the font for each language. It looks not important
}
private void processColors(Element element)
@ -533,7 +595,8 @@ public class mxVsdxTheme
}
}
public LineStyle getLineStyle(int quickStyleLineMatrix)
//Get line style based on QuickStyleLineMatrix
private LineStyle getLineStyle(int quickStyleLineMatrix, ArrayList<LineStyle> lineStyles)
{
processTheme();
@ -560,14 +623,35 @@ public class mxVsdxTheme
return lineStyle;
}
private LineStyleExt getLineStyleExt(int quickStyleLineMatrix, ArrayList<LineStyleExt> lineStylesExt)
{
processTheme();
LineStyleExt lineStyleExt = null;
switch (quickStyleLineMatrix)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
lineStyleExt = lineStylesExt.get(quickStyleLineMatrix);
break;
}
return lineStyleExt;
}
//Get line color based on QuickStyleLineColor & QuickStyleLineMatrix
public Color getLineColor(int quickStyleLineColor, int quickStyleLineMatrix)
private Color getLineColor(int quickStyleLineColor, int quickStyleLineMatrix, ArrayList<LineStyle> lineStyles)
{
processTheme();
int lineColorStyle = quickStyleLineColor;
LineStyle lineStyle = getLineStyle(quickStyleLineMatrix);
LineStyle lineStyle = getLineStyle(quickStyleLineMatrix, lineStyles);
switch (quickStyleLineMatrix)
{
case 100:
@ -588,25 +672,111 @@ public class mxVsdxTheme
}
}
//Get line color based on QuickStyleLineColor & QuickStyleLineMatrix
public Color getLineColor(int quickStyleLineColor, int quickStyleLineMatrix)
{
return getLineColor(quickStyleLineColor, quickStyleLineMatrix, lineStyles);
}
//Get connection line color based on QuickStyleLineColor & QuickStyleLineMatrix
public Color getConnLineColor(int quickStyleLineColor, int quickStyleLineMatrix)
{
return getLineColor(quickStyleLineColor, quickStyleLineMatrix, connLineStyles);
}
public Color getDefaultLineClr()
{
return defaultLineClr;
}
public boolean isLineDashed(int quickStyleLineMatrix)
private boolean isLineDashed(int quickStyleLineMatrix, ArrayList<LineStyleExt> lineStylesExt, ArrayList<LineStyle> lineStyles)
{
LineStyle lineStyle = getLineStyle(quickStyleLineMatrix);
return lineStyle != null? lineStyle.isDashed() : false;
LineStyleExt lineStyleExt = getLineStyleExt(quickStyleLineMatrix, lineStylesExt);
if (lineStyleExt != null)
{
return lineStyleExt.isDashed();
}
else
{
LineStyle lineStyle = getLineStyle(quickStyleLineMatrix, lineStyles);
return lineStyle != null? lineStyle.isDashed() : false;
}
}
public boolean isLineDashed(int quickStyleLineMatrix)
{
return isLineDashed(quickStyleLineMatrix, lineStylesExt, lineStyles);
}
public boolean isConnLineDashed(int quickStyleLineMatrix)
{
return isLineDashed(quickStyleLineMatrix, connLineStylesExt, connLineStyles);
}
private ArrayList<Double> getLineDashPattern(int quickStyleLineMatrix, ArrayList<LineStyleExt> lineStylesExt, ArrayList<LineStyle> lineStyles)
{
LineStyleExt lineStyleExt = getLineStyleExt(quickStyleLineMatrix, lineStylesExt);
if (lineStyleExt != null)
{
return lineStyleExt.getLineDashPattern();
}
else
{
LineStyle lineStyle = getLineStyle(quickStyleLineMatrix, lineStyles);
return lineStyle != null? lineStyle.getLineDashPattern() : null;
}
}
public ArrayList<Double> getLineDashPattern(int quickStyleLineMatrix)
{
LineStyle lineStyle = getLineStyle(quickStyleLineMatrix);
return lineStyle != null? lineStyle.getLineDashPattern() : null;
return getLineDashPattern(quickStyleLineMatrix, lineStylesExt, lineStyles);
}
public ArrayList<Double> getConnLineDashPattern(int quickStyleLineMatrix)
{
return getLineDashPattern(quickStyleLineMatrix, connLineStylesExt, connLineStyles);
}
private int getArrowSize(int quickStyleLineMatrix, boolean isStart, ArrayList<LineStyleExt> lineStylesExt, ArrayList<LineStyle> lineStyles)
{
LineStyleExt lineStyleExt = getLineStyleExt(quickStyleLineMatrix, lineStylesExt);
if (lineStyleExt != null)
{
return isStart? lineStyleExt.getStartSize() : lineStyleExt.getEndSize();
}
else
{
LineStyle lineStyle = getLineStyle(quickStyleLineMatrix, lineStyles);
return lineStyle != null? (isStart? lineStyle.getStartSize() : lineStyle.getEndSize()) : 4;
}
}
public int getStartSize(int quickStyleLineMatrix)
{
return getArrowSize(quickStyleLineMatrix, true, lineStylesExt, lineStyles);
}
public int getConnStartSize(int quickStyleLineMatrix)
{
return getArrowSize(quickStyleLineMatrix, true, connLineStylesExt, connLineStyles);
}
public int getEndSize(int quickStyleLineMatrix)
{
return getArrowSize(quickStyleLineMatrix, false, lineStylesExt, lineStyles);
}
public int getConnEndSize(int quickStyleLineMatrix)
{
return getArrowSize(quickStyleLineMatrix, false, connLineStylesExt, connLineStyles);
}
//Get font color based on QuickStyleFontColor & QuickStyleFontMatrix
public Color getFontColor(int quickStyleFontColor, int quickStyleFontMatrix)
private Color getFontColor(int quickStyleFontColor, int quickStyleFontMatrix, ArrayList<OoxmlColor> fontColors)
{
processTheme();
@ -644,4 +814,57 @@ public class mxVsdxTheme
}
}
//Get font color based on QuickStyleFontColor & QuickStyleFontMatrix
public Color getFontColor(int quickStyleFontColor, int quickStyleFontMatrix)
{
return getFontColor(quickStyleFontColor, quickStyleFontMatrix, fontColors);
}
//Get connection font color based on QuickStyleFontColor & QuickStyleFontMatrix
public Color getConnFontColor(int quickStyleFontColor, int quickStyleFontMatrix)
{
return getFontColor(quickStyleFontColor, quickStyleFontMatrix, connFontColors);
}
private int getArrowType(int quickStyleLineMatrix, boolean isStart, ArrayList<LineStyleExt> lineStylesExt, ArrayList<LineStyle> lineStyles)
{
LineStyleExt lineStyleExt = getLineStyleExt(quickStyleLineMatrix, lineStylesExt);
if (lineStyleExt != null)
{
return isStart? lineStyleExt.getStart() : lineStyleExt.getEnd();
}
else
{
LineStyle lineStyle = getLineStyle(quickStyleLineMatrix, lineStyles);
return lineStyle != null? (isStart? lineStyle.getStart() : lineStyle.getEnd()) : 0;
}
}
public int getEdgeMarker(boolean isStart, int quickStyleLineMatrix)
{
return getArrowType(quickStyleLineMatrix, isStart, lineStylesExt, lineStyles);
}
public int getConnEdgeMarker(boolean isStart, int quickStyleLineMatrix)
{
return getArrowType(quickStyleLineMatrix, isStart, connLineStylesExt, connLineStyles);
}
private int getLineWidth(int quickStyleLineMatrix, ArrayList<LineStyle> lineStyles)
{
LineStyle lineStyle = getLineStyle(quickStyleLineMatrix, lineStyles);
return lineStyle != null? lineStyle.getLineWidth() : 0;
}
public int getLineWidth(int quickStyleLineMatrix)
{
return getLineWidth(quickStyleLineMatrix, lineStyles);
}
public int getConnLineWidth(int quickStyleLineMatrix)
{
return getLineWidth(quickStyleLineMatrix, connLineStyles);
}
}

View file

@ -64,4 +64,10 @@ public class HSVColor {
return this;
}
public HSVColor hueMod(int amount)
{
this.h *= amount / 100.0;
this.h = clamp01(this.h);
return this;
}
}

View file

@ -43,7 +43,7 @@ public class LineStyle {
public LineStyle(Element elem)
{
//parse the line style xml
lineWidth = mxVsdxUtils.getIntAttr(elem, "w", 9525);
lineWidth = mxVsdxUtils.getIntAttr(elem, "w");
String lineCapAtt = elem.getAttribute("cap");
@ -231,4 +231,28 @@ public class LineStyle {
{
return lineDashPattern;
}
public int getStartSize() {
// TODO Implement this if it is needed
return 4;
}
public int getEndSize() {
// TODO Implement this if it is needed
return 4;
}
public int getStart() {
// TODO Implement this if it is needed
return 0;
}
public int getEnd() {
// TODO Implement this if it is needed
return 0;
}
public int getLineWidth() {
return lineWidth;
}
}

View file

@ -0,0 +1,63 @@
package com.mxgraph.io.vsdx.theme;
import java.util.ArrayList;
import org.w3c.dom.Element;
import com.mxgraph.io.vsdx.Style;
import com.mxgraph.io.vsdx.mxVsdxUtils;
public class LineStyleExt {
private int rndg = 0, start = 0, startSize = 0, end = 0, endSize = 0, pattern = 0;
private ArrayList<Double> lineDashPattern;
public LineStyleExt(Element elem)
{
Element lineEx = mxVsdxUtils.getDirectFirstChildElement(elem); //vt:lineEx element of vt:lineStyle
//parse the line style ext xml
rndg = mxVsdxUtils.getIntAttr(lineEx, "rndg");
start = mxVsdxUtils.getIntAttr(lineEx, "start");
startSize = mxVsdxUtils.getIntAttr(lineEx, "startSize");
end = mxVsdxUtils.getIntAttr(lineEx, "end");
endSize = mxVsdxUtils.getIntAttr(lineEx, "endSize");
pattern = mxVsdxUtils.getIntAttr(lineEx, "pattern");
lineDashPattern = Style.getLineDashPattern(pattern);
}
public int getRndg()
{
return rndg;
}
public int getStart()
{
return start;
}
public int getStartSize()
{
return startSize;
}
public int getEnd()
{
return end;
}
public int getEndSize()
{
return endSize;
}
public boolean isDashed()
{
return pattern > 1;
}
public ArrayList<Double> getLineDashPattern()
{
return lineDashPattern;
}
}

View file

@ -113,6 +113,10 @@ abstract public class OoxmlColor
//TODO this may be better done in HSL color format
hsvColor.lumMod(lumMod);
}
if (hueMod != 0)
{
hsvColor.hueMod(hueMod);
}
color = hsvColor.toRgb();
}
}

View file

@ -65,6 +65,9 @@ public class OoxmlColorFactory {
case "a:lumMod":
color.setLumMod(effVal);
break;
case "a:hueMod":
color.setHueMod(effVal);
break;
//TODO complete the list when supported
// a:comp Complement
// a:inv Inverse
@ -74,7 +77,6 @@ public class OoxmlColorFactory {
// a:alphaMod Alpha Modulation
// a:hue Hue
// a:hueOff Hue Offset
// a:hueMod Hue Modulate
// a:sat Saturation
// a:satOff Saturation Offset
// a:lum Luminance

View file

@ -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>6-4-2</version>
<version>test</version>
<!-- Configure java.util.logging -->
<system-properties>

View file

@ -427,7 +427,7 @@
this.addEntry(dt + 'list box', function()
{
var bg2 = new mxCell('', new mxGeometry(0, 00, 150, 200), s2 + 'forms.rrect;rSize=0;strokeColor=#999999;fillColor=#ffffff;');
var bg2 = new mxCell('', new mxGeometry(0, 0, 150, 200), s2 + 'forms.rrect;rSize=0;strokeColor=#999999;fillColor=#ffffff;');
bg2.vertex = true;
var bg = new mxCell('Title', new mxGeometry(0, 0, 150, 30), s2 + 'forms.rrect;rSize=0;strokeColor=#999999;fontColor=#008cff;fontSize=17;fillColor=#ffffff;resizeWidth=1;');
bg.geometry.relative = true;