/** * @file XTPChartDiagram.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(__XTPCHARTDIAGRAM_H__) # define __XTPCHARTDIAGRAM_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPChartSeriesView; class CXTPChartElementView; class CXTPChartDiagramView; class CXTPChartSeries; class CXTPArcBall; template class CXTPMatrix; typedef CArray CXTPChartSeriesArray; /** * @brief * This class represents a chart diagram, which is a kind of CXTPChartElement. */ class _XTP_EXT_CLASS CXTPChartDiagram : public CXTPChartPanel { /** @cond */ DECLARE_DYNAMIC(CXTPChartDiagram) /** @endcond */ protected: /** * @brief * Constructs a CXTPChartDiagram object. */ CXTPChartDiagram(); public: /** * @brief * Call this function to create a view of the diagram. * * @param pDC The chart device context. * @param pParent A pointer to the parent view object. * * @return * A pointer to a CXTPChartDiagramView object. * * @details * This is a virtual function, so sub classes can give their type * specific implementation for this function. */ virtual CXTPChartDiagramView* CreateView(CXTPChartDeviceContext* pDC, CXTPChartElementView* pParent); /** * @brief * Call this function to calculate the series layout of the diagram. * * @param pDC The chart device context. * @param pView A pointer to the diagram view object. * * @details * This is a virtual function, so sub classes can give their type * specific implementation for this function. */ virtual void CalculateSeriesLayout(CXTPChartDeviceContext* pDC, CXTPChartDiagramView* pView); public: /** * @brief * Call this function to get the series collection object. * * @return * A reference to a CXTPChartSeriesArray object. */ const CXTPChartSeriesArray& GetSeries() const; protected: /** * @brief * This function is called when a series is added to the series collection * in the chart content object which has a collection of series. * * @param pSeries A pointer to a chart series object. * @return Returns True when the series is added, otherwise False */ virtual BOOL OnSeriesAdded(CXTPChartSeries* pSeries); /** * @brief * This function is called when a series is removed from the series collection * in the chart content object which has a collection of series. * * @param pSeries A pointer to a chart series object. */ void OnSeriesRemoved(CXTPChartSeries* pSeries); protected: /** * @brief * Call this function to decrease the usage count of the object. */ void Release(); public: /** * @brief * Reads this object from or writes this object to an archive. * * @param pPX A CXTPPropExchange object to serialize to or from. */ virtual void DoPropExchange(CXTPPropExchange* pPX); public: friend class CXTPChartContent; friend class CXTPChartSeries; # ifdef _XTP_ACTIVEX public: /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPChartDiagram); LPDISPATCH OleGetTitles(); /** @endcond */ # endif protected: CXTPChartSeriesArray m_arrSeries; /**< The series collection.*/ }; /** * @brief * Represents a virtual diagram rectangular domain area. */ class _XTP_EXT_CLASS CXTPChartDiagramDomain { public: /** * @brief * Constructs a diagram domain. * * @param rcInnerBounds Rectangle value that defines domain area. */ CXTPChartDiagramDomain(const CXTPChartRectF& rcInnerBounds); /** * @brief * Determines the domain area boundary rectangle. * * @return * Domain area boundary rectangle */ const CXTPChartRectF& GetInnerBounds() const; private: const CXTPChartRectF m_rcInnerBounds; }; AFX_INLINE CXTPChartDiagramDomain::CXTPChartDiagramDomain(const CXTPChartRectF& rcInnerBounds) : m_rcInnerBounds(rcInnerBounds) { } AFX_INLINE const CXTPChartRectF& CXTPChartDiagramDomain::GetInnerBounds() const { return m_rcInnerBounds; } AFX_INLINE const CXTPChartSeriesArray& CXTPChartDiagram::GetSeries() const { return m_arrSeries; } /** * @brief * The base class for all 2D diagrams. */ class _XTP_EXT_CLASS CXTPChart2dDiagram : public CXTPChartDiagram { /** @cond */ DECLARE_DYNAMIC(CXTPChart2dDiagram) /** @endcond */ protected: /** * @brief * Constructs a CXTPChartDiagram2D object. */ CXTPChart2dDiagram(); }; /** * @brief * The base class for all 3D diagrams. */ class _XTP_EXT_CLASS CXTPChart3dDiagram : public CXTPChartDiagram { /** @cond */ DECLARE_DYNAMIC(CXTPChart3dDiagram) /** @endcond */ protected: /** * @brief * Constructs a CXTPChart3dDiagram object. */ CXTPChart3dDiagram(); /** * @brief * Handles CXTPChart3dDiagram object destruction. */ ~CXTPChart3dDiagram(); public: /** The side of the box in 3D space within which a chart is drawn.*/ static const float m_fChartBoxSize; /** The size of a primitive, the smallest part of a chart, e.g. triangle side size.*/ static const int m_nPrimitiveSize; /** The closest possible distance to the center of a model.*/ static const float m_fMinModelDistance; /** The farthest possible distance to the center of a model.*/ static const float m_fMaxModelDistance; /** * @brief * Obtains camera coordinates in 3D space. The camera is always directed * to the center of the model. * * @return * Camera coordinates in 3D space. */ const CXTPPoint3f& GetCameraPosition() const; /** * @brief * Obtains view rotation matrix. The matrix is used for rotating view * and not the model itself. * * @return * View rotation matrix. */ const CXTPMatrix& GetViewRotationMatrix() const; /** * @brief * Sets boundaries for arc ball used for rotating the view. * * @param dWidth Available width value. * @param dHeight Available height value. */ void SetArcBallBounds(double dWidth, double dHeight); /** * @brief * Sets start arc ball rotation point. * * @param point Specifies the relative x- and y- coordinates of * the start arc ball rotation point. * * @return * TRUE if the start rotation point is set, FALSE otherwise. */ BOOL SetStartArcBallRotationPoint(POINT point); /** * @brief * Rotates arc ball to the specified point. * * @param point Specifies the relative x- and y- coordinates of * the end rotation point. * * @return * TRUE if the rotation is completed, otherwise FALSE. */ BOOL RotateArcBallToPoint(POINT point); /** * @brief * Zooms arc ball in or out. * * @param fDelta The zooming distance. If positive, arc ball is zoomed in. * If negative, arc ball is zoomed out. */ void ZoomArcBall(float fDelta); private: CXTPPoint3f m_ptCameraPosition; CXTPArcBall* m_pArcBall; CXTPMatrix* m_pMatrixBeforeRotation; CXTPMatrix* m_pMatrixAfterRotation; }; AFX_INLINE const CXTPPoint3f& CXTPChart3dDiagram::GetCameraPosition() const { return m_ptCameraPosition; } AFX_INLINE const CXTPMatrix& CXTPChart3dDiagram::GetViewRotationMatrix() const { return *m_pMatrixAfterRotation; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPCHARTDIAGRAM_H__) /** @endcond */