protected void drawHexagon(int x,int y,int w,int h,Color fillColor,Paint fillPaint,Color penColor,boolean shadow,String direction){
  Polygon hexagon=new Polygon();
  if (direction.equals(mxConstants.DIRECTION_NORTH) || direction.equals(mxConstants.DIRECTION_SOUTH)) {
    hexagon.addPoint(x + (int)(0.5 * w),y);
    hexagon.addPoint(x + w,y + (int)(0.25 * h));
    hexagon.addPoint(x + w,y + (int)(0.75 * h));
    hexagon.addPoint(x + (int)(0.5 * w),y + h);
    hexagon.addPoint(x,y + (int)(0.75 * h));
    hexagon.addPoint(x,y + (int)(0.25 * h));
  }
 else {
    hexagon.addPoint(x + (int)(0.25 * w),y);
    hexagon.addPoint(x + (int)(0.75 * w),y);
    hexagon.addPoint(x + w,y + (int)(0.5 * h));
    hexagon.addPoint(x + (int)(0.75 * w),y + h);
    hexagon.addPoint(x + (int)(0.25 * w),y + h);
    hexagon.addPoint(x,y + (int)(0.5 * h));
  }
  drawPolygon(hexagon,fillColor,fillPaint,penColor,shadow);
}

protected void drawHexagon ( int x , int y , int w , int h , Color fillColor , Paint fillPaint , Color penColor , boolean shadow , String direction ) { Polygon hexagon = new Polygon ( ) ; if ( direction . equals ( mxConstants . DIRECTION_NORTH ) || direction . equals ( mxConstants . DIRECTION_SOUTH ) ) { hexagon . addPoint ( x + ( int ) ( 0.5 * w ) , y ) ; hexagon . addPoint ( x + w , y + ( int ) ( 0.25 * h ) ) ; hexagon . addPoint ( x + w , y + ( int ) ( 0.75 * h ) ) ; hexagon . addPoint ( x + ( int ) ( 0.5 * w ) , y + h ) ; hexagon . addPoint ( x , y + ( int ) ( 0.75 * h ) ) ; hexagon . addPoint ( x , y + ( int ) ( 0.25 * h ) ) ; } else { hexagon . addPoint ( x + ( int ) ( 0.25 * w ) , y ) ; hexagon . addPoint ( x + ( int ) ( 0.75 * w ) , y ) ; hexagon . addPoint ( x + w , y + ( int ) ( 0.5 * h ) ) ; hexagon . addPoint ( x + ( int ) ( 0.75 * w ) , y + h ) ; hexagon . addPoint ( x + ( int ) ( 0.25 * w ) , y + h ) ; hexagon . addPoint ( x , y + ( int ) ( 0.5 * h ) ) ; } drawPolygon ( hexagon , fillColor , fillPaint , penColor , shadow ) ; }
draws a hexagon shape for the given parameters .
