/** * @file XTPChart3dFunnelSeriesLabelsViewDeviceCommand.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(__XTPCHART3DFUNNELSERIESLABELSVIEWDEVICECOMMAND_H__) # define __XTPCHART3DFUNNELSERIESLABELSVIEWDEVICECOMMAND_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPChart3dFunnelSeriesLabelsView; class CXTPChart3dFunnelSeriesLabelView; class CXTPChart3dFunnelSeriesPointView; class CXTPChart3dFunnelSeriesLabelDeviceCommand; class CXTPChart3dDeviceContext; class CXTPChart3dFunnelSeriesLabel; /** * @brief * Implements 3D chart funnel series label device command. */ class _XTP_EXT_CLASS CXTPChart3dFunnelSeriesLabelDeviceCommand : public CXTPChart3dDeviceCommand { DECLARE_DYNAMIC(CXTPChart3dFunnelSeriesLabelDeviceCommand); public: /** * @brief * Constructs a CXTPChart3dFunnelSeriesLabelDeviceCommand object. * * @param pSeriesLabelView Associated series label view pointer. */ CXTPChart3dFunnelSeriesLabelDeviceCommand(CXTPChart3dFunnelSeriesLabelView* pSeriesLabelView); public: /** * @brief * Override this function to write the drawing code for specific objects. * * @param pDC A pointer to the chart device context. */ virtual void ExecuteOverride(CXTPChartDeviceContext* pDC); /** * @brief * Obtains label view object pointer. * * @return * Label view object pointer */ CXTPChart3dFunnelSeriesLabelView* GetSeriesLabelView() const; /** * @brief * Checks whether command object is in a failed state. * * @return * TRUE if command object is in a failed state, FALSE otherwise. * * @see * SetFailed */ BOOL IsFailed() const; /** * @brief * Sets command object to a failed state. */ void SetFailed(); /** * @brief * Obtains label rectangle. * * @return * Label rectangle. * * @see * SetLabelRect */ CRect GetLabelRect() const; /** * @brief * Sets label rectangle. * * @param rcLabel Label rectangle. * * @see * GetLabelRect */ void SetLabelRect(CRect rcLabel); /** * @brief * Computes connector vector. * * @param pDC Target device context pointer. * * @return * TRUE if the vector is successfully computed, FALSE otherwise. */ BOOL ComputeConnectorVector(CXTPChart3dDeviceContext* pDC); /** * @brief * Computes label. * * @param pDC Target device context pointer. */ void ComputeLabel(CXTPChart3dDeviceContext* pDC); /** * @brief * Determines connector length value. * * @return * Connector length value. * * @see * SetConnectorLength */ double GetConnectorLength() const; /** * @brief * Sets connector length value. * * @param dLength New connector length value. * * @see * GetConnectorLength */ void SetConnectorLength(double dLength); /** * @brief * Determines connector endpoint vertical offset value. * * @return * Connector endpoint vertical offset value. * * @see * SetConnectorEndpointVerticalOffset */ double GetConnectorEndpointVerticalOffset() const; /** * @brief * Sets connector endpoint vertical offset value. * * @param yOffset New connector endpoint vertical offset value. * * @see * GetConnectorEndpointVerticalOffset */ void SetConnectorEndpointVerticalOffset(double yOffset); private: BOOL ComputeConnectorStartPoint(CXTPChart3dDeviceContext* pDC, CXTPPoint3d& ptStart, CPoint& ptProjected) const; CXTPPoint3d ComputeConnectorEndPoint() const; CXTPPoint3d ComputeConnectorVectorEndPoint(const CXTPPoint3d& point) const; void ComputeLabel_Outside(const CSize& szLabel, const CPoint& ptAnchorOrigin, const CPoint& ptAnchor); void ComputeLabel_Center(const CSize& szLabel, const CPoint& ptAnchor); private: CXTPChart3dFunnelSeriesLabelView* m_pSeriesLabelView; CXTPChart3dFunnelSeriesPointView* m_pPointView; CRect m_rcLabel; BOOL m_bFailed; double m_dConnectorLength; double m_dConnectorEndpointVerticalOffset; }; AFX_INLINE BOOL CXTPChart3dFunnelSeriesLabelDeviceCommand::IsFailed() const { return m_bFailed; } AFX_INLINE void CXTPChart3dFunnelSeriesLabelDeviceCommand::SetFailed() { m_bFailed = TRUE; } AFX_INLINE CXTPChart3dFunnelSeriesLabelView* CXTPChart3dFunnelSeriesLabelDeviceCommand::GetSeriesLabelView() const { return m_pSeriesLabelView; } AFX_INLINE CRect CXTPChart3dFunnelSeriesLabelDeviceCommand::GetLabelRect() const { return m_rcLabel; } AFX_INLINE void CXTPChart3dFunnelSeriesLabelDeviceCommand::SetLabelRect(CRect rcLabel) { m_rcLabel = rcLabel; } AFX_INLINE double CXTPChart3dFunnelSeriesLabelDeviceCommand::GetConnectorLength() const { return m_dConnectorLength; } AFX_INLINE void CXTPChart3dFunnelSeriesLabelDeviceCommand::SetConnectorLength(double dLength) { m_dConnectorLength = dLength; } AFX_INLINE double CXTPChart3dFunnelSeriesLabelDeviceCommand::GetConnectorEndpointVerticalOffset() const { return m_dConnectorEndpointVerticalOffset; } AFX_INLINE void CXTPChart3dFunnelSeriesLabelDeviceCommand::SetConnectorEndpointVerticalOffset(double yOffset) { m_dConnectorEndpointVerticalOffset = yOffset; } /** * @brief * Represents device command for all funnel series labels view. */ class _XTP_EXT_CLASS CXTPChart3dFunnelSeriesLabelsViewDeviceCommand : public CXTPChart3dDeviceCommand , private CXTPChartDeviceCommandEvents { public: /** * @brief * Constructs a command object instance. * * @param pSeriesLabelsView View pointer. */ CXTPChart3dFunnelSeriesLabelsViewDeviceCommand( CXTPChart3dFunnelSeriesLabelsView* pSeriesLabelsView); public: /** * @brief * Override this function to write the drawing code for specific objects. * * @param pDC A pointer to the chart device context. */ virtual void ExecuteOverride(CXTPChartDeviceContext* pDC); private: CXTPChart3dFunnelSeriesLabel* GetLabel() const; void ComputeLabelConnectorVectors(CXTPChart3dDeviceContext* pDC); void ComputeLabels(CXTPChart3dDeviceContext* pDC); BOOL ResolveLabelOverlaps(CXTPChart3dDeviceContext* pDC); BOOL ResolveLabelOverlaps_ChangeConnectorLength(CXTPChart3dDeviceContext* pDC); CXTPChart3dFunnelSeriesLabelDeviceCommand* FindLabelDeviceCommand(CXTPChartDeviceCommand* pCommand) const; private: virtual void OnAfterExecute(CXTPChartDeviceCommand* pCommand, CXTPChartDeviceContext* pDC); struct CommandCallbackData { enum State { None, ComputeVector }; CommandCallbackData(State state = None); void SwitchTo(State state); State GetState() const; BOOL bSuccess; CXTPChart3dDeviceContext* pDC; CXTPChart3dFunnelSeriesLabelDeviceCommand* pLabelCommand; private: State state; }; CommandCallbackData m_CommandCallbackData; protected: CXTPChart3dFunnelSeriesLabelsView* m_pSeriesLabelsView; /**< View pointer*/ }; AFX_INLINE void CXTPChart3dFunnelSeriesLabelsViewDeviceCommand::CommandCallbackData::SwitchTo(State newState) { *this = CommandCallbackData(newState); } AFX_INLINE CXTPChart3dFunnelSeriesLabelsViewDeviceCommand::CommandCallbackData::State CXTPChart3dFunnelSeriesLabelsViewDeviceCommand::CommandCallbackData::GetState() const { return state; } AFX_INLINE CXTPChart3dFunnelSeriesLabelsViewDeviceCommand::CommandCallbackData::CommandCallbackData( State state) : bSuccess(FALSE) , pDC(NULL) , pLabelCommand(NULL) , state(state) { } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPCHART3DFUNNELSERIESLABELSVIEWDEVICECOMMAND_H__) /** @endcond */