src/main/java/com/mxgraph/canvas/mxHtmlCanvas.java
public Element drawShape(int x, int y, int w, int h,
			Map<String, Object> style)
	{
		String fillColor = mxUtils
				.getString(style, mxConstants.STYLE_FILLCOLOR);
		String strokeColor = mxUtils.getString(style,
				mxConstants.STYLE_STROKECOLOR);
		float strokeWidth = (float) (mxUtils.getFloat(style,
				mxConstants.STYLE_STROKEWIDTH, 1) * scale);

		// Draws the shape
		String shape = mxUtils.getString(style, mxConstants.STYLE_SHAPE);

		Element elem = document.createElement("div");

		if (shape.equals(mxConstants.SHAPE_LINE))
		{
			String direction = mxUtils.getString(style,
					mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST);

			if (direction.equals(mxConstants.DIRECTION_EAST)
					|| direction.equals(mxConstants.DIRECTION_WEST))
			{
				y = Math.round(y + h / 2);
				h = 1;
			}
			else
			{
				x = Math.round(y + w / 2);
				w = 1;
			}
		}

		if (mxUtils.isTrue(style, mxConstants.STYLE_SHADOW, false)
				&& fillColor != null)
		{
			Element shadow = (Element) elem.cloneNode(true);

			String s = "overflow:hidden;position:absolute;" + "left:"
					+ String.valueOf(x + mxConstants.SHADOW_OFFSETX) + "px;"
					+ "top:" + String.valueOf(y + mxConstants.SHADOW_OFFSETY)
					+ "px;" + "width:" + String.valueOf(w) + "px;" + "height:"
					+ String.valueOf(h) + "px;background:"
					+ mxConstants.W3C_SHADOWCOLOR
					+ ";border-style:solid;border-color:"
					+ mxConstants.W3C_SHADOWCOLOR + ";border-width:"
					+ String.valueOf(Math.round(strokeWidth)) + ";";
			shadow.setAttribute("style", s);

			appendHtmlElement(shadow);
		}

		if (shape.equals(mxConstants.SHAPE_IMAGE))
		{
			String img = getImageForStyle(style);

			if (img != null)
			{
				elem = document.createElement("img");
				elem.setAttribute("border", "0");
				elem.setAttribute("src", img);
			}
		}

		// TODO: Draw other shapes. eg. SHAPE_LINE here

		String s = "overflow:hidden;position:absolute;" + "left:"
				+ String.valueOf(x) + "px;" + "top:" + String.valueOf(y)
				+ "px;" + "width:" + String.valueOf(w) + "px;" + "height:"
				+ String.valueOf(h) + "px;background:" + fillColor + ";"
				+ ";border-style:solid;border-color:" + strokeColor
				+ ";border-width:" + String.valueOf(Math.round(strokeWidth))
				+ ";";
		elem.setAttribute("style", s);

		appendHtmlElement(elem);

		return elem;
	}
/**
	 * Draws the shape specified with the STYLE_SHAPE key in the given style.
	 * 
	 * @param x X-coordinate of the shape.
	 * @param y Y-coordinate of the shape.
	 * @param w Width of the shape.
	 * @param h Height of the shape.
	 * @param style Style of the the shape.
	 */
Draws the shape specified with the STYLE_SHAPE key in the given style.

