/** * @file XTPArrowDrawer.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPARROWDRAWER_H__) # define __XTPARROWDRAWER_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" ////////////////////////////////////////////////////////////////////////// // description class CXTPFlowGraphDrawContext; class _XTP_EXT_CLASS CXTPArrowDrawer { protected: Gdiplus::PointF* GetBezierCurveNodes(float p1X, float p1Y, float p2X, float p2Y, float p1cX, float p1cY, float p2cX, float p2cY, int numberOfNodes); float GetDistance(float x1, float y1, float x2, float y2); public: CXTPArrowDrawer(float width = 10.f, float theta = 0.8f, int nNumberOfBezierNodes = 100); /** * @brief * draw a straight arrow when a line has starting point p1 and end point p2 */ void Draw(CXTPFlowGraphDrawContext* pDC, Gdiplus::PointF p1, Gdiplus::PointF p2); /** * @brief * draw an arrow when a line is a bezier curve (with 2 control points) */ void Draw(CXTPFlowGraphDrawContext* pDC, float p1X, float p1Y, float p2X, float p2Y, float p1cX, float p1cY, float p2cX, float p2cY); /** * @brief * draw an arrow when a line is a bezier curve (with 2 control points) */ void Draw(CXTPFlowGraphDrawContext* pDC, Gdiplus::PointF p1, Gdiplus::PointF p2, Gdiplus::PointF cp1, Gdiplus::PointF cp2); protected: float m_Width; /**< Width (in pixels) of the full base of the arrowhead. */ float m_Theta; /**< Angle (in radians) at the arrow tip between the two sides of the arrowhead. */ int m_nNumberOfBezierNodes; /**< Number of nodes used to calculate the Bezier curve. */ }; /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // __XTPARROWDRAWER_H__ /** @endcond */