⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 co3_phed.hpp

📁 windRiver提供的的Zinc5.3完整源码,文档非常齐全
💻 HPP
字号:
//////////////////////////////////////
// START of File: C03_PHED.HPP
//////////////////////////////////////

#ifndef C03_PHED_HPP            // Avoid multiple includes...
#define C03_PHED_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_phed.hpp>
// "2D/3D Polyhedra 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       cf_3DPolyLine;
#include    <cf_api/co1_plin.hpp>

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 "PolyHedra" zApp class.
//
// Class cf_3DPolyHedra abstracts a set of graphable 
// Chart Framework facets (derived from polygons).
//
class CF_EXPORT   cf_3DPolyHedra 

        : public cf_Virt3DObj 

{

public:

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

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

    virtual         ~cf_3DPolyHedra();


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


    cf_3DFacet*     accessFacet( int iIndex );

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

    virtual void    addFacet( cf_3DFacet *p_cf_3dfNewFacet );

    void            applyGSORT();
    void            applyFSORT();

    virtual void    applyGeomXform( cf_Kernel  *p_cf_kUseThisKernel );
    virtual 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 );


    double      gsortRefPointCoordX() const;
    double      gsortRefPointCoordY() const;
    double      gsortRefPointCoordZ() const;

    double      gsortRefPointHypot() const;

    virtual void    gsortRefApplyXformGeom( cf_Kernel *p_cf_kUseSameKernel );

    virtual void    gsortRefApplyXformProj( cf_Kernel *p_cf_kUseSameKernel );


    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();


    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;
    
    cf_3DPoint  cf_3dpRefForGSORT;
    double      dHypotForGSORT;
                // Used in geometric calcs for DSORTs.
                            
    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 PolyHedra object.

private:

};  //
    // End of cf_3DPolyHedra declaration.
    //

//
//=====================================================
// Declare a set of "PolyHedra-Derived" Objects
// such as "Bar", "Column" and "Stacked" Polyhedra:
//=====================================================
//

//
//-------------------------------------------------------
// A "3D Bar" PolyHedra object resolves G-Sorts first
// w.r.t. Z-coords, and breaks ties w.r.t Y-coords,
// ... NOT X-coords!
//-------------------------------------------------------
//
class CF_EXPORT   cf_3DBarHedra : 
        public 
        cf_3DPolyHedra 
{

public:

    cf_3DBarHedra(  double          dXMin,
                    double          dXMax,
                    double          dYMin,
                    double          dYMax,
                    double          dZMin,
                    double          dZMax,
                    cf_DispAttribs  *p_attrToDrawWith );
                    // Default c-tor NOT needed -- array ops will
                    // ONLY apply to the base *cf_3DPolyHedra objects!
                    // Std c-tor FORCES user to assign display attribs

    virtual         ~cf_3DBarHedra();

    virtual void    gsortRefApplyXformGeom( cf_Kernel *p_cf_kUseSameKernel );


};  //  End of cf_3DBarHedra declaration.


//
//-------------------------------------------------------
// A "3D Column" PolyHedra object resolves G-Sorts first
// w.r.t. Z-coords, and breaks ties w.r.t X-coords:
//-------------------------------------------------------
//
class CF_EXPORT   cf_3DColumnHedra : 
        public 
        cf_3DPolyHedra 
{

public:

    cf_3DColumnHedra(   double          dXMin,
                        double          dXMax,
                        double          dYMin,
                        double          dYMax,
                        double          dZMin,
                        double          dZMax,
                        cf_DispAttribs  *p_attrToDrawWith );
                        // Default c-tor NOT needed -- array ops will
                        // ONLY apply to the base *cf_3DPolyHedra objects!
                        // Std c-tor FORCES user to assign display attribs!

    virtual         ~cf_3DColumnHedra();

    virtual void    gsortRefApplyXformGeom( cf_Kernel *p_cf_kUseSameKernel );


};  //  End of cf_3DColumnHedra declaration.