@param x X-coordinate of the shape.
@param y Y-coordinate of the shape.
@param w Width of the shape.
@param h Height of the shape.
@param style Style of the the shape.
Draws the shape specified with the STYLE_SHAPE key in the given style . @param x X - coordinate of the shape . @param y Y - coordinate of the shape . @param w Width of the shape . @param h Height of the shape . @param style Style of the the shape .
public Element drawShape(int x, int y, int w, int h,
			Map<String, Object> style)
	{
		String fillColor = mxUtils
				.getString(style, mxConstants.STYLE_FILLCOLOR);
		String strokeColor = mxUtils.getString(style,
				mxConstants.STYLE_STROKECOLOR);
		float strokeWidth = (float) (mxUtils.getFloat(style,
				mxConstants.STYLE_STROKEWIDTH, 1) * scale);
		String shape = mxUtils.getString(style, mxConstants.STYLE_SHAPE);
		Element elem = document.createElement("div");
		if (shape.equals(mxConstants.SHAPE_LINE))
		{
			String direction = mxUtils.getString(style,
					mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST);
			if (direction.equals(mxConstants.DIRECTION_EAST)
					|| direction.equals(mxConstants.DIRECTION_WEST))
			{
				y = Math.round(y + h / 2);
				h = 1;
			}
			else
			{
				x = Math.round(y + w / 2);
				w = 1;
			}
		}
		if (mxUtils.isTrue(style, mxConstants.STYLE_SHADOW, false)
				&& fillColor != null)
		{
			Element shadow = (Element) elem.cloneNode(true);
			String s = "overflow:hidden;position:absolute;" + "left:"
					+ String.valueOf(x + mxConstants.SHADOW_OFFSETX) + "px;"
					+ "top:" + String.valueOf(y + mxConstants.SHADOW_OFFSETY)
					+ "px;" + "width:" + String.valueOf(w) + "px;" + "height:"
					+ String.valueOf(h) + "px;background:"
					+ mxConstants.W3C_SHADOWCOLOR
					+ ";border-style:solid;border-color:"
					+ mxConstants.W3C_SHADOWCOLOR + ";border-width:"
					+ String.valueOf(Math.round(strokeWidth)) + ";";
			shadow.setAttribute("style", s);
			appendHtmlElement(shadow);
		}
		if (shape.equals(mxConstants.SHAPE_IMAGE))
		{
			String img = getImageForStyle(style);
			if (img != null)
			{
				elem = document.createElement("img");
				elem.setAttribute("border", "0");
				elem.setAttribute("src", img);
			}
		}
		String s = "overflow:hidden;position:absolute;" + "left:"
				+ String.valueOf(x) + "px;" + "top:" + String.valueOf(y)
				+ "px;" + "width:" + String.valueOf(w) + "px;" + "height:"
				+ String.valueOf(h) + "px;background:" + fillColor + ";"
				+ ";border-style:solid;border-color:" + strokeColor
				+ ";border-width:" + String.valueOf(Math.round(strokeWidth))
				+ ";";
		elem.setAttribute("style", s);
		appendHtmlElement(elem);
		return elem;
	}
public Element drawShape ( int x , int y , int w , int h , Map < String , Object > style ) { String fillColor = mxUtils . getString ( style , mxConstants . STYLE_FILLCOLOR ) ; String strokeColor = mxUtils . getString ( style , mxConstants . STYLE_STROKECOLOR ) ; float strokeWidth = ( float ) ( mxUtils . getFloat ( style , mxConstants . STYLE_STROKEWIDTH , 1 ) * scale ) ; String shape = mxUtils . getString ( style , mxConstants . STYLE_SHAPE ) ; Element elem = document . createElement ( "div" ) ; if ( shape . equals ( mxConstants . SHAPE_LINE ) ) { String direction = mxUtils . getString ( style , mxConstants . STYLE_DIRECTION , mxConstants . DIRECTION_EAST ) ; if ( direction . equals ( mxConstants . DIRECTION_EAST ) || direction . equals ( mxConstants . DIRECTION_WEST ) ) { y = Math . round ( y + h / 2 ) ; h = 1 ; } else { x = Math . round ( y + w / 2 ) ; w = 1 ; } } if ( mxUtils . isTrue ( style , mxConstants . STYLE_SHADOW , false ) && fillColor != null ) { Element shadow = ( Element ) elem . cloneNode ( true ) ; String s = "overflow:hidden;position:absolute;" + "left:" + String . valueOf ( x + mxConstants . SHADOW_OFFSETX ) + "px;" + "top:" + String . valueOf ( y + mxConstants . SHADOW_OFFSETY ) + "px;" + "width:" + String . valueOf ( w ) + "px;" + "height:" + String . valueOf ( h ) + "px;background:" + mxConstants . W3C_SHADOWCOLOR + ";border-style:solid;border-color:" + mxConstants . W3C_SHADOWCOLOR + ";border-width:" + String . valueOf ( Math . round ( strokeWidth ) ) + ";" ; shadow . setAttribute ( "style" , s ) ; appendHtmlElement ( shadow ) ; } if ( shape . equals ( mxConstants . SHAPE_IMAGE ) ) { String img = getImageForStyle ( style ) ; if ( img != null ) { elem = document . createElement ( "img" ) ; elem . setAttribute ( "border" , "0" ) ; elem . setAttribute ( "src" , img ) ; } } String s = "overflow:hidden;position:absolute;" + "left:" + String . valueOf ( x ) + "px;" + "top:" + String . valueOf ( y ) + "px;" + "width:" + String . valueOf ( w ) + "px;" + "height:" + String . valueOf ( h ) + "px;background:" + fillColor + ";" + ";border-style:solid;border-color:" + strokeColor + ";border-width:" + String . valueOf ( Math . round ( strokeWidth ) ) + ";" ; elem . setAttribute ( "style" , s ) ; appendHtmlElement ( elem ) ; return elem ; }
Draws the shape specified with the STYLE_SHAPE key in the given style.
Draws the shape specified with the STYLE_SHAPE key in the given style .
// Draws the shape // TODO: Draw other shapes. eg. SHAPE_LINE here