////////////////////////////////////////
// Start of File: CO1_TMS.HPP
////////////////////////////////////////

#ifndef CO1_TMS_HPP
#define CO1_TMS_HPP

//===================================================================
//
// COPYRIGHT NOTICE:  This code is protected by Copyright!
//
// Copyright (c) 1994, 1995, 1996, 1997 by DPC Technology.
// All rights reserved.
//
// See files "cf_copyr.txt" and "cf_licen.txt" for details of 
// copyright and license specifications, and contact information.
//
//===================================================================

//
// Master Header File Listing:
//
// #include    <cf_api/co1_tms.hpp>
// "Text Marker Series" AND "Title Marker Manager" objects.
//

//--------------------------------------------------------------------
// Include Chart Framework class or ID defs/headers this file needs.
// Paths are relative to the IDE's (global) include path: ~/cfrz
//--------------------------------------------------------------------
class       cf_String;
#include    <cf_api/c0_dystr.hpp>

class       bf_Display;
#include    <cf_api/b0_dspla.hpp>

class       cf_DyArr;   // We'll use dynamic arrays of (void) ptrs
#include    <cf_api/c0_dyarr.hpp>  // to 3D-Text-Marker objects

class       cf_AutoScaleFontSpec;
#include    <cf_api/c0_tatb.hpp>

class       cf_Kernel;
class       cf_Virt3DObj;
#include    <cf_api/c1_vobj.hpp>

class       cf_3DTextMarker;
#include    <cf_api/co1_tmar.hpp>

class       cf_ChartEngine;
#include    <cf_api/c1_engin.hpp>

class       cf_ChartModel;
#include    <cf_api/c1_cmodl.hpp>

//---------------------------------------------------
// OK... here's what we're gonna do in this file:
//---------------------------------------------------
class   cf_3DTextMarkerSeries;
        // This base class specifies basic data storage behavior for a series
        // of 2D/3D Text Markers and can serves as the basis for a set of
        // WIDELY divergent derived-objects with VERY different behaviors.

class   cf_TitleMarkerMgr;
        // This singleton cf_3DTextMarkerSeries-derived class
        // will control behavior for set(s) of "Chart Markers" in
        // the virtual XY Plane, and acts like a "(Glass) White-Board"

//=============================================================
// Declare a Chart Framework "Text Marker Series" BASE class.
//=============================================================
class   cf_3DTextMarkerSeries : public cf_Virt3DObj
{

public:

    cf_3DTextMarkerSeries( cf_ChartEngine *p_cf_engINowBelongTo );

    virtual             ~cf_3DTextMarkerSeries();

    cf_3DTextMarker*    activateMarker( int iMarkerNumber );
                        // Get a pointer to the indicated text marker.
                        // Bogus indices return the first marker in
                        // the series.  If there is no first marker,
                        // we will new() one and return its pointer.

    cf_3DTextMarker*    addTextMarker();
                        // Add a "default" 3D-text-marker (with the
                        // tail, head, and text points at 0,0,0, and
                        // return a pointer to this new marker.

    cf_3DTextMarker*    addTextMarker(  cf_3DPoint  *p_cf_3dpTailPoint,
                                        cf_3DPoint  *p_cf_3dpHeadPoint,
                                        cf_3DPoint  *p_cf_3dpTextPoint );
                        // Add a "user-specified" (by 3 geometric
                        // points) 3D-text-marker and return a
                        // pointer to this new marker.

    cf_3DTextMarker*    addTextMarker(  double  dPctWidthFromCtr,
                                        double  dPctHeightFromCtr,
                                        double  dPctDepthFromCtr );
                        // Add a "user-specified" (with tail and head
                        // points at 0,0,0, and the text-point posit
                        // as a percentage projection away from the
                        // center of the chart-engine's 3D-box.


    BOOL    activeMarkerPositHead(  double  dPctWidthFromCtr,
                                    double  dPctHeightFromCtr,
                                    double  dPctDepthFromCtr );

    BOOL    activeMarkerPositHead(  double  dPctWidthFromCtr,
                                    double  dPctHeightFromCtr );
                                    // dPctDepthFromCtr is unchanged!

    BOOL    activeMarkerPositTail(  double  dPctWidthFromCtr,
                                    double  dPctHeightFromCtr,
                                    double  dPctDepthFromCtr );

    BOOL    activeMarkerPositTail(  double  dPctWidthFromCtr,
                                    double  dPctHeightFromCtr );
                                    // dPctDepthFromCtr is unchanged!

    BOOL    activeMarkerPositText(  double  dPctWidthFromCtr,
                                    double  dPctHeightFromCtr,
                                    double  dPctDepthFromCtr );

    BOOL    activeMarkerPositText(  double  dPctWidthFromCtr,
                                    double  dPctHeightFromCtr );
                                    // dPctDepthFromCtr is unchanged!
            //---------------------------------------------------------
            // Allows the user to over-ride the default positioning
            // of the Head, Tail and Text of the Text Marker, and
            // specify a new position as an X/Y projection away from
            // the projected CENTER of the chart.  Positive OR
            // negative percentages are allowed.
            //
            // Positioning calls with only X and Y params leave the
            // Z-coord unchanged, and are used in format dialog
            // controls where the users only update the X and Y
            // positions of the markers.
            //---------------------------------------------------------


    virtual void    applyDataUpdate( cf_ChartModel *p_cf_cmodlDataSource );

    virtual void    applyGeomXform( cf_Kernel   *p_cf_kUseThisKernel );
    virtual void    applyProjXform( cf_Kernel   *p_cf_kUseThisKernel );

