////////////////////////////////////////
// Start of File: CO1_TMAR.HPP
////////////////////////////////////////

#ifndef CO1_TMAR_HPP
#define CO1_TMAR_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:
// Usage:   #include    <cf_api/co1_tmar.hpp>
            // Chart Framework "Text Marker (with Pointing Line)" object.

//--------------------------------------------------------------------
// 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       cf_AutoScaleFontSpec;
#include    <cf_api/c0_tatb.hpp>

class       cf_Virt3DObj;
class       cf_3DPoint;
#include    <cf_api/co1_poin.hpp>

//===========================================================================
// Declare a Chart Framework "Text Marker" zApp class.
//
// Class cf_3DTextMarker abstracts a set of graphable 3D points, marking
// the endpoints of a "text marker line", and associated text that will be
// displayed at the end of the text marker line.
//
// cf_3DTextMarkers will generate their text output (i.e. labels)
// using a "current Text Mark Font" pushed by the owner object,
// e.g. a cf_3DTextMarkerSeries or a cf_3DGridTickSeries...
//===========================================================================
class CF_EXPORT   cf_3DTextMarker : public cf_Virt3DObj
{

public:

    cf_3DTextMarker();  // Default C-tor for Dynamic Arrays...

    cf_3DTextMarker(    cf_3DPoint *p_cf_3dpTailPoint,
                        cf_3DPoint *p_cf_3dpHeadPoint,
                        cf_3DPoint *p_cf_3dpTextPoint );
                        // "Efficient" 3D-Point POINTER paramed
                        // c-tor for 3D Points already allocated by
                        // "on-site" users avoids costly copy ops...

    cf_3DTextMarker(    const cf_3DPoint &cr_cf_3dpTailPoint,
                        const cf_3DPoint &cr_cf_3dpHeadPoint,
                        const cf_3DPoint &cr_cf_3dpTextPoint );
                        // Parameterized "3D-Point COPY" c-tor
                        // is a little less efficient, but IS
                        // reliable, and provides a full range
                        // of functional nuances for users...

    virtual             ~cf_3DTextMarker();
                        // All virtual (derived) chart objs need this...


    cf_3DTextMarker&    operator=( const cf_3DTextMarker&
                                            cr_cf_3dtmSource );
                        // "Content copies" the referenced 3D
                        // Text Marker's 3D-Points and attributes
                        // to this 3D Text Marker.


    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
    cf_DispAttribs* dispAttribsNewSet();

    virtual
    void            dispAttribsPointTo( cf_DispAttribs *p_cf_datbTarget );
                    // In order to set this object's display attributes
                    // we must over-ride the virtual-geometry-object's
                    // basic method to also update the disp-attribs of
                    // this text-marker's encapsulated 3D-points!

    BOOL        dispLineHead();
    void        dispLineHead( BOOL bNewState );
    BOOL        dispLineTail();
    void        dispLineTail( BOOL bNewState );

    BOOL        dispInverted();
    void        dispInverted( BOOL bNewState );

    BOOL        dispMarkerHead();
    void        dispMarkerHead( BOOL bNewState );
    BOOL        dispMarkerTail();
    void        dispMarkerTail( BOOL bNewState );

    BOOL        dispText();
    void        dispText( BOOL bNewState );
                // Get/set derived display attributes


    virtual void draw2D( bf_Display *p_bf_dspOutputDisplay );
    virtual void draw3D( bf_Display *p_bf_dspOutputDisplay );
            // DRAW this cf_3DTextMarker on a bf_Display.
            // Note that the Tick Mark Label will be drawn within
            // the context of bUseOwnerAttributes( bCurrentState ),
            // which will determine whether the text marker
            // pushes/pops its OWN font spec, or uses a font spec
            // (presumably) pushed/poped by an owning object,
            // e.g. a Grid/Tick Series.  Also note that in this
            // implementation, text markers always get rendered
            // in 3D mode, even if the owning object/engine is being
            // rendered in 2D mode -- there is no difference.

    char*       labelIs();
                // Get a ptr to our text marker's "dynamic string" label.

    void        labelNew( const char *a_cStringForNewLabel );

    void        labelNew(   const double    cdValueForNewLabel,
                            const char      *ca_cFormatString = "%g" );

    void        labelNew(   const int       ciValueForNewLabel,
                            const char      *ca_cFormatString = "%d" );
                // Sets (and allocates) an (optional) label for the
                // text-marker from a const array of chars in a
                // null-terminated string, or a data value (that
                // gets turned into a string).  Data-value-conversion
                // methods have optional sprintf()-like format specifiers.

    BOOL        labelSet();
                // Queries to see if label was ever set (and allocated).

    void        labelUsing( cf_String *p_cf_strSomeoneElsesLabel );
                // "Borrow" a pointer to another object's dynamic
                // string to use as a label.  "Taget" object (typically
                // a "data model/data group" MUST take care NOT to delete
                // the "someone else's label" string and then have this
                // object try to reference it -- doohhpp !!!...

    cf_3DPoint* pointToHead();
    cf_3DPoint* pointToTail();
    cf_3DPoint* pointToText();
                // Simply returns the address of the point requested.

private:

    cf_3DPoint      *p_cf_3dpTail;
    cf_3DPoint      *p_cf_3dpHead;
    cf_3DPoint      *p_cf_3dpText;
                    // The 3 (three) points which comprise a 3D Text
                    // Marker are the Tail, (aka the Grid), the Head,
                    // (aka the Tick), and the Text Point, (aka the
                    // Label Point).

    BOOL            bDoWeDrawTailLine;
    BOOL            bDoWeDrawHeadLine;
                    // We can select to draw (or not) these 2 line segs.

    BOOL            bDrawInverted_;
                    // In this mode, we use the *head-point* for text.

    BOOL            bDoWeDrawTailPoint;
    BOOL            bDoWeDrawHeadPoint;
                    // We can select to draw (or not) 2 marker points.
                    // Note that the text marker point renders text only!

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

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

    cf_String      *p_cf_strLabel;
                    // Gets printed from the TAIL (last point) of
                    // the Grid-Start to Grid-End to Tick-End Line.

    BOOL            bWasLabelNewed;
    BOOL            bWasLabelSet;
    BOOL            bDoWeDrawLabel;
                    // Because sometimes we DON'T wanna!...
                    // And sometimes we don't even HAVE a string!...

};  // End of cf_3DTextMarker declaration.

#endif      // Terminates include re-definition protection

////////////////////////////////////////
// End of File: CO1_TMAR.HPP
////////////////////////////////////////