//
//---------------------------------------------------------
// A "3D Stack" PolyHedra object resolves G-Sorts first
// w.r.t. Z-coords, and breaks ties by (centered) Y-coords:
//---------------------------------------------------------
//
class CF_EXPORT   cf_3DStackHedra : 
        public 
        cf_3DPolyHedra 
{

public:

    cf_3DStackHedra(    double          dXMin,
                        double          dXMax,
                        double          dYMin,
                        double          dYMax,
                        double          dZMin,
                        double          dZMax,
                        cf_DispAttribs  *p_attrToDrawWith );
                        // Default c-tor NOT needed -- array ops will
                        // ONLY apply to the base *cf_3DPolyHedra objects!
                        // Std c-tor FORCES user to assign display attribs!

    virtual         ~cf_3DStackHedra();

    virtual void    gsortRefApplyXformGeom( cf_Kernel *p_cf_kUseSameKernel );


};  //  End of cf_3DStackHedra declaration.



//
//---------------------------------------------------------
// A "3D Stack" PolyHedra object resolves G-Sorts first
// w.r.t. Z-coords, and breaks ties by (centered) X-coords:
//---------------------------------------------------------
//
class CF_EXPORT   cf_3DRadialHedra :
        public
        cf_3DPolyHedra
{

public:

    cf_3DRadialHedra(   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 );
                        // Default c-tor NOT needed -- array ops will
                        // ONLY apply to the base *cf_3DPolyHedra objects!
                        // Std c-tor FORCES user to assign display attribs!

    virtual         ~cf_3DRadialHedra();

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

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

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

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

    virtual void    gsortRefApplyXformGeom( cf_Kernel *p_cf_kUseSameKernel );

protected:

    // Define points for the LOWER plane of this radial-wedge-hedra:
    cf_3DPoint          cf_3dpOriginLower2Keep_;
    cf_3DPoint          cf_3dpOriginLowerXforms_;
    cf_3DPoint          cf_3dpRendRectLowerLT_;
    cf_3DPoint          cf_3dpRendRectLowerRB_;
    cf_3DPoint          cf_3dpStartArcLower_;
    cf_3DPoint          cf_3dpMiddleArcLower_;
    cf_3DPoint          cf_3dpFinishArcLower_;

    // Define points for the UPPER plane of this radial-wedge-hedra:
    cf_3DPoint          cf_3dpOriginUpper2Keep_;
    cf_3DPoint          cf_3dpOriginUpperXforms_;
    cf_3DPoint          cf_3dpRendRectUpperLT_;
    cf_3DPoint          cf_3dpRendRectUpperRB_;
    cf_3DPoint          cf_3dpStartArcUpper_;
    cf_3DPoint          cf_3dpMiddleArcUpper_;
    cf_3DPoint          cf_3dpFinishArcUpper_;

    // Define attributes for this radial-wedge-hedra:
    BOOL                bDrawPieSlice_; // Passed in via c-tor param.

    // Define extra render-component attributes for edge-lines:
    cf_3DPolyLine       cf_3dplStartBottomRadius_;
    cf_3DPolyLine       cf_3dplFinishBottomRadius_;
    cf_3DPolyLine       cf_3dplOriginEdge_;
    cf_3DPolyLine       cf_3dplStartVertEdge_;
    cf_3DPolyLine       cf_3dplFinishVertEdge_;
    cf_3DPolyLine       cf_3dplStartTopRadius_;
    cf_3DPolyLine       cf_3dplFinishTopRadius_;

    // Define pointers that can track facets to tell us if they
    // face forward -- which affects rendering behavior:
    cf_3DFacet          *p_cf_3dfOrigToStartArcFacet_;
    cf_3DFacet          *p_cf_3dfStartToMidArcFacet_;
    cf_3DFacet          *p_cf_3dfMidToFinishArcFacet_;
    cf_3DFacet          *p_cf_3dfFinishToOrigArcFacet_;
                        // Note that we do NOT do delete ops on
                        // these "extra" pointers at d-tor time!

};  //  End of cf_3DStackHedra declaration.


#endif      // Terminates include re-definition protection

//////////////////////////////////////
// END of File: C03_PHED.HPP
//////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -