/** * Returns the value for key in dictionary as a float array or the given default * value if no value is defined for the key. * * @param dict * Dictionary that contains the key, value pairs. * @param key * Key whose value should be returned. * @param defaultValue * Default value to return if the key is undefined. * @return Returns the float array value for key in dict. */ public static float[] getFloatArray(Map<String, Object> dict, String key, float[] defaultValue) { return getFloatArray(dict, key, defaultValue, ","); }
/** * Returns the value for key in dictionary as a float array or the given default * value if no value is defined for the key. * * @param dict * Dictionary that contains the key, value pairs. * @param key * Key whose value should be returned. * @param defaultValue * Default value to return if the key is undefined. * @return Returns the float array value for key in dict. */ public static float[] getFloatArray(Map<String, Object> dict, String key, float[] defaultValue) { return getFloatArray(dict, key, defaultValue, ","); }
/** * */ public Stroke createStroke(Map<String, Object> style) { double width = mxUtils .getFloat(style, mxConstants.STYLE_STROKEWIDTH, 1) * scale; boolean dashed = mxUtils.isTrue(style, mxConstants.STYLE_DASHED); if (dashed) { float[] dashPattern = mxUtils.getFloatArray(style, mxConstants.STYLE_DASH_PATTERN, mxConstants.DEFAULT_DASHED_PATTERN, " "); float[] scaledDashPattern = new float[dashPattern.length]; for (int i = 0; i < dashPattern.length; i++) { scaledDashPattern[i] = (float) (dashPattern[i] * scale * width); } return new BasicStroke((float) width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, scaledDashPattern, 0.0f); } else { return new BasicStroke((float) width); } }
dashpattern = mxUtils.getFloatArray(style, mxConstants.STYLE_DASH_PATTERN, mxConstants.DEFAULT_DASHED_PATTERN, " ");
/** * */ public Stroke createStroke(Map<String, Object> style) { double width = mxUtils .getFloat(style, mxConstants.STYLE_STROKEWIDTH, 1) * scale; boolean dashed = mxUtils.isTrue(style, mxConstants.STYLE_DASHED); if (dashed) { float[] dashPattern = mxUtils.getFloatArray(style, mxConstants.STYLE_DASH_PATTERN, mxConstants.DEFAULT_DASHED_PATTERN, " "); float[] scaledDashPattern = new float[dashPattern.length]; for (int i = 0; i < dashPattern.length; i++) { scaledDashPattern[i] = (float) (dashPattern[i] * scale * width); } return new BasicStroke((float) width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, scaledDashPattern, 0.0f); } else { return new BasicStroke((float) width); } }