//////////////////////////////////////
// START of File: CO3_SURF.HPP
//////////////////////////////////////

#ifndef CO3_SURF_HPP            // Avoid multiple includes...
#define CO3_SURF_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_surf.hpp>
// "2D/3D Surface Facet Collection" 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-Facet objects

class       bf_Color;
class       cf_2DPoint;
class       bf_Display;
class       cf_Kernel;
class       cf_Virt3DObj;
class       cf_3DPoint;
class       cf_3DFacet;
#include    <cf_api/co3_face.hpp>
            // Which includes the classes above

//
// Declare a Chart Framework "3D-Surface" zApp class.
//
// Class cf_3DSurface abstracts a set of graphable 
// Chart Framework facets (derived from polygons).
//
class CF_EXPORT   cf_3DSurface 

        : public cf_Virt3DObj 

{

public:

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

    cf_3DSurface( cf_DispAttribs *p_attrToDrawWith );
                    // Std c-tor lets user assign display attribs
                    
    virtual         ~cf_3DSurface();
                    // virtual d-tor are critical for this object family

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

    cf_3DFacet*     accessFacet( int iIndex );
                    // Random access to individual facets

    cf_3DFacet*     accessFacetFirst(); // DSORTed min-Z facet!
    cf_3DFacet*     accessFacetLast();  // DSORTed max-Z facet!
                    // After DSORTs are applied, and facets are in
                    // sorted order, access the first/last as DSORTed.

    virtual void    addFacet( cf_3DFacet *p_cf_3dfNewFacet );

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

    virtual void    addFacetsForRibbon( double  dXLeft,
                                        double  dXRight,
                                        double  dYLeft,
                                        double  dYRight,
                                        double  dZMin,
                                        double  dZMax  );

    virtual void    applyDSORTonZGeom();
    virtual void    applyDSORTonFacets();

    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 double  dataXMin() const;
    virtual double  dataXMax() const;
    virtual double  dataYMin() const;
    virtual double  dataYMax() const;
    virtual double  dataZMin() const;
    virtual double  dataZMax() const;

    virtual void    dispUsingFacetSort( BOOL bNewState );
                    // Set Facet-based Depth-Sorting calcs ON/OFF.
                    // Note that we use BASE's BOOL dispUsingFacetSort()!

    virtual void    dispUsingZDepthSort( BOOL bNewState );
                    // Set Geom-based Depth-Sorting calcs ON/OFF.
                    // Note that we use BASE's BOOL dispUsingZDepthSort()!
    
    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 );


    virtual double  geomXMin() const;
    virtual double  geomXMax() const;
    virtual double  geomXCtr() const;
    virtual double  geomYMin() const;
    virtual double  geomYMax() const;
    virtual double  geomYCtr() const;
    virtual double  geomZMin() const;
    virtual double  geomZMax() const;
    virtual double  geomZCtr() const; 


    int         numFacets();
    void        numFacets( 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();


    virtual double  virtXMin() const;
    virtual double  virtXMax() const;
    virtual double  virtYMin() const;
    virtual double  virtYMax() const;
    virtual double  virtZMin() const;
    virtual double  virtZMax() 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 "back-
                // track" 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_3dfOurCollection;
    int         iNumFacets;
                // Dynamic Storage for the 3D Facets 
                // that compose this 3D Surface.

private:

};  //
    // End of cf_3DSurface declaration.
    //

#endif      // Terminates include re-definition protection

//////////////////////////////////////
// END of File: CO3_SURF.HPP
//////////////////////////////////////

            
