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

📄 c1_vobj.hpp

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

#ifndef NULL    // If a compiler is dim-witted...
#define NULL 0  // ...try to bring it up to speed!  
#endif          // This (hopefuly) should NOT happen a lot!
                     
#ifndef CO1_VOBJ_HPP
#define CO1_VOBJ_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/c1_vobj.hpp>
            // Chart Framework Virtual (base-class)
            // "2D/3D Geometric Chart Object".

//--------------------------------------------------------------------
// Include Chart Framework class or ID defs/headers this file needs.
// Paths are relative to the IDE's (global) include path: ~/cfrz
//--------------------------------------------------------------------
#include    <cf_api/cf_defs.h>
            // Platform-Independent Chart Framework Typedefs...

class       bf_Display;
class       cf_DispAttribs;
#include    <cf_api/c0_datb.hpp>

class       cf_TextAttribs;
#include    <cf_api/c0_tatb.hpp>

class       cf_Kernel;
#include    <cf_api/c1_kernl.hpp>

//==============================================================
// Declare a Chart FrameWork "Virtual 3D Object" class.
// This class is a BASE class for all other Chart FrameWork
// geometric objects.
//
// Chart FrameWork cf_Virt3DObj objects have the ability to
// apply transforms to themselves, (using a given cf_Kernel)
// with either a GEOMETRIC or a PROJECTION transform.
// They also have the ability to SCALE and TRANSLATE by
// a set of X, Y and Z factors in their virtual 3D space.
//
// Chart FrameWork cf_Virt3DObj objects must have the ability
// to perform HSE (Hidden-Surface Elimination) and DSORT
// (Depth Sorting) comparisons to sort themselves
// in 3D space.
//
// This functionality must be performed in a polymorphic
// manner across a disparate set of object classes, (e.g.
// points, line segments, poly-lines, polygons, and surfaces.
//
// Chart FrameWork object classes also have the ability to DRAW
// themselves, provided the proper device context is available,
// (achieved by passing a pointer to a bf_Display "display"
// object).
//==============================================================
class CF_EXPORT   cf_Virt3DObj

{

public: // member methods

    cf_Virt3DObj(); // Default c-tor.

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

    virtual         ~cf_Virt3DObj();
                    // A Virtual D-tor is VERY important for this "class tree"

    cf_Virt3DObj&   operator=( const cf_Virt3DObj &cr_cf_vobjSource );
                    // VERY important to define an "=" operator
                    // for dynamic array ops, etc.!


    //------------------------------------------------
    // Control the Virtual-Object's Text-Attributes:
    //------------------------------------------------
    cf_TextAttribs* attribTextCurrent();
                    // Get whatever set of display attributes we're pointing at.
                    // Note that it is VERY wise to preceed this by a call to
                    // attribsTextValid() to insure we are not pointed to NULL!

    virtual
    cf_TextAttribs* attribTextNew();
                    // Create a New set of "Text-Attribs" to be the
                    // target for this object's Text-Attribs pointer!
                    // Any current new()ed allocation will be deleted.
                    // D-tor will be notified to delete these current
                    // new()-ed "Disp Attribs" object.

    virtual
    void            attribTextUsing( cf_TextAttribs *p_cf_tatbSource );
                    // Set this object's display attribute pointer. D-tor
                    // will know NOT to delete these BORROWED text-attribs!

    BOOL            attribTextValid();
                    // Did we REMEMBER to SET the text-attribs pointer for
                    // this object?  TRUE means yes, FALSE means that...
                    // we (doo-oop!) FORGOT!




    virtual void    applyDispMetrics( cf_Kernel  *p_cf_kUseThisKernel );
    virtual void    applyGeomXform( cf_Kernel  *p_cf_kUseThisKernel );
    virtual void    applyProjXform( cf_Kernel *p_cf_kUseThisKernel );
                    // Use the Given cf_Kernel pointer to apply
                    // Transformation(s) to this cf_Virt3DObj:
                    // Called by the parent chart-engine configuration
                    // in response to display/geometry context changes
                    // (e.g. re-size, view-angle events, etc.) imposed
                    // by the chart-engine's parent chart-model/chart-view.
                    // Pure virtual implementations force any *actual*
                    // implemtations into the derived objects.

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

    virtual void    applyTranslateOp(   double dXTrans,
                                        double dYTrans,
                                        double dZTrans );
                    // Use the Given double-typed factors to apply
                    // transformation(s) to this cf_Virt3DObj:

    cf_DispAttribs* dispAttribsCurrent();
                    // Get whatever set of display attributes
                    // we're pointing at -- note that it is VERY
                    // wise to preceed this call with a call to
                    // this->dispAttribsValid() to make sure
                    // that we are not pointed to NULL, etc!!!

    virtual cf_DispAttribs* dispAttribsNewSet();
                    // Create a New set of "Display Attribs" to be the
                    // target for this object's "Display Attribs" pointer!
                    // Any current new()ed allocation will be deleted.
                    // D-tor will be notified to delete these current
                    // new()-ed "Disp Attribs" object.

    virtual  void   dispAttribsPointTo( cf_DispAttribs *p_cf_datbTarget );
                    // Set this object's display attribute pointer. D-tor
                    // will know NOT to delete these borrowed attribs.

    BOOL            dispAttribsValid();
                    // Did we REMEMBER to SET the display attribs
                    // pointer for this object?  TRUE means yes,
                    // FALSE means that... we (doo-oop!) FORGOT!

    BOOL            dispIgnorePushBrush();
    void            dispIgnorePushBrush( BOOL bNewState );

    BOOL            dispIgnorePushFont();
    void            dispIgnorePushFont( BOOL bNewState );