    virtual void    applyScaleOp(   double dXScaleFactor,
                                    double dYScaleFactor,
                                    double dZScaleFactor );

    virtual void    applyTranslateOp(   double  dXTrans,
                                        double  dYTrans,
                                        double  dZTrans );

    virtual void    colorBack( const bf_Color &cr_bf_clrNewVal );
                    // (re)set (any active) font spec text back colors

    virtual void    draw2D( bf_Display *p_bf_dspOutputDisplay );
    virtual void    draw3D( bf_Display *p_bf_dspOutputDisplay );


    BOOL        isActive();
    BOOL        isActive( BOOL bNewState );


    cf_3DTextMarker*
                markerValueAt(  double  dPctWidthFromCtr,
                                double  dPctHeightFromCtr,
                                double  dPctDepthFromCtr,
                                double  dValueForLabel );
    cf_3DTextMarker*
                markerLabelAt(  double  dPctWidthFromCtr,
                                double  dPctHeightFromCtr,
                                double  dPctDepthFromCtr,
                                const char  *a_cStringForLabel );
                //------------------------------------------------------
                // Enables users to create new text markers placed at a
                // specific location within an chart engine's 3D space:
                // The "text point" is placed at the location specified
                // as a X/Y/Z percentage distance away from the CENTER
                // of the chart.  Pos. OR neg. percentages are allowed.
                // The "head" and "tail" points are initialized to
                // be at the x=y=z=0 origin of the 2D/3D chart/engine.
                // The "active marker" will point to this new marker.
                //------------------------------------------------------


    int             numActiveMarks();
    int             numActiveMarks( int iResetValue );
    int             numMarks();

    void            on();
    void            off();

    virtual void    reset();

protected:

    cf_DyArr    da_p_cf_3dtmMarkerArray_;
    int         iNumMarkAllocs_;
                // This cf_3DTextMarkerSeries will coordinate the
                // creation, destruction, manipulation, and display
                // of a set of cf_3DTextMarkers...

    cf_ChartEngine  *p_cf_engParent_;
                    // ...in the run-time context of a "parent" chart/engine.

    cf_3DTextMarker *p_cf_3dtmActiveMarker_;
                    // C-tor inits to NULL.  This pointer is only
                    // set by valid calls to addTextMarker(...)
                    // or activateMarker( int );

    BOOL    bIsActive_;
            // I.e. the user may turn this series OFF (or ON)...

    double  dTransX, dTransY, dTransZ;
    double  dScaleFacX, dScaleFacY, dScaleFacZ;
            // We'll need to keep track of how much this object
            // has been translated, or  scaled, so we can "backtrack"
            // or reverse any operations on its components.

    double  dVirtXMax, dVirtXMin;
    double  dVirtYMax, dVirtYMin;
    double  dVirtZMax, dVirtZMin;
            // Used in geometric calcs for XYZ scaling & xlation.

};  // End of cf_3DTextMarkerSeries declaration.


//=============================================================
// Declare a Chart Framework "Chart Title Manager" class.
// This singleton cf_3DTextMarkerSeries-derived class
// will control behavior for a set of "Chart Title Markers"
//=============================================================
class CF_EXPORT   cf_TitleMarkerMgr : public  cf_3DTextMarkerSeries
{

public:

    cf_TitleMarkerMgr( cf_ChartEngine *p_cf_engINowBelongTo );
            // We operate in the run-time context of a chart/engine...

    virtual ~cf_TitleMarkerMgr();
            // Virtual d-tors critical at delete time if we
            // only used pointers to the base type...

    virtual void    applyDataUpdate( cf_ChartModel *p_cf_cmodlDataSource );

    virtual void    draw2D( bf_Display *p_bf_dspOutputDisplay );
    virtual void    draw3D( bf_Display *p_bf_dspOutputDisplay );
                    // This will RE-DRAW the axis markers OVER
                    // any data objects in the chart/engine!...

    cf_3DTextMarker*    markerTitle();
    cf_3DTextMarker*    markerSubTitle();

    cf_3DTextMarker*    markerAxis_X_BackFace();
    cf_3DTextMarker*    markerAxis_X_BottomFace();
    cf_3DTextMarker*    markerAxis_Y_LeftFace();
    cf_3DTextMarker*    markerAxis_Y_BackFace();
    cf_3DTextMarker*    markerAxis_Z_LeftFace();
    cf_3DTextMarker*    markerAxis_Z_BottomFace();
    cf_3DTextMarker*    markerAxis_Polar_Floor();
                        // Yields a pointer to the indicated axis
                        // grid/tick/series text marker "label".
                        // (This can also be done through engine
                        // and grid/tick/series methods...)

    virtual void        reset();

protected:

    cf_3DTextMarker *p_cf_3dtmTitle_;
    cf_3DTextMarker *p_cf_3dtmSubTitle_;

    cf_3DTextMarker *p_cf_3dtmXAxisBackFace_;
    cf_3DTextMarker *p_cf_3dtmXAxisBottomFace_;

    cf_3DTextMarker *p_cf_3dtmYAxisLeftFace_;
    cf_3DTextMarker *p_cf_3dtmYAxisBackFace_;

    cf_3DTextMarker *p_cf_3dtmZAxisLeftFace_;
    cf_3DTextMarker *p_cf_3dtmZAxisBottomFace_;

    cf_3DTextMarker *p_cf_3dtmPolarFloor_;

};  // End of cf_TitleMarkerMgr declaration.

#endif

////////////////////////////////////////
// END of File: CO1_TMS.HPP
////////////////////////////////////////

