当前位置: 首页>>代码示例>>C++>>正文


C++ SWIFT_Array::Destroy方法代码示例

本文整理汇总了C++中SWIFT_Array::Destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ SWIFT_Array::Destroy方法的具体用法?C++ SWIFT_Array::Destroy怎么用?C++ SWIFT_Array::Destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SWIFT_Array的用法示例。


在下文中一共展示了SWIFT_Array::Destroy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Upper_Leaves_CB

int Upper_Leaves_CB( Togl *togl, int argc, const char *argv[] )
{
    int i;

    if( uleaves ) {
        // Include all leaves above the current level
        for( i = 0; i < num_leaves; i++ ) {
            if( leaves[i]->Level() < level ) {
                which_pieces.Add_Grow( leaves[i], 10 );
            }
        }
    } else {
        // Remove all leaves above the current level
        SWIFT_Array<SWIFT_BV*> new_which_pieces;

        new_which_pieces.Create( which_pieces.Length() );
        new_which_pieces.Set_Length( 0 );
        for( i = 0; i < which_pieces.Length(); i++ ) {
            if( !which_pieces[i]->Is_Leaf() ||
                which_pieces[i]->Level() == level
            ) {
                // Keep this piece
                new_which_pieces.Add( which_pieces[i] );
            }
        }

        which_pieces.Destroy();
        which_pieces = new_which_pieces;
        new_which_pieces.Nullify();
    }

    Togl_PostRedisplay( t );
    return TCL_OK;
}
开发者ID:ipa-nhg,项目名称:kukadu,代码行数:34,代码来源:gui.cpp

示例2: Key_K_CB

int Key_K_CB( Togl *togl, int argc, const char *argv[] )
{
    if( dh == DRAW_HIERARCHY ) {
        if( which_pieces.Length() != 1 ) {
            // Go up the hierarchy
            int i;
            SWIFT_Array<SWIFT_BV*> new_which_pieces( which_pieces.Length() );
            SWIFT_BV* parent;

            new_which_pieces.Set_Length( 0 );
            parent = NULL;
            for( i = 0; i < which_pieces.Length(); i++ ) {
                if( uleaves && which_pieces[i]->Is_Leaf() &&
                    which_pieces[i]->Level() < level
                ) {
                    new_which_pieces.Add( which_pieces[i] );
                } else if( parent != which_pieces[i]->Parent() ) {
                    parent = which_pieces[i]->Parent();
                    new_which_pieces.Add( parent );
                }
            }

            level--;

            // Include the new leaves at this level if uleaves is false
            if( !uleaves ) {
                for( i = 0; i < num_leaves; i++ ) {
                    if( leaves[i]->Level() == level ) {
                        new_which_pieces.Add_Grow( leaves[i], 10 );
                    }
                }
            }

            which_pieces.Destroy();
            which_pieces = new_which_pieces;
            new_which_pieces.Nullify();
        }
    } else {
            // Show next convex piece and set text field
            char temp[80];

            if( which_cps.Length() == 0 ) {
                which_cps.Set_Length( 1 );
                which_cps[0] = 0;
            } else {
                which_cps[0] = (which_cps[0] == which_cps.Max_Length()-1 ?
                                                0 : which_cps[0]+1);
                which_cps.Set_Length( 1 );
            }
            sprintf( temp, "set which_cps %d", which_cps[0] );
            Tcl_Eval( Togl_Interp( togl ), temp );
    }

    Togl_PostRedisplay( togl );
    return TCL_OK;
}
开发者ID:ipa-nhg,项目名称:kukadu,代码行数:56,代码来源:gui.cpp

示例3: Key_J_CB

int Key_J_CB( Togl *togl, int argc, const char *argv[] )
{
    if( dh == DRAW_HIERARCHY ) {
        int i, j;
        bool advanced = false;
        SWIFT_Array<SWIFT_BV*> new_which_pieces( 100 );

        new_which_pieces.Set_Length( 0 );
        for( i = 0; i < which_pieces.Length(); i++ ) {
            if( uleaves && which_pieces[i]->Is_Leaf() ) {
                // Keep this leaf
                new_which_pieces.Add_Grow( which_pieces[i], 10 );
            } else {
                for( j = 0; j < which_pieces[i]->Num_Children(); j++ ) {
                    new_which_pieces.Add_Grow(
                                        which_pieces[i]->Children()[j], 10 );
                    advanced = true;
                }
            }
        }

        if( advanced ) {
            level++;
            which_pieces.Destroy();
            which_pieces = new_which_pieces;
            new_which_pieces.Nullify();
        }
    } else {
            // Show previous convex piece and set text field
            char temp[80];

            if( which_cps.Length() == 0 ) {
                which_cps.Set_Length( 1 );
                which_cps[0] = 0;
            } else {
                which_cps[0] = (which_cps[0] == 0 ?
                                   which_cps.Max_Length()-1 : which_cps[0]-1);
                which_cps.Set_Length( 1 );
            }
            sprintf( temp, "set which_cps %d", which_cps[0] );
            Tcl_Eval( Togl_Interp( togl ), temp );
    }

    Togl_PostRedisplay( togl );
    return TCL_OK;
}
开发者ID:ipa-nhg,项目名称:kukadu,代码行数:46,代码来源:gui.cpp

示例4: Compute_Leaves

void Compute_Leaves( SWIFT_BV* piece )
{
    int i;

    if( piece == mesh->Root() ) {
        leaves.Destroy();
        leaves.Create( num_leaves );
        leaves.Set_Length( 0 );
    }

    if( piece->Is_Leaf() ) {
        leaves.Add( piece );
    } else {
        for( i = 0; i < piece->Num_Children(); i++ ) {
            Compute_Leaves( piece->Children()[i] );
        }
    }
}
开发者ID:ipa-nhg,项目名称:kukadu,代码行数:18,代码来源:gui.cpp


注:本文中的SWIFT_Array::Destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。