static bool makeOtherOutlines( IDF3_BOARD& brd, SGNODE* aParent )
{
    if( NULL == aParent )
        return false;

    VRML_LAYER vpcb;
    int ncomponents = 0;

    double brdTop = brd.GetBoardThickness();
    double top, bot;

    // Add the component outlines
    const std::map< std::string, OTHER_OUTLINE* >*const comp = brd.GetOtherOutlines();
    std::map< std::string, OTHER_OUTLINE* >::const_iterator sc = comp->begin();
    std::map< std::string, OTHER_OUTLINE* >::const_iterator ec = comp->end();

    int nvcont;

    OTHER_OUTLINE* pout;

    while( sc != ec )
    {
        pout = sc->second;

        if( std::abs( pout->GetThickness() ) < 0.001 )
        {
            ++sc;
            continue;
        }

        if( !getOutlineModel( vpcb, pout->GetOutlines() ) )
        {
            vpcb.Clear();
            ++sc;
            continue;
        }

        vpcb.EnsureWinding( 0, false );

        nvcont = vpcb.GetNContours() - 1;

        while( nvcont > 0 )
            vpcb.EnsureWinding( nvcont--, true );

        if( pout->GetSide() == IDF3::LYR_BOTTOM )
        {
            top = 0.0;
            bot = -pout->GetThickness();
        }
        else
        {
            bot = brdTop;
            top = bot + pout->GetThickness();
        }

        if( NULL == vrmlToSG( vpcb, -1, aParent, top, bot ) )
        {
            vpcb.Clear();
            ++sc;
            continue;
        }

        ++ncomponents;

        vpcb.Clear();
        ++sc;
    }

    if( 0 == ncomponents )
        return false;

    return true;
}
static SCENEGRAPH* makeBoard( IDF3_BOARD& brd, SGNODE* aParent )
{
    if( NULL == aParent )
        return NULL;

    VRML_LAYER vpcb;

    // check if no board outline
    if( brd.GetBoardOutlinesSize() < 1 )
        return NULL;


    if( !getOutlineModel( vpcb, brd.GetBoardOutline()->GetOutlines() ) )
        return NULL;

    vpcb.EnsureWinding( 0, false );

    int nvcont = vpcb.GetNContours() - 1;

    while( nvcont > 0 )
        vpcb.EnsureWinding( nvcont--, true );

    // Add the drill holes
    const std::list<IDF_DRILL_DATA*>* drills = &brd.GetBoardDrills();

    std::list<IDF_DRILL_DATA*>::const_iterator sd = drills->begin();
    std::list<IDF_DRILL_DATA*>::const_iterator ed = drills->end();

    while( sd != ed )
    {
        vpcb.AddCircle( (*sd)->GetDrillXPos(), (*sd)->GetDrillYPos(),
            (*sd)->GetDrillDia() / 2.0, true );
        ++sd;
    }

    std::map< std::string, IDF3_COMPONENT* >*const comp = brd.GetComponents();
    std::map< std::string, IDF3_COMPONENT* >::const_iterator sc = comp->begin();
    std::map< std::string, IDF3_COMPONENT* >::const_iterator ec = comp->end();

    while( sc != ec )
    {
        drills = sc->second->GetDrills();
        sd = drills->begin();
        ed = drills->end();

        while( sd != ed )
        {
            vpcb.AddCircle( (*sd)->GetDrillXPos(), (*sd)->GetDrillYPos(),
                (*sd)->GetDrillDia() / 2.0, true );
            ++sd;
        }

        ++sc;
    }

    double top = brd.GetBoardThickness();

    SCENEGRAPH* data = vrmlToSG( vpcb, 0, aParent, top, 0.0 );

    return data;
}