question: 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 = null ; if ( shape . equals ( mxConstants . SHAPE_IMAGE ) ) { String img = getImageForStyle ( style ) ; if ( img != null ) { elem = document . createElement ( "v:img" ) ; elem . setAttribute ( "src" , img ) ; } } else if ( shape . equals ( mxConstants . SHAPE_LINE ) ) { String direction = mxUtils . getString ( style , mxConstants . STYLE_DIRECTION , mxConstants . DIRECTION_EAST ) ; String points = null ; if ( direction . equals ( mxConstants . DIRECTION_EAST ) || direction . equals ( mxConstants . DIRECTION_WEST ) ) { int mid = ( int ) Math . round ( h / 2 ) ; points = "m 0 " + mid + " l " + w + " " + mid ; } else { int mid = ( int ) Math . round ( w / 2 ) ; points = "m " + mid + " 0 L " + mid + " " + h ; } elem = document . createElement ( "v:shape" ) ; elem . setAttribute ( "coordsize" , w + " " + h ) ; elem . setAttribute ( "path" , points + " x e" ) ; } else if ( shape . equals ( mxConstants . SHAPE_ELLIPSE ) ) { elem = document . createElement ( "v:oval" ) ; } else if ( shape . equals ( mxConstants . SHAPE_DOUBLE_ELLIPSE ) ) { elem = document . createElement ( "v:shape" ) ; elem . setAttribute ( "coordsize" , w + " " + h ) ; int inset = ( int ) ( ( 3 + strokeWidth ) * scale ) ; String points = "ar 0 0 " + w + " " + h + " 0 " + ( int ) ( h / 2 ) + " " + ( int ) ( w / 2 ) + " " + ( int ) ( h / 2 ) + " e ar " + inset + " " + inset + " " + ( w - inset ) + " " + ( h - inset ) + " 0 " + ( int ) ( h / 2 ) + " " + ( int ) ( w / 2 ) + " " + ( int ) ( h / 2 ) ; elem . setAttribute ( "path" , points + " x e" ) ; } else if ( shape . equals ( mxConstants . SHAPE_RHOMBUS ) ) { elem = document . createElement ( "v:shape" ) ; elem . setAttribute ( "coordsize" , w + " " + h ) ; String points = "m " + ( int ) ( w / 2 ) + " 0 l " + w + " " + ( int ) ( h / 2 ) + " l " + ( int ) ( w / 2 ) + " " + h + " l 0 " + ( int ) ( h / 2 ) ; elem . setAttribute ( "path" , points + " x e" ) ; } else if ( shape . equals ( mxConstants . SHAPE_TRIANGLE ) ) { elem = document . createElement ( "v:shape" ) ; elem . setAttribute ( "coordsize" , w + " " + h ) ; String direction = mxUtils . getString ( style , mxConstants . STYLE_DIRECTION , "" ) ; String points = null ; if ( direction . equals ( mxConstants . DIRECTION_NORTH ) ) { points = "m 0 " + h + " l " + ( int ) ( w / 2 ) + " 0 " + " l " + w + " " + h ; } else if ( direction . equals ( mxConstants . DIRECTION_SOUTH ) ) { points = "m 0 0 l " + ( int ) ( w / 2 ) + " " + h + " l " + w + " 0" ; } else if ( direction . equals ( mxConstants . DIRECTION_WEST ) ) { points = "m " + w + " 0 l " + w + " " + ( int ) ( h / 2 ) + " l " + w + " " + h ; } else { points = "m 0 0 l " + w + " " + ( int ) ( h / 2 ) + " l 0 " + h ; } elem . setAttribute ( "path" , points + " x e" ) ; } else if ( shape . equals ( mxConstants . SHAPE_HEXAGON ) ) { elem = document . createElement ( "v:shape" ) ; elem . setAttribute ( "coordsize" , w + " " + h ) ; String direction = mxUtils . getString ( style , mxConstants . STYLE_DIRECTION , "" ) ; String points = null ; if ( direction . equals ( mxConstants . DIRECTION_NORTH ) || direction . equals ( mxConstants . DIRECTION_SOUTH ) ) { points = "m " + ( int ) ( 0.5 * w ) + " 0 l " + w + " " + ( int ) ( 0.25 * h ) + " l " + w + " " + ( int ) ( 0.75 * h ) + " l " + ( int ) ( 0.5 * w ) + " " + h + " l 0 " + ( int ) ( 0.75 * h ) + " l 0 " + ( int ) ( 0.25 * h ) ; } else { points = "m " + ( int ) ( 0.25 * w ) + " 0 l " + ( int ) ( 0.75 * w ) + " 0 l " + w + " " + ( int ) ( 0.5 * h ) + " l " + ( int ) ( 0.75 * w ) + " " + h + " l " + ( int ) ( 0.25 * w ) + " " + h + " l 0 " + ( int ) ( 0.5 * h ) ; } elem . setAttribute ( "path" , points + " x e" ) ; } else if ( shape . equals ( mxConstants . SHAPE_CLOUD ) ) { elem = document . createElement ( "v:shape" ) ; elem . setAttribute ( "coordsize" , w + " " + h ) ; String points = "m " + ( int ) ( 0.25 * w ) + " " + ( int ) ( 0.25 * h ) + " c " + ( int ) ( 0.05 * w ) + " " + ( int ) ( 0.25 * h ) + " 0 " + ( int ) ( 0.5 * h ) + " " + ( int ) ( 0.16 * w ) + " " + ( int ) ( 0.55 * h ) + " c 0 " + ( int ) ( 0.66 * h ) + " " + ( int ) ( 0.18 * w ) + " " + ( int ) ( 0.9 * h ) + " " + ( int ) ( 0.31 * w ) + " " + ( int ) ( 0.8 * h ) + " c " + ( int ) ( 0.4 * w ) + " " + ( int ) ( h ) + " " + ( int ) ( 0.7 * w ) + " " + ( int ) ( h ) + " " + ( int ) ( 0.8 * w ) + " " + ( int ) ( 0.8 * h ) + " c " + ( int ) ( w ) + " " + ( int ) ( 0.8 * h ) + " " + ( int ) ( w ) + " " + ( int ) ( 0.6 * h ) + " " + ( int ) ( 0.875 * w ) + " " + ( int ) ( 0.5 * h ) + " c " + ( int ) ( w ) + " " + ( int ) ( 0.3 * h ) + " " + ( int ) ( 0.8 * w ) + " " + ( int ) ( 0.1 * h ) + " " + ( int ) ( 0.625 * w ) + " " + ( int ) ( 0.2 * h ) + " c " + ( int ) ( 0.5 * w ) + " " + ( int ) ( 0.05 * h ) + " " + ( int ) ( 0.3 * w ) + " " + ( int ) ( 0.05 * h ) + " " + ( int ) ( int ) ( 0.25 * w ) + " " + ( int ) ( 0.25 * h ) ; elem . setAttribute ( "path" , points + " x e" ) ; } else if ( shape . equals ( mxConstants . SHAPE_ACTOR ) ) { elem = document . createElement ( "v:shape" ) ; elem . setAttribute ( "coordsize" , w + " " + h ) ; double width3 = w / 3 ; String points = "m 0 " + ( int ) ( h ) + " C 0 " + ( int ) ( 3 * h / 5 ) + " 0 " + ( int ) ( 2 * h / 5 ) + " " + ( int ) ( w / 2 ) + " " + ( int ) ( 2 * h / 5 ) + " c " + ( int ) ( w / 2 - width3 ) + " " + ( int ) ( 2 * h / 5 ) + " " + ( int ) ( w / 2 - width3 ) + " 0 " + ( int ) ( w / 2 ) + " 0 c " + ( int ) ( w / 2 + width3 ) + " 0 " + ( int ) ( w / 2 + width3 ) + " " + ( int ) ( 2 * h / 5 ) + " " + ( int ) ( w / 2 ) + " " + ( int ) ( 2 * h / 5 ) + " c " + ( int ) ( w ) + " " + ( int ) ( 2 * h / 5 ) + " " + ( int ) ( w ) + " " + ( int ) ( 3 * h / 5 ) + " " + ( int ) ( w ) + " " + ( int ) ( h ) ; elem . setAttribute ( "path" , points + " x e" ) ; } else if ( shape . equals ( mxConstants . SHAPE_CYLINDER ) ) { elem = document . createElement ( "v:shape" ) ; elem . setAttribute ( "coordsize" , w + " " + h ) ; double dy = Math . min ( 40 , Math . floor ( h / 5 ) ) ; String points = "m 0 " + ( int ) ( dy ) + " C 0 " + ( int ) ( dy / 3 ) + " " + ( int ) ( w ) + " " + ( int ) ( dy / 3 ) + " " + ( int ) ( w ) + " " + ( int ) ( dy ) + " L " + ( int ) ( w ) + " " + ( int ) ( h - dy ) + " C " + ( int ) ( w ) + " " + ( int ) ( h + dy / 3 ) + " 0 " + ( int ) ( h + dy / 3 ) + " 0 " + ( int ) ( h - dy ) + " x e" + " m 0 " + ( int ) ( dy ) + " C 0 " + ( int ) ( 2 * dy ) + " " + ( int ) ( w ) + " " + ( int ) ( 2 * dy ) + " " + ( int ) ( w ) + " " + ( int ) ( dy ) ; elem . setAttribute ( "path" , points + " e" ) ; } else { if ( mxUtils . isTrue ( style , mxConstants . STYLE_ROUNDED , false ) ) { elem = document . createElement ( "v:roundrect" ) ; elem . setAttribute ( "arcsize" , ( mxConstants . RECTANGLE_ROUNDING_FACTOR * 100 ) + "%" ) ; } else { elem = document . createElement ( "v:rect" ) ; } } String s = "position:absolute;left:" + String . valueOf ( x ) + "px;top:" + String . valueOf ( y ) + "px;width:" + String . valueOf ( w ) + "px;height:" + String . valueOf ( h ) + "px;" ; double rotation = mxUtils . getDouble ( style , mxConstants . STYLE_ROTATION ) ; if ( rotation != 0 ) { s += "rotation:" + rotation + ";" ; } elem . setAttribute ( "style" , s ) ; if ( mxUtils . isTrue ( style , mxConstants . STYLE_SHADOW , false ) && fillColor != null ) { Element shadow = document . createElement ( "v:shadow" ) ; shadow . setAttribute ( "on" , "true" ) ; elem . appendChild ( shadow ) ; } float opacity = mxUtils . getFloat ( style , mxConstants . STYLE_OPACITY , 100 ) ; if ( fillColor != null ) { Element fill = document . createElement ( "v:fill" ) ; fill . setAttribute ( "color" , fillColor ) ; if ( opacity != 100 ) { fill . setAttribute ( "opacity" , String . valueOf ( opacity / 100 ) ) ; } elem . appendChild ( fill ) ; } else { elem . setAttribute ( "filled" , "false" ) ; } if ( strokeColor != null ) { elem . setAttribute ( "strokecolor" , strokeColor ) ; Element stroke = document . createElement ( "v:stroke" ) ; if ( opacity != 100 ) { stroke . setAttribute ( "opacity" , String . valueOf ( opacity / 100 ) ) ; } elem . appendChild ( stroke ) ; } else { elem . setAttribute ( "stroked" , "false" ) ; } elem . setAttribute ( "strokeweight" , String . valueOf ( strokeWidth ) + "pt" ) ; appendVmlElement ( elem ) ; return elem ; }
target:  Draws the shape specified with the STYLE_SHAPE key in the given style.