static void export_vrml_circle( MODEL_VRML& aModel, LAYER_NUM layer, double startx, double starty, double endx, double endy, double width ) { VRML_LAYER* vlayer; if( !GetLayer( aModel, layer, &vlayer ) ) return; if( width < aModel.minLineWidth ) width = aModel.minLineWidth; starty = -starty; endy = -endy; double hole, radius; radius = Distance( startx, starty, endx, endy ) + ( width / 2); hole = radius - width; if( !vlayer->AddCircle( startx, starty, radius, false ) ) throw( std::runtime_error( vlayer->GetError() ) ); if( hole > 0.0001 ) { if( !vlayer->AddCircle( startx, starty, hole, true ) ) throw( std::runtime_error( vlayer->GetError() ) ); } }
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; }