/**
 * 
 */
package nc.ui.hbbb.hbflowgraph.graph.shape;

import java.awt.Polygon;

import com.mxgraph.canvas.mxGraphics2DCanvas;
import com.mxgraph.shape.mxIMarker;
import com.mxgraph.util.mxConstants;
import com.mxgraph.util.mxPoint;
import com.mxgraph.view.mxCellState;

/**
 * @author fengzhy
 * @created at 2012-12-4,下午8:45:45
 * 
 */
public class HbFlowConArrowMarker implements mxIMarker {
	// ncm  xianymf  NCM_UFOC_2005_修改maven引用jar包引发的合并流程定义问题(适配云管家)  20220120
	public mxPoint paintMarker(mxGraphics2DCanvas canvas, mxCellState state,
			String type, mxPoint pe, double nx, double ny, double size,
			boolean source) {

		Polygon poly = new Polygon();
		poly.addPoint((int) Math.round(pe.getX()), (int) Math.round(pe.getY()));
		poly.addPoint((int) Math.round(pe.getX() - nx - ny / 2),
				(int) Math.round(pe.getY() - ny + nx / 2.5));

		poly.addPoint((int) Math.round(pe.getX() + ny / 2 - nx),
				(int) Math.round(pe.getY() - ny - nx / 2.5));

		canvas.fillShape(poly);
		canvas.getGraphics().draw(poly);

		return new mxPoint(-nx, -ny);

	}

}
