//////////////////////////////////////
// START of File: CO3_PHS.HPP
//////////////////////////////////////

#ifndef CO3_PHS_HPP         // Avoid multiple includes...
#define CO3_PHS_HPP TRUE    // ...holds to a terminal #endif below...

//===================================================================
//
// 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/./cf_hpps/co3_phs.hpp>
// "2D/3D PolyHedra Series" 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_DyArr;   // We'll use dynamic arrays of (void) ptrs
#include    <cf_api/c0_dyarr.hpp>  // to 3D-PolyHedra objects

class       bf_Color;
class       cf_2DPoint;
class       bf_Display;
class       cf_Kernel;
class       cf_Virt3DObj;
class       cf_3DPoint;
class       cf_3DFacet;
class       cf_3DPolyHedra;
class       cf_3DBarHedra;
class       cf_3DColumnHedra;
class       cf_3DStackHedra;
#include    <cf_api/co3_phed.hpp>
            // Which includes the classes above

//
// Class cf_3DPhedraSeries abstracts a set of 
// graphable Chart Framework PolyHedra.
//
class CF_EXPORT   cf_3DPhedraSeries 

        : public cf_Virt3DObj 

{

public:

    cf_3DPhedraSeries();    // Default c-tor w.o. DispAttribs pointer
                            // uses Pen=CF_BLACK; brush=CF_WHITE;

    cf_3DPhedraSeries( cf_DispAttribs *p_attrToDrawWith );
                    // Std c-tor lets user assign display attribs
                    

    virtual         ~cf_3DPhedraSeries();


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


    cf_3DPolyHedra* accessPhedra( int iIndex );

    cf_3DPolyHedra* accessPhedraFirst();    // DSORTed min-Z Phedra!
    cf_3DPolyHedra* accessPhedraLast();     // DSORTed max-Z Phedra!
                    // After DSORTs are applied, and Phedra are in
                    // sorted order, access the first/last as DSORTed.

    virtual void    addPhedra( cf_3DPolyHedra *p_cf_3dfNewFacet );

    virtual void    addPhedraNewBar(    double  dXMin,
                                        double  dXMax,
                                        double  dYMin,
                                        double  dYMax,
                                        double  dZMin,
                                        double  dZMax  );

    virtual void    addPhedraNewCol(    double  dXMin,
                                        double  dXMax,
                                        double  dYMin,
                                        double  dYMax,
                                        double  dZMin,
                                        double  dZMax  );

    virtual void    addPhedraNewStack(  double  dXMin,
                                        double  dXMax,
                                        double  dYMin,
                                        double  dYMax,
                                        double  dZMin,
                                        double  dZMax  );

    virtual void    addPhedraNewWedge(
                        const cf_3DPoint    &cr_cf_3dpLowerPlaneOrigin,
                        const cf_3DPoint    &cr_cf_3dpUpperPlaneOrigin,
                        double              dPlaneRadius,
                        double              dStartAngleInRadians,
                        double              dEndAngleInRadians,
                        double              dPercentHeight,
                        double              dPercentExplosion,
                        BOOL                bDrawCoveringPieSlice,
                        cf_DispAttribs      *p_attrToDrawWith );


    void            applyDSORTonZGeom( cf_Kernel *p_cf_kUseThisKernel );
    void            applyDSORTonPhedra();

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

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

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

    double      dataXMin() const;
    double      dataXMax() const;
    double      dataYMin() const;
    double      dataYMax() const;
    double      dataZMin() const;
    double      dataZMax() const;

    virtual void    dispUsingFacetSort( BOOL bNewState );
                    // Set/set Facet-based Depth-Sorting calcs ON/OFF.
                    // Note that we use BASE's BOOL dispUsingDSORT()!
    
    virtual void    dispUsingZDepthSort( BOOL bNewState );
                    // Set/set Geom-based Depth-Sorting calcs ON/OFF.
                    // Note that we use BASE's BOOL dispUsingDSORT()!
    
    virtual void    dispUsingHSE( BOOL bNewState );
                    // Set Hidden-Surface-Elimination calcs ON/OFF.
                    // Note that we use BASE's BOOL dispUsingDSORT()!

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


    int             numPhedra();
    void            numPhedra( int iNewNumber );


    virtual void    reset();


    double      scaleX();
    double      scaleY();
    double      scaleZ();


    double      screenXMin();
    double      screenXMax();
    double      screenYMin();
    double      screenYMax();


    double      transX();
    double      transY();
    double      transZ();


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


    double      xformXMin() const;
    double      xformXMax() const;
    double      xformXCtr() const;
    double      xformYMin() const;
    double      xformYMax() const;
    double      xformYCtr() const;
    double      xformZMin() const;
    double      xformZMax() const;
    double      xformZCtr() const;



protected:

    double      dDataXMax, dDataXMin;
    double      dDataYMax, dDataYMin;
    double      dDataZMax, dDataZMin;
                // Used in geometric calcs for Tick Marking Ops.
                            
    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 object
                // has been translated, or scaled, so we can "backtrack" 
                // or reverse any operations on its components. 

    double      dGeomXMax, dGeomXMin, dGeomXCtr;
    double      dGeomYMax, dGeomYMin, dGeomYCtr;
    double      dGeomZMax, dGeomZMin, dGeomZCtr;
                // Used in geometric calcs for DSORT.
                            
    double      dScreenXMax, dScreenXMin,
                dScreenYMax, dScreenYMin;
                // Used in projection calcs for DSORT.
                            
    cf_DyArr    da_p_cf_3dphSeries;
    int         iNumPhedra;
                // Dynamic Storage for the 3D PolyHedra
                // that compose this 3D PolyHedra Series.

private:

};  //
    // End of cf_3DPhedraSeries declaration.
    //

#endif      // Terminates include re-definition protection

//////////////////////////////////////
// END of File: CO3_PHS.HPP
//////////////////////////////////////

            
