//////////////////////////////////////
// START of File: CO1_POIN.HPP
//////////////////////////////////////

#ifndef CO1_POIN_HPP
#define CO1_POIN_HPP

//===================================================================
//
// COPYRIGHT NOTICE:  This code is protected by Copyright!
//
// Copyright (c) 1994 through 1997 by DPC Technology Corporation.
// All rights reserved by DPC Technology Corporation.
//
// 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_poin.hpp>
            // Chart Framework "2D/3D Geometric XYZ Point" object.

//--------------------------------------------------------------------
// Include Chart Framework class or ID defs/headers this file needs.
// Paths are relative to the IDE's (global) include path: ~/cfrz
//--------------------------------------------------------------------
class       bf_Color;
class       cf_2DPoint;
class       cf_Kernel;
class       cf_Virt3DObj;
#include    <cf_api/c1_vobj.hpp>
            // which pulls in other classes above...


// Define state vars for rendering 3D-Points:
typedef enum { edsSquare, edsDot, edsCircle, edsTriangle,
                edsPlusSign, edsMinusSign, edsBang } eDrawShape;
                // "eds" = e(numerated) d(raw) s(hapes)

// Define a default rendering size for this object -- see draw2D() member:
#define CO1_POIN_DEFAULT_FIXED  5       // i.e. sized at five PIXELS
#define CO1_POIN_DEFAULT_SCALE  5.0     // i.s. SCALE to five PERCENT

//==========================================================================
// Declare a Chart Framework "3D-Point" class.
// This class describes the attributes of an abstract point
// (or vertex) in 3D space, including its DATA coordinates,
// its VIRTUAL coordinates, its TRANSFORMED coordinates,
// and its SCREEN PROJECTION coordinates, as well as
// other properties, such as COLORs, etc
//
// This class also has the ability to DRAW itself, provided the
// proper display/device context is available, (achieved by
// passing a pointer to a "Display-Object" to this object's
// draw method(s).
//
// It is important to realize that this class does NOT know about
// Chart and Engine objects, even though it is designed to
// be used by them.  It only knows about the "Kernel" class,
// from whence it gets its transform information, and the
// "Display" class, where it calls display rendering methods
// to draw itself...
//==========================================================================
class CF_EXPORT   cf_3DPoint : public cf_Virt3DObj
{

public:

    cf_3DPoint();   // Default C-tor inits to: Data/Virt/Geom
                    // X/Y/Z = 0.0; Until Disp Attribs are set,
                    // colors are Pen=CF_ BLACK; Brush=CF_WHITE

    cf_3DPoint( double  dInitX,
                double  dInitY,
                double  dInitZ );
                // Parametrized c-tor for user inits...

    virtual     ~cf_3DPoint();
                // Virtual D-tor is VERY important

    cf_3DPoint& operator=( const cf_3DPoint& cr_cf_3dpSource );
                // VERY important for dynamic array ops, etc.!

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

    virtual void    applyScaleOp(   double dXScaleFactor,
                                    double dYScaleFactor,
                                    double dZScaleFactor );
                    // This scale op is VERY much controlled by
                    // an "owner" object, e.g. a point series.


    virtual void    applyTranslateOp(   double dXTrans,
                                        double dYTrans,
                                        double dZTrans );
                    // This translate op is VERY much controlled by
                    // an "owner" object, e.g. a point series.


    void        dataX( double dNewX );
    void        dataY( double dNewY );
    void        dataZ( double dNewZ );

    void        dataXYZ(    double  dNewX,
                            double  dNewY,
                            double  dNewZ );

    double  dataX() const;
    double  dataY() const;
    double  dataZ() const;

    double  dataXMin() const;
    double  dataXMax() const;
    double  dataYMin() const;
    double  dataYMax() const;
    double  dataZMin() const;
    double  dataZMax() const;
                // Note that for 3D Points, Min==Max...
                // i.e. a "point" has no dimensions!


    eDrawShape  dispMarkerShape();
    void        dispMarkerShape( const eDrawShape &cr_edsNewShape );
                // Note that this method is NOT currently implemented.
                // The only currently-supported marker shape is a CIRCLE.