    BOOL            dispIgnorePushPen();
    void            dispIgnorePushPen( BOOL bNewState );
                    // Get/set the bIgnorePush BOOL vars below...
                    // Default is to pay attention to display
                    // attribute push ops.

    void            dispPushBrushAttribs( bf_Display *p_bf_dspTarget );
    void            dispPushPenAttribs( bf_Display *p_bf_dspTarget );
                    // Modularizes "new" and "push" ops
                    // for display attribs.

    void            dispPopBrushAttribs( bf_Display *p_bf_dspTarget );
    void            dispPopPenAttribs( bf_Display *p_bf_dspTarget );
                    // Modularizes "pop" and "delete" ops
                    // for display attribs.

    BOOL            dispUsingFacetSort();
    virtual void    dispUsingFacetSort( BOOL bNewState );
                    // Get/set Facet-based Depth-Sorting calcs ON/OFF.

    BOOL            dispUsingZDepthSort();
    virtual void    dispUsingZDepthSort( BOOL bNewState );
                    // Get/set Geometry-based Depth-Sorting calcs ON/OFF.

    BOOL            dispUsingHSE();
    virtual void    dispUsingHSE( BOOL bNewState );
                    // Get/set Hidden-Surface-Elimination calcs ON/OFF.

    BOOL            dispVisibleIs();
    virtual void    dispVisible( BOOL bNewState );
                    // Get/set "ignore draw-op" modes ON/OFF.

    BOOL            dispWireFrame();
    virtual void    dispWireFrame( BOOL bNewState );
                    // Get/set "wire-frame" mode ON/OFF.


    virtual void    draw( bf_Display *p_bf_dspUseThisDisplay );
    virtual void    draw2D( bf_Display *p_bf_dspUseThisDisplay );
    virtual void    draw3D( bf_Display *p_bf_dspUseThisDisplay );
                    // Render this virtual object into a display.


    virtual double  dataXMin() const;
    virtual double  dataXMax() const;
    virtual double  dataYMin() const;
    virtual double  dataYMax() const;
    virtual double  dataZMin() const;
    virtual double  dataZMax() const;
                    // Get data references for various ops.
                    // (e.g. Tick Mark Range ops.)

    virtual double  virtXMin() const;
    virtual double  virtXMax() const;
    virtual double  virtYMin() const;
    virtual double  virtYMax() const;
    virtual double  virtZMin() const;
    virtual double  virtZMax() const;
                    // Get data references for various ops.
                    // (e.g. Virtual Scaling/Translation ops.)

    virtual double  xformXMin() const;
    virtual double  xformXMax() const;
    virtual double  xformYMin() const;
    virtual double  xformYMax() const;
    virtual double  xformZMin() const;
    virtual double  xformZMax() const;
                    // Get data references for various ops .
                    // (e.g. Geometry/Depth-Sorting ops.)


protected:  // member vars accessible to DERIVED objects ONLY !

    cf_DispAttribs  *p_cf_datbForDrawOps_;
    BOOL            bWereDispAttribsSet_;
    BOOL    		bWereDispAttribsNewed_;
            		// A POINTER to an Encapuslated set of Display Attributes.
            		// Unless paremeterized by the c-tor, this will be NULL
                    // until set with a call to the set-member dispAttibs(...)

    cf_TextAttribs  *p_cf_tatbForTextOps_;
    BOOL            bWereTextAttribsSet_;
    BOOL    		bWereTextAttribsNewed_;
            		// A POINTER to an Encapuslated set of Text Attributes.
            		// Unless paremeterized by the c-tor, this will be NULL
                    // until set with a call to the set-member textAttibs(...)

    BOOL    bIgnorePushBrush_;
    BOOL    bIgnorePushFont_;
    BOOL    bIgnorePushPen_;
            // Sometimes we want to IGNORE pushing a set of
            // display attributes during draw ops.  An example
            // of this would be a series of points -- instead
            // of pushing/popping a set of display attribs
            // for EACH point, it's faster and cheaper to
            // push ONE set, and use this ONE set for ALL the
            // points.  The c-tor inits these to FALSE, so
            // we DO pay attention to Pen and Brush attribs
            // unless told otherwise...

    BOOL    bDispUsingFacetSort_;
    BOOL    bDispUsingZDepthSort_;
    BOOL    bDispUsingHSE_;
            // Using HSE (Hidden Surface Elimination) calcs
            // and DSORT (Depth Sorting) calcs during rendering
            // and/or geometric and/or projection calcs is
            // *expensive*, and most objects -- at least most 2D
            // objects -- do NOT need these vars to be set = TRUE.
            // Therefore, the default c-tor init state is FALSE.

    BOOL    bDispWireFrame_;
            // If TRUE, we skip certain "expensive" draw ops
            // (like disp attrib push/pops) and "expensive" geom
            // xform ops (like DSORT/HSE ops). C-tor inits to FALSE.

    BOOL    bAppliedKernelDispMetrics_;
            // To allow queries at this->applyProjXform( ... )-time
            // to see if we need to synchronize this object with the
            // kernel's display metrics.  C-tor inits FALSE.

    BOOL    bDispVisible_;
            // Some geometry-objects (e.g. the centroid of a chart-engine)
            // do NOT normally need to be rendered.  BUT, because almost
            // EVERY 3D-object "wants to" be rendered c-tor inits = TRUE !!!

private:


};  // End of cf_Virt3DObj declaration.

#endif      // Terminates include re-definition protection

//////////////////////////////////////
// END of File: CO1_VOBJ.HPP
//////////////////////////////////////


⌨️ 快捷键说明

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