    int         dispMarkerSize();
    void        dispMarkerSize( int iNewSize );
                // User/Owner objects can get/set display attribs.


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

    virtual void    drawFixed(  bf_Display  *p_bf_dspOutputDisplay,
                                int         iMarkerRadialSize,
                                eDrawShape  edsMarkerShape = edsCircle );
                    // Usually used in the context of a point-series object.
                    // More efficient because the display attributes of the
                    // 3D-point are NOT pushed onto the display.  Note that
                    // the only currently-supported marker shape is a CIRCLE.


    void        preferAutoScale( BOOL bNewState );
    BOOL        preferAutoScaleIs();
                // If auto-scaling is OFF, point-markers will be rendered
                // as size CO1_POIN_DEFAULT_FIXED (defined above)!

    void        preferAutoScalePct( double  dPercentOfMinDispDimension );
                                            // Default is approx 4% to 5%.
    double      preferAutoScalePctIs();
                // Set/get the auto-scaling size of the point-marker to
                // a percentage of the MINIMAL constraining dimension
                // (vertical OR horizontal) of the chart's 2D-Projection.


    cf_2DPoint      screenPoint();
    int             screenX();
    int             screenY();

    BOOL            skipGeomXforms();
    void            skipGeomXforms( BOOL bNewState );
                    // Makes Geom/Xform Coords always == Virt Coords.

    double      virtX() const;
    double      virtY() const;
    double      virtZ() const;

    double      virtXMin() const;
    double      virtXMax() const;
    double      virtYMin() const;
    double      virtYMax() const;
    double      virtZMin() const;
    double      virtZMax() const;


    double      xformX() const;
    double      xformY() const;
    double      xformZ() const;

    double      xformXMin() const;
    double      xformXMax() const;
    double      xformYMin() const;
    double      xformYMax() const;
    double      xformZMin() const;
    double      xformZMax() const;


protected:

    // Define Data members for this class -- we'll need to model
    // the DATA values, the VIRTUAL (non-transformed geometric
    // coord values), the XFORM (transformed geometric coord values),
    // and the screen projected coords of these "points"... whew!...
    double      dDataX, dDataY, dDataZ;
                // Initial 3D DATA coords of the cf_3DPoint. These
                // coords can be reset directly via member functions.

    double      dVirtX, dVirtY, dVirtZ;
                // VIRTUAL 3D coords of the cf_3DPoint, after translations
                // and scaling ops, but BEFORE any geometry transforms.
                //
                // These coords can NOT be reset directly by users, but
                // CAN be re-set via translate() and scale() ops.

    double      dXformX, dXformY, dXformZ;
                // Virtual 3D coords of the cf_3DPoint, put through
                // geometric XFORMs, to get screen coords below...
                //
                // Same reset characteristics as Virtual coords above,
                // (i.e. only reset via geometric ops).

    cf_2DPoint  cf_2dpScreenCoord;
                // Projected screen coords of the cf_3DPoint,
                // used for drawing, and pick correlation.
                //
                // Same reset characteristics as Xform coords,
                // (i.e. only reset via projection ops).

    BOOL        bSkipGeomXforms;
                // Some 3D Points, (e.g. 3D Points in Text
                // Markers in Chart Title Markers), do NOT
                // want to go through a Geom Xform -- instead,
                // they want the Geom Xform coord = Virt coord.
                //
                // Because almost EVERY 3D Point "wants to" do
                // Geom-Xforms , c-tor inits this var to FALSE !!!

    //--------------------------------------------------
    // Other rendering attributes of this point object:
    //--------------------------------------------------
    eDrawShape  edsPointShape;      // C-tor init: enum edsCircle (above).
    int         iMarkerRadialSize_;  // C-tor init: C01_POIN_DEFAULT_FIXED

    double      dAutoScalePct;      // C-tor init: CO1_POIN_DEFAULT_SCALE
    BOOL        bAutoScale;         // C-tor init: FALSE

};  // End of cf_3DPoint declaration.


#endif

//////////////////////////////////////
// END of File: CO1_POIN.HPP
//////////////////////////////////////

