More module -> footprint.

This commit is contained in:
Jeff Young 2020-11-13 01:12:36 +00:00
parent fc9cf1d827
commit 8c947b69b0
11 changed files with 300 additions and 278 deletions

View File

@ -545,13 +545,13 @@ class BOARD_ADAPTER
COBJECT2D *createNewPadDrill( const PAD* aPad, int aInflateValue ); COBJECT2D *createNewPadDrill( const PAD* aPad, int aInflateValue );
void AddPadsWithClearanceToContainer( const MODULE *aModule, void AddPadsWithClearanceToContainer( const MODULE *aFootprint,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, int aInflateValue, PCB_LAYER_ID aLayerId, int aInflateValue,
bool aSkipNPTHPadsWihNoCopper, bool aSkipPlatedPads, bool aSkipNPTHPadsWihNoCopper, bool aSkipPlatedPads,
bool aSkipNonPlatedPads ); bool aSkipNonPlatedPads );
void AddFPShapesWithClearanceToContainer( const MODULE *aModule, void AddFPShapesWithClearanceToContainer( const MODULE *aFootprint,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, int aInflateValue ); PCB_LAYER_ID aLayerId, int aInflateValue );

View File

@ -185,7 +185,7 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const DIMENSION_BASE* aDim
// Based on // Based on
// void FOOTPRINT::TransformFPShapesWithClearanceToPolygonSet // void FOOTPRINT::TransformFPShapesWithClearanceToPolygonSet
// board_items_to_polygon_shape_transform.cpp#L204 // board_items_to_polygon_shape_transform.cpp#L204
void BOARD_ADAPTER::AddFPShapesWithClearanceToContainer( const MODULE* aModule, void BOARD_ADAPTER::AddFPShapesWithClearanceToContainer( const MODULE* aFootprint,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aInflateValue ) int aInflateValue )
@ -193,7 +193,7 @@ void BOARD_ADAPTER::AddFPShapesWithClearanceToContainer( const MODULE* aModule,
std::vector<FP_TEXT*> texts; // List of FP_TEXT to convert std::vector<FP_TEXT*> texts; // List of FP_TEXT to convert
FP_SHAPE* outline; FP_SHAPE* outline;
for( BOARD_ITEM* item : aModule->GraphicalItems() ) for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
{ {
switch( item->Type() ) switch( item->Type() )
{ {
@ -225,13 +225,13 @@ void BOARD_ADAPTER::AddFPShapesWithClearanceToContainer( const MODULE* aModule,
} }
// Convert texts sur footprints // Convert texts sur footprints
if( aModule->Reference().GetLayer() == aLayerId && aModule->Reference().IsVisible() ) if( aFootprint->Reference().GetLayer() == aLayerId && aFootprint->Reference().IsVisible() )
texts.push_back( &aModule->Reference() ); texts.push_back( &aFootprint->Reference() );
if( aModule->Value().GetLayer() == aLayerId && aModule->Value().IsVisible() ) if( aFootprint->Value().GetLayer() == aLayerId && aFootprint->Value().IsVisible() )
texts.push_back( &aModule->Value() ); texts.push_back( &aFootprint->Value() );
s_boardItem = (const BOARD_ITEM *)&aModule->Value(); s_boardItem = (const BOARD_ITEM *)&aFootprint->Value();
s_dstcontainer = aDstContainer; s_dstcontainer = aDstContainer;
s_biuTo3Dunits = m_biuTo3Dunits; s_biuTo3Dunits = m_biuTo3Dunits;
@ -473,7 +473,7 @@ COBJECT2D *BOARD_ADAPTER::createNewPadDrill( const PAD* aPad, int aInflateValue
} }
void BOARD_ADAPTER::AddPadsWithClearanceToContainer( const MODULE* aModule, void BOARD_ADAPTER::AddPadsWithClearanceToContainer( const MODULE* aFootprint,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aInflateValue, int aInflateValue,
@ -481,7 +481,7 @@ void BOARD_ADAPTER::AddPadsWithClearanceToContainer( const MODULE* aModule,
bool aSkipPlatedPads, bool aSkipPlatedPads,
bool aSkipNonPlatedPads ) bool aSkipNonPlatedPads )
{ {
for( PAD* pad : aModule->Pads() ) for( PAD* pad : aFootprint->Pads() )
{ {
if( !pad->IsOnLayer( aLayerId ) ) if( !pad->IsOnLayer( aLayerId ) )
continue; continue;

View File

@ -92,13 +92,14 @@ AR_AUTOPLACER::AR_AUTOPLACER( BOARD* aBoard )
} }
void AR_AUTOPLACER::placeModule( MODULE* aModule, bool aDoNotRecreateRatsnest, const wxPoint& aPos ) void AR_AUTOPLACER::placeFootprint( MODULE* aFootprint, bool aDoNotRecreateRatsnest,
const wxPoint& aPos )
{ {
if( !aModule ) if( !aFootprint )
return; return;
aModule->SetPosition( aPos ); aFootprint->SetPosition( aPos );
m_connectivity->Update( aModule ); m_connectivity->Update( aFootprint );
} }
@ -270,18 +271,18 @@ bool AR_AUTOPLACER::fillMatrix()
} }
void AR_AUTOPLACER::rotateModule( MODULE* module, double angle, bool incremental ) void AR_AUTOPLACER::rotateFootprint( MODULE* aFootprint, double angle, bool incremental )
{ {
if( module == NULL ) if( aFootprint == NULL )
return; return;
if( incremental ) if( incremental )
module->SetOrientation( module->GetOrientation() + angle ); aFootprint->SetOrientation( aFootprint->GetOrientation() + angle );
else else
module->SetOrientation( angle ); aFootprint->SetOrientation( angle );
m_board->GetConnectivity()->Update( module ); m_board->GetConnectivity()->Update( aFootprint );
} }
@ -545,22 +546,23 @@ unsigned int AR_AUTOPLACER::calculateKeepOutArea( const EDA_RECT& aRect, int sid
* Returns the value TstRectangle(). * Returns the value TstRectangle().
* Module is known by its bounding box * Module is known by its bounding box
*/ */
int AR_AUTOPLACER::testModuleOnBoard( MODULE* aModule, bool TstOtherSide, const wxPoint& aOffset ) int AR_AUTOPLACER::testModuleOnBoard( MODULE* aFootprint, bool TstOtherSide,
const wxPoint& aOffset )
{ {
int side = AR_SIDE_TOP; int side = AR_SIDE_TOP;
int otherside = AR_SIDE_BOTTOM; int otherside = AR_SIDE_BOTTOM;
if( aModule->GetLayer() == B_Cu ) if( aFootprint->GetLayer() == B_Cu )
{ {
side = AR_SIDE_BOTTOM; otherside = AR_SIDE_TOP; side = AR_SIDE_BOTTOM; otherside = AR_SIDE_TOP;
} }
EDA_RECT fpBBox = aModule->GetFootprintRect(); EDA_RECT fpBBox = aFootprint->GetFootprintRect();
fpBBox.Move( -aOffset ); fpBBox.Move( -aOffset );
buildFpAreas( aModule, 0 ); buildFpAreas( aFootprint, 0 );
int diag = //testModuleByPolygon( aModule, side, aOffset ); int diag = //testModuleByPolygon( aFootprint, side, aOffset );
testRectangle( fpBBox, side ); testRectangle( fpBBox, side );
if( diag != AR_FREE_CELL ) if( diag != AR_FREE_CELL )
@ -568,33 +570,33 @@ int AR_AUTOPLACER::testModuleOnBoard( MODULE* aModule, bool TstOtherSide, const
if( TstOtherSide ) if( TstOtherSide )
{ {
diag = //testModuleByPolygon( aModule, otherside, aOffset ); diag = //testModuleByPolygon( aFootprint, otherside, aOffset );
testRectangle( fpBBox, otherside ); testRectangle( fpBBox, otherside );
if( diag != AR_FREE_CELL ) if( diag != AR_FREE_CELL )
return diag; return diag;
} }
int marge = ( m_matrix.m_GridRouting * aModule->GetPadCount() ) / AR_GAIN; int marge = ( m_matrix.m_GridRouting * aFootprint->GetPadCount() ) / AR_GAIN;
fpBBox.Inflate( marge ); fpBBox.Inflate( marge );
return calculateKeepOutArea( fpBBox, side ); return calculateKeepOutArea( fpBBox, side );
} }
int AR_AUTOPLACER::getOptimalModulePlacement(MODULE* aModule) int AR_AUTOPLACER::getOptimalFPPlacement( MODULE* aFootprint )
{ {
int error = 1; int error = 1;
wxPoint LastPosOK; wxPoint LastPosOK;
double min_cost, curr_cost, Score; double min_cost, curr_cost, Score;
bool TstOtherSide; bool TstOtherSide;
aModule->CalculateBoundingBox(); aFootprint->CalculateBoundingBox();
LastPosOK = m_matrix.m_BrdBox.GetOrigin(); LastPosOK = m_matrix.m_BrdBox.GetOrigin();
wxPoint mod_pos = aModule->GetPosition(); wxPoint mod_pos = aFootprint->GetPosition();
EDA_RECT fpBBox = aModule->GetFootprintRect(); EDA_RECT fpBBox = aFootprint->GetFootprintRect();
// Move fpBBox to have the footprint position at (0,0) // Move fpBBox to have the footprint position at (0,0)
fpBBox.Move( -mod_pos ); fpBBox.Move( -mod_pos );
@ -620,9 +622,9 @@ int AR_AUTOPLACER::getOptimalModulePlacement(MODULE* aModule)
if( m_matrix.m_RoutingLayersCount > 1 ) if( m_matrix.m_RoutingLayersCount > 1 )
{ {
LSET other( aModule->GetLayer() == B_Cu ? F_Cu : B_Cu ); LSET other( aFootprint->GetLayer() == B_Cu ? F_Cu : B_Cu );
for( auto pad : aModule->Pads() ) for( PAD* pad : aFootprint->Pads() )
{ {
if( !( pad->GetLayerSet() & other ).any() ) if( !( pad->GetLayerSet() & other ).any() )
continue; continue;
@ -647,13 +649,13 @@ int AR_AUTOPLACER::getOptimalModulePlacement(MODULE* aModule)
fpBBox.SetOrigin( fpBBoxOrg + m_curPosition ); fpBBox.SetOrigin( fpBBoxOrg + m_curPosition );
moduleOffset = mod_pos - m_curPosition; moduleOffset = mod_pos - m_curPosition;
int keepOutCost = testModuleOnBoard( aModule, TstOtherSide, moduleOffset ); int keepOutCost = testModuleOnBoard( aFootprint, TstOtherSide, moduleOffset );
if( keepOutCost >= 0 ) // i.e. if the module can be put here if( keepOutCost >= 0 ) // i.e. if the module can be put here
{ {
error = 0; error = 0;
// m_frame->build_ratsnest_module( aModule ); // fixme // m_frame->build_ratsnest_module( aFootprint ); // fixme
curr_cost = computePlacementRatsnestCost( aModule, moduleOffset ); curr_cost = computePlacementRatsnestCost( aFootprint, moduleOffset );
Score = curr_cost + keepOutCost; Score = curr_cost + keepOutCost;
if( (min_cost >= Score ) || (min_cost < 0 ) ) if( (min_cost >= Score ) || (min_cost < 0 ) )
@ -679,14 +681,14 @@ int AR_AUTOPLACER::getOptimalModulePlacement(MODULE* aModule)
} }
const PAD* AR_AUTOPLACER::nearestPad( MODULE *aRefModule, PAD* aRefPad, const wxPoint& aOffset) const PAD* AR_AUTOPLACER::nearestPad( MODULE *aRefFP, PAD* aRefPad, const wxPoint& aOffset)
{ {
const PAD* nearest = nullptr; const PAD* nearest = nullptr;
int64_t nearestDist = INT64_MAX; int64_t nearestDist = INT64_MAX;
for ( MODULE* footprint : m_board->Footprints() ) for ( MODULE* footprint : m_board->Footprints() )
{ {
if ( footprint == aRefModule ) if ( footprint == aRefFP )
continue; continue;
if( !m_matrix.m_BrdBox.Contains( footprint->GetPosition() ) ) if( !m_matrix.m_BrdBox.Contains( footprint->GetPosition() ) )
@ -711,7 +713,7 @@ const PAD* AR_AUTOPLACER::nearestPad( MODULE *aRefModule, PAD* aRefPad, const wx
} }
double AR_AUTOPLACER::computePlacementRatsnestCost( MODULE *aModule, const wxPoint& aOffset ) double AR_AUTOPLACER::computePlacementRatsnestCost( MODULE *aFootprint, const wxPoint& aOffset )
{ {
double curr_cost; double curr_cost;
VECTOR2I start; // start point of a ratsnest VECTOR2I start; // start point of a ratsnest
@ -720,9 +722,9 @@ double AR_AUTOPLACER::computePlacementRatsnestCost( MODULE *aModule, const wxPoi
curr_cost = 0; curr_cost = 0;
for ( auto pad : aModule->Pads() ) for ( PAD* pad : aFootprint->Pads() )
{ {
auto nearest = nearestPad( aModule, pad, aOffset ); const PAD* nearest = nearestPad( aFootprint, pad, aOffset );
if( !nearest ) if( !nearest )
continue; continue;
@ -780,61 +782,60 @@ static bool sortFootprintsByRatsnestSize( MODULE* ref, MODULE* compare )
} }
MODULE* AR_AUTOPLACER::pickModule( ) MODULE* AR_AUTOPLACER::pickFootprint( )
{ {
MODULE* module; std::vector<MODULE*> fpList;
std::vector <MODULE*> moduleList;
for( MODULE* footprint : m_board->Footprints() ) for( MODULE* footprint : m_board->Footprints() )
{ {
footprint->CalculateBoundingBox(); footprint->CalculateBoundingBox();
moduleList.push_back( footprint ); fpList.push_back( footprint );
} }
sort( moduleList.begin(), moduleList.end(), sortFootprintsByComplexity ); sort( fpList.begin(), fpList.end(), sortFootprintsByComplexity );
for( unsigned kk = 0; kk < moduleList.size(); kk++ ) for( unsigned kk = 0; kk < fpList.size(); kk++ )
{ {
module = moduleList[kk]; MODULE* footprint = fpList[kk];
module->SetFlag( 0 ); footprint->SetFlag( 0 );
if( !module->NeedsPlaced() ) if( !footprint->NeedsPlaced() )
continue; continue;
m_connectivity->Update( module ); m_connectivity->Update( footprint );
} }
m_connectivity->RecalculateRatsnest(); m_connectivity->RecalculateRatsnest();
for( unsigned kk = 0; kk < moduleList.size(); kk++ ) for( unsigned kk = 0; kk < fpList.size(); kk++ )
{ {
module = moduleList[kk]; MODULE* footprint = fpList[kk];
auto edges = m_connectivity->GetRatsnestForComponent( module, true ); auto edges = m_connectivity->GetRatsnestForComponent( footprint, true );
module->SetFlag( edges.size() ) ; footprint->SetFlag( edges.size() ) ;
} }
sort( moduleList.begin(), moduleList.end(), sortFootprintsByRatsnestSize ); sort( fpList.begin(), fpList.end(), sortFootprintsByRatsnestSize );
// Search for "best" module. // Search for "best" module.
MODULE* bestModule = nullptr; MODULE* bestModule = nullptr;
MODULE* altModule = nullptr; MODULE* altModule = nullptr;
for( unsigned ii = 0; ii < moduleList.size(); ii++ ) for( unsigned ii = 0; ii < fpList.size(); ii++ )
{ {
module = moduleList[ii]; MODULE* footprint = fpList[ii];
if( !module->NeedsPlaced() ) if( !footprint->NeedsPlaced() )
continue; continue;
altModule = module; altModule = footprint;
if( module->GetFlag() == 0 ) if( footprint->GetFlag() == 0 )
continue; continue;
bestModule = module; bestModule = footprint;
break; break;
} }
@ -876,12 +877,12 @@ void AR_AUTOPLACER::drawPlacementRoutingMatrix( )
} }
AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*>& aModules, BOARD_COMMIT* aCommit, AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector<MODULE*>& aFootprints,
BOARD_COMMIT* aCommit,
bool aPlaceOffboardModules ) bool aPlaceOffboardModules )
{ {
wxPoint memopos; wxPoint memopos;
int error; int error;
MODULE* module = nullptr;
bool cancelled = false; bool cancelled = false;
memopos = m_curPosition; memopos = m_curPosition;
@ -912,7 +913,7 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*>& aModules, BOARD
} }
} }
for( MODULE* footprint : aModules ) for( MODULE* footprint : aFootprints )
{ {
footprint->SetNeedsPlaced( true ); footprint->SetNeedsPlaced( true );
aCommit->Modify( footprint ); aCommit->Modify( footprint );
@ -947,19 +948,20 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*>& aModules, BOARD
if( m_refreshCallback ) if( m_refreshCallback )
m_refreshCallback( nullptr ); m_refreshCallback( nullptr );
MODULE* footprint;
while( ( module = pickModule( ) ) != nullptr ) while( ( footprint = pickFootprint() ) != nullptr )
{ {
// Display some info about activity, module placement can take a while: // Display some info about activity, footprint placement can take a while:
//m_frame->SetStatusText( msg ); //m_frame->SetStatusText( msg );
if( m_progressReporter ) if( m_progressReporter )
m_progressReporter->SetTitle( wxString::Format( m_progressReporter->SetTitle( wxString::Format(
_( "Autoplacing %s" ), module->GetReference() ) ); _( "Autoplacing %s" ), footprint->GetReference() ) );
double initialOrient = module->GetOrientation(); double initialOrient = footprint->GetOrientation();
error = getOptimalModulePlacement( module ); error = getOptimalFPPlacement( footprint );
double bestScore = m_minCost; double bestScore = m_minCost;
double bestRotation = 0.0; double bestRotation = 0.0;
int rotAllowed; int rotAllowed;
@ -968,12 +970,12 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*>& aModules, BOARD
goto end_of_tst; goto end_of_tst;
// Try orientations 90, 180, 270 degrees from initial orientation // Try orientations 90, 180, 270 degrees from initial orientation
rotAllowed = module->GetPlacementCost180(); rotAllowed = footprint->GetPlacementCost180();
if( rotAllowed != 0 ) if( rotAllowed != 0 )
{ {
rotateModule( module, 1800.0, true ); rotateFootprint( footprint, 1800.0, true );
error = getOptimalModulePlacement( module ); error = getOptimalFPPlacement( footprint );
m_minCost *= OrientationPenalty[rotAllowed]; m_minCost *= OrientationPenalty[rotAllowed];
if( bestScore > m_minCost ) // This orientation is better. if( bestScore > m_minCost ) // This orientation is better.
@ -983,7 +985,7 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*>& aModules, BOARD
} }
else else
{ {
rotateModule( module, initialOrient, false ); rotateFootprint( footprint, initialOrient, false );
} }
if( error == AR_ABORT_PLACEMENT ) if( error == AR_ABORT_PLACEMENT )
@ -991,12 +993,12 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*>& aModules, BOARD
} }
// Determine if the best orientation of a module is 90. // Determine if the best orientation of a module is 90.
rotAllowed = module->GetPlacementCost90(); rotAllowed = footprint->GetPlacementCost90();
if( rotAllowed != 0 ) if( rotAllowed != 0 )
{ {
rotateModule( module, 900.0, true ); rotateFootprint( footprint, 900.0, true );
error = getOptimalModulePlacement( module ); error = getOptimalFPPlacement( footprint );
m_minCost *= OrientationPenalty[rotAllowed]; m_minCost *= OrientationPenalty[rotAllowed];
if( bestScore > m_minCost ) // This orientation is better. if( bestScore > m_minCost ) // This orientation is better.
@ -1006,7 +1008,7 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*>& aModules, BOARD
} }
else else
{ {
rotateModule( module, initialOrient, false ); rotateFootprint( footprint, initialOrient, false );
} }
if( error == AR_ABORT_PLACEMENT ) if( error == AR_ABORT_PLACEMENT )
@ -1016,8 +1018,8 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*>& aModules, BOARD
// Determine if the best orientation of a module is -90. // Determine if the best orientation of a module is -90.
if( rotAllowed != 0 ) if( rotAllowed != 0 )
{ {
rotateModule( module, 2700.0, true ); rotateFootprint( footprint, 2700.0, true );
error = getOptimalModulePlacement( module ); error = getOptimalFPPlacement( footprint );
m_minCost *= OrientationPenalty[rotAllowed]; m_minCost *= OrientationPenalty[rotAllowed];
if( bestScore > m_minCost ) // This orientation is better. if( bestScore > m_minCost ) // This orientation is better.
@ -1027,7 +1029,7 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*>& aModules, BOARD
} }
else else
{ {
rotateModule( module, initialOrient, false ); rotateFootprint( footprint, initialOrient, false );
} }
if( error == AR_ABORT_PLACEMENT ) if( error == AR_ABORT_PLACEMENT )
@ -1042,22 +1044,22 @@ end_of_tst:
bestRotation += initialOrient; bestRotation += initialOrient;
if( bestRotation != module->GetOrientation() ) if( bestRotation != footprint->GetOrientation() )
{ {
rotateModule( module, bestRotation, false ); rotateFootprint( footprint, bestRotation, false );
} }
// Place module. // Place module.
placeModule( module, true, m_curPosition ); placeFootprint( footprint, true, m_curPosition );
module->CalculateBoundingBox(); footprint->CalculateBoundingBox();
genModuleOnRoutingMatrix( module ); genModuleOnRoutingMatrix( footprint );
module->SetIsPlaced( true ); footprint->SetIsPlaced( true );
module->SetNeedsPlaced( false ); footprint->SetNeedsPlaced( false );
drawPlacementRoutingMatrix(); drawPlacementRoutingMatrix();
if( m_refreshCallback ) if( m_refreshCallback )
m_refreshCallback( module ); m_refreshCallback( footprint );
if( m_progressReporter ) if( m_progressReporter )

View File

@ -59,7 +59,7 @@ class AR_AUTOPLACER
public: public:
AR_AUTOPLACER( BOARD* aBoard ); AR_AUTOPLACER( BOARD* aBoard );
AR_RESULT AutoplaceModules( std::vector<MODULE*>& aModules, BOARD_COMMIT* aCommit, AR_RESULT AutoplaceFootprints( std::vector<MODULE*>& aFootprints, BOARD_COMMIT* aCommit,
bool aPlaceOffboardModules = false ); bool aPlaceOffboardModules = false );
/** /**
@ -86,7 +86,7 @@ public:
private: private:
void drawPlacementRoutingMatrix(); // draw the working area (shows free and occupied areas) void drawPlacementRoutingMatrix(); // draw the working area (shows free and occupied areas)
void rotateModule( MODULE* module, double angle, bool incremental ); void rotateFootprint( MODULE* aFootprint, double angle, bool incremental );
int genPlacementRoutingMatrix(); int genPlacementRoutingMatrix();
/** fills m_matrix cells from m_boardShape. /** fills m_matrix cells from m_boardShape.
@ -97,19 +97,21 @@ private:
int testRectangle( const EDA_RECT& aRect, int side ); int testRectangle( const EDA_RECT& aRect, int side );
unsigned int calculateKeepOutArea( const EDA_RECT& aRect, int side ); unsigned int calculateKeepOutArea( const EDA_RECT& aRect, int side );
int testModuleOnBoard( MODULE* aModule, bool TstOtherSide, const wxPoint& aOffset ); int testModuleOnBoard( MODULE* aFootprint, bool TstOtherSide, const wxPoint& aOffset );
int getOptimalModulePlacement( MODULE* aModule ); int getOptimalFPPlacement( MODULE* aFootprint );
double computePlacementRatsnestCost( MODULE* aModule, const wxPoint& aOffset ); double computePlacementRatsnestCost( MODULE* aFootprint, const wxPoint& aOffset );
/** /**
* Find the "best" module place. The criteria are: * Find the "best" module place. The criteria are:
* - Maximum ratsnest with footprints already placed * - Maximum ratsnest with footprints already placed
* - Max size, and number of pads max * - Max size, and number of pads max
*/ */
MODULE* pickModule(); MODULE* pickFootprint();
void placeModule( MODULE* aModule, bool aDoNotRecreateRatsnest, const wxPoint& aPos ); void placeFootprint( MODULE* aFootprint, bool aDoNotRecreateRatsnest,
const PAD* nearestPad( MODULE* aRefModule, PAD* aRefPad, const wxPoint& aOffset ); const wxPoint& aPos );
const PAD* nearestPad( MODULE* aRefFP, PAD* aRefPad, const wxPoint& aOffset );
// Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack // Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack
void addFpBody( wxPoint aStart, wxPoint aEnd, LSET aLayerMask ); void addFpBody( wxPoint aStart, wxPoint aEnd, LSET aLayerMask );

View File

@ -46,10 +46,10 @@ AUTOPLACE_TOOL::~AUTOPLACE_TOOL()
// especially each time a footprint is autoplaced, // especially each time a footprint is autoplaced,
static PCB_BASE_EDIT_FRAME* fparent; static PCB_BASE_EDIT_FRAME* fparent;
static int refreshCallback( MODULE* aModule ) static int refreshCallback( MODULE* aFootprint )
{ {
if( aModule ) if( aFootprint )
fparent->GetCanvas()->GetView()->Update( aModule ); fparent->GetCanvas()->GetView()->Update( aFootprint );
fparent->GetCanvas()->GetView()->MarkDirty(); fparent->GetCanvas()->GetView()->MarkDirty();
fparent->GetCanvas()->Refresh(); fparent->GetCanvas()->Refresh();
@ -59,7 +59,7 @@ static int refreshCallback( MODULE* aModule )
} }
int AUTOPLACE_TOOL::autoplace( std::vector<MODULE*>& aModules, bool aPlaceOffboard ) int AUTOPLACE_TOOL::autoplace( std::vector<MODULE*>& aFootprints, bool aPlaceOffboard )
{ {
EDA_RECT bbox = board()->GetBoardEdgesBoundingBox(); EDA_RECT bbox = board()->GetBoardEdgesBoundingBox();
@ -82,14 +82,14 @@ int AUTOPLACE_TOOL::autoplace( std::vector<MODULE*>& aModules, bool aPlaceOffboa
autoplacer.SetOverlay( overlay ); autoplacer.SetOverlay( overlay );
fparent = frame(); fparent = frame();
std::function<int( MODULE* aModule )> callback = refreshCallback; std::function<int( MODULE* aFootprint )> callback = refreshCallback;
autoplacer.SetRefreshCallback( callback ); autoplacer.SetRefreshCallback( callback );
std::unique_ptr<WX_PROGRESS_REPORTER> progressReporter( std::unique_ptr<WX_PROGRESS_REPORTER> progressReporter(
new WX_PROGRESS_REPORTER( frame(), _( "Autoplace Components" ), 1 ) ); new WX_PROGRESS_REPORTER( frame(), _( "Autoplace Components" ), 1 ) );
autoplacer.SetProgressReporter( progressReporter.get() ); autoplacer.SetProgressReporter( progressReporter.get() );
auto result = autoplacer.AutoplaceModules( aModules, &commit, aPlaceOffboard ); auto result = autoplacer.AutoplaceFootprints( aFootprints, &commit, aPlaceOffboard );
if( result == AR_COMPLETED ) if( result == AR_COMPLETED )
commit.Push( _( "Autoplace components" ) ); commit.Push( _( "Autoplace components" ) );
@ -102,23 +102,23 @@ int AUTOPLACE_TOOL::autoplace( std::vector<MODULE*>& aModules, bool aPlaceOffboa
int AUTOPLACE_TOOL::autoplaceSelected( const TOOL_EVENT& aEvent ) int AUTOPLACE_TOOL::autoplaceSelected( const TOOL_EVENT& aEvent )
{ {
std::vector<MODULE*> mods; std::vector<MODULE*> footprints;
for( EDA_ITEM* item : selection() ) for( EDA_ITEM* item : selection() )
{ {
if( item->Type() == PCB_MODULE_T ) if( item->Type() == PCB_MODULE_T )
mods.push_back( static_cast<MODULE*>( item ) ); footprints.push_back( static_cast<MODULE*>( item ) );
} }
return autoplace( mods, false ); return autoplace( footprints, false );
} }
int AUTOPLACE_TOOL::autoplaceOffboard( const TOOL_EVENT& aEvent ) int AUTOPLACE_TOOL::autoplaceOffboard( const TOOL_EVENT& aEvent )
{ {
std::vector<MODULE*> mods; std::vector<MODULE*> footprints;
return autoplace( mods, true ); return autoplace( footprints, true );
} }

View File

@ -42,7 +42,7 @@ public:
void setTransitions() override; void setTransitions() override;
private: private:
int autoplace( std::vector<MODULE*>& aModules, bool aPlaceOffboard ); int autoplace( std::vector<MODULE*>& aFootprints, bool aPlaceOffboard );
int autoplaceSelected( const TOOL_EVENT& aEvent ); int autoplaceSelected( const TOOL_EVENT& aEvent );
int autoplaceOffboard( const TOOL_EVENT& aEvent ); int autoplaceOffboard( const TOOL_EVENT& aEvent );

View File

@ -626,35 +626,41 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponentLibrary()
} }
void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryFigures( const SYMDEF_PCB& aComponent, MODULE* aModule ) void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryFigures( const SYMDEF_PCB& aComponent,
MODULE* aFootprint )
{ {
for( std::pair<FIGURE_ID, FIGURE> figPair : aComponent.Figures ) for( std::pair<FIGURE_ID, FIGURE> figPair : aComponent.Figures )
{ {
FIGURE& fig = figPair.second; FIGURE& fig = figPair.second;
drawCadstarShape( fig.Shape, getKiCadLayer( fig.LayerID ), drawCadstarShape( fig.Shape, getKiCadLayer( fig.LayerID ),
getLineThickness( fig.LineCodeID ), getLineThickness( fig.LineCodeID ),
wxString::Format( "Component %s:%s -> Figure %s", aComponent.ReferenceName, wxString::Format( "Component %s:%s -> Figure %s",
aComponent.Alternate, fig.ID ), aComponent.ReferenceName,
aModule ); aComponent.Alternate,
fig.ID ),
aFootprint );
} }
} }
void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponent, MODULE* aModule ) void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponent, MODULE* aFootprint )
{ {
for( COMPONENT_COPPER compCopper : aComponent.ComponentCoppers ) for( COMPONENT_COPPER compCopper : aComponent.ComponentCoppers )
{ {
int lineThickness = getKiCadLength( getCopperCode( compCopper.CopperCodeID ).CopperWidth ); int lineThickness = getKiCadLength( getCopperCode( compCopper.CopperCodeID ).CopperWidth );
drawCadstarShape( compCopper.Shape, getKiCadLayer( compCopper.LayerID ), lineThickness, drawCadstarShape( compCopper.Shape, getKiCadLayer( compCopper.LayerID ), lineThickness,
wxString::Format( "Component %s:%s -> Copper element", aComponent.ReferenceName, wxString::Format( "Component %s:%s -> Copper element",
aComponent.ReferenceName,
aComponent.Alternate ), aComponent.Alternate ),
aModule ); aFootprint );
} }
} }
void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryAreas( const SYMDEF_PCB& aComponent, MODULE* aModule ) void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryAreas( const SYMDEF_PCB& aComponent,
MODULE* aFootprint )
{ {
for( std::pair<COMP_AREA_ID, COMPONENT_AREA> areaPair : aComponent.ComponentAreas ) for( std::pair<COMP_AREA_ID, COMPONENT_AREA> areaPair : aComponent.ComponentAreas )
{ {
@ -663,9 +669,9 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryAreas( const SYMDEF_PCB& aComponent,
if( area.NoVias || area.NoTracks ) if( area.NoVias || area.NoTracks )
{ {
ZONE* zone = getZoneFromCadstarShape( area.Shape, getLineThickness( area.LineCodeID ), ZONE* zone = getZoneFromCadstarShape( area.Shape, getLineThickness( area.LineCodeID ),
aModule ); aFootprint );
aModule->Add( zone, ADD_MODE::APPEND ); aFootprint->Add( zone, ADD_MODE::APPEND );
if( isLayerSet( area.LayerID ) ) if( isLayerSet( area.LayerID ) )
zone->SetLayerSet( getKiCadLayerSet( area.LayerID ) ); zone->SetLayerSet( getKiCadLayerSet( area.LayerID ) );
@ -699,14 +705,14 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryAreas( const SYMDEF_PCB& aComponent,
} }
void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryPads( const SYMDEF_PCB& aComponent, MODULE* aModule ) void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryPads( const SYMDEF_PCB& aComponent,
MODULE* aFootprint )
{ {
for( std::pair<PAD_ID, COMPONENT_PAD> padPair : aComponent.ComponentPads ) for( std::pair<PAD_ID, COMPONENT_PAD> padPair : aComponent.ComponentPads )
{ {
PAD* pad = getKiCadPad( padPair.second, aModule ); PAD* pad = getKiCadPad( padPair.second, aFootprint );
aModule->Add( pad, aFootprint->Add( pad, ADD_MODE::INSERT ); // insert so that we get correct behaviour
ADD_MODE::INSERT ); // insert so that we get correct behaviour when finding pads // when finding pads by PAD_ID - see loadNets()
// in the module by PAD_ID - see loadNets()
} }
} }
@ -1604,15 +1610,18 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadNets()
} }
void CADSTAR_PCB_ARCHIVE_LOADER::loadComponentAttributes( void CADSTAR_PCB_ARCHIVE_LOADER::loadComponentAttributes( const COMPONENT& aComponent,
const COMPONENT& aComponent, MODULE* aModule ) MODULE* aFootprint )
{ {
for( std::pair<ATTRIBUTE_ID, ATTRIBUTE_VALUE> attrPair : aComponent.AttributeValues ) for( std::pair<ATTRIBUTE_ID, ATTRIBUTE_VALUE> attrPair : aComponent.AttributeValues )
{ {
ATTRIBUTE_VALUE& attrval = attrPair.second; ATTRIBUTE_VALUE& attrval = attrPair.second;
if( attrval.HasLocation ) //only import attributes with location. Ignore the rest if( attrval.HasLocation ) //only import attributes with location. Ignore the rest
addAttribute( attrval.AttributeLocation, attrval.AttributeID, aModule, attrval.Value ); {
addAttribute( attrval.AttributeLocation, attrval.AttributeID, aFootprint,
attrval.Value );
}
} }
for( std::pair<ATTRIBUTE_ID, TEXT_LOCATION> textlocPair : aComponent.TextLocations ) for( std::pair<ATTRIBUTE_ID, TEXT_LOCATION> textlocPair : aComponent.TextLocations )
@ -1635,7 +1644,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponentAttributes(
else else
attrval = getAttributeValue( textloc.AttributeID, aComponent.AttributeValues ); attrval = getAttributeValue( textloc.AttributeID, aComponent.AttributeValues );
addAttribute( textloc, textloc.AttributeID, aModule, attrval ); addAttribute( textloc, textloc.AttributeID, aFootprint, attrval );
} }
} }
@ -2279,26 +2288,28 @@ std::vector<TRACK*> CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromDrawsegments(
void CADSTAR_PCB_ARCHIVE_LOADER::addAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc, void CADSTAR_PCB_ARCHIVE_LOADER::addAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
const ATTRIBUTE_ID& aCadstarAttributeID, MODULE* aModule, const wxString& aAttributeValue ) const ATTRIBUTE_ID& aCadstarAttributeID,
MODULE* aFootprint,
const wxString& aAttributeValue )
{ {
FP_TEXT* txt; FP_TEXT* txt;
if( aCadstarAttributeID == COMPONENT_NAME_ATTRID ) if( aCadstarAttributeID == COMPONENT_NAME_ATTRID )
{ {
txt = &aModule->Reference(); //text should be set outside this function txt = &aFootprint->Reference(); //text should be set outside this function
} }
else if( aCadstarAttributeID == PART_NAME_ATTRID ) else if( aCadstarAttributeID == PART_NAME_ATTRID )
{ {
if( aModule->Value().GetText().IsEmpty() ) if( aFootprint->Value().GetText().IsEmpty() )
{ {
// Use PART_NAME_ATTRID as the value is value field is blank // Use PART_NAME_ATTRID as the value is value field is blank
aModule->SetValue( aAttributeValue ); aFootprint->SetValue( aAttributeValue );
txt = &aModule->Value(); txt = &aFootprint->Value();
} }
else else
{ {
txt = new FP_TEXT( aModule ); txt = new FP_TEXT( aFootprint );
aModule->Add( txt ); aFootprint->Add( txt );
txt->SetText( aAttributeValue ); txt->SetText( aAttributeValue );
} }
txt->SetVisible( false ); //make invisible to avoid clutter. txt->SetVisible( false ); //make invisible to avoid clutter.
@ -2306,34 +2317,34 @@ void CADSTAR_PCB_ARCHIVE_LOADER::addAttribute( const ATTRIBUTE_LOCATION& aCadsta
else if( aCadstarAttributeID != COMPONENT_NAME_2_ATTRID else if( aCadstarAttributeID != COMPONENT_NAME_2_ATTRID
&& getAttributeName( aCadstarAttributeID ) == wxT( "Value" ) ) && getAttributeName( aCadstarAttributeID ) == wxT( "Value" ) )
{ {
if( !aModule->Value().GetText().IsEmpty() ) if( !aFootprint->Value().GetText().IsEmpty() )
{ {
//copy the object //copy the object
aModule->Add( new FP_TEXT( aModule->Value() ) ); aFootprint->Add( new FP_TEXT( aFootprint->Value() ) );
} }
aModule->SetValue( aAttributeValue ); aFootprint->SetValue( aAttributeValue );
txt = &aModule->Value(); txt = &aFootprint->Value();
txt->SetVisible( false ); //make invisible to avoid clutter. txt->SetVisible( false ); //make invisible to avoid clutter.
} }
else else
{ {
txt = new FP_TEXT( aModule ); txt = new FP_TEXT( aFootprint );
aModule->Add( txt ); aFootprint->Add( txt );
txt->SetText( aAttributeValue ); txt->SetText( aAttributeValue );
txt->SetVisible( false ); //make all user attributes invisible to avoid clutter. txt->SetVisible( false ); //make all user attributes invisible to avoid clutter.
//TODO: Future improvement - allow user to decide what to do with attributes //TODO: Future improvement - allow user to decide what to do with attributes
} }
wxPoint rotatedTextPos = getKiCadPoint( aCadstarAttrLoc.Position ) - aModule->GetPosition(); wxPoint rotatedTextPos = getKiCadPoint( aCadstarAttrLoc.Position ) - aFootprint->GetPosition();
RotatePoint( &rotatedTextPos, -aModule->GetOrientation() ); RotatePoint( &rotatedTextPos, -aFootprint->GetOrientation() );
txt->SetTextPos( getKiCadPoint( aCadstarAttrLoc.Position ) ); txt->SetTextPos( getKiCadPoint( aCadstarAttrLoc.Position ) );
txt->SetPos0( rotatedTextPos ); txt->SetPos0( rotatedTextPos );
txt->SetLayer( getKiCadLayer( aCadstarAttrLoc.LayerID ) ); txt->SetLayer( getKiCadLayer( aCadstarAttrLoc.LayerID ) );
txt->SetMirrored( aCadstarAttrLoc.Mirror ); txt->SetMirrored( aCadstarAttrLoc.Mirror );
txt->SetTextAngle( txt->SetTextAngle(
getAngleTenthDegree( aCadstarAttrLoc.OrientAngle ) - aModule->GetOrientation() ); getAngleTenthDegree( aCadstarAttrLoc.OrientAngle ) - aFootprint->GetOrientation() );
if( aCadstarAttrLoc.Mirror ) // If mirroring, invert angle to match CADSTAR if( aCadstarAttrLoc.Mirror ) // If mirroring, invert angle to match CADSTAR
txt->SetTextAngle( -txt->GetTextAngle() ); txt->SetTextAngle( -txt->GetTextAngle() );

View File

@ -133,11 +133,11 @@ private:
const PCB_LAYER_ID& aKiCadLayer ); const PCB_LAYER_ID& aKiCadLayer );
void logBoardStackupMessage( const wxString& aCadstarLayerName, void logBoardStackupMessage( const wxString& aCadstarLayerName,
const PCB_LAYER_ID& aKiCadLayer ); const PCB_LAYER_ID& aKiCadLayer );
void loadLibraryFigures( const SYMDEF_PCB& aComponent, MODULE* aModule ); void loadLibraryFigures( const SYMDEF_PCB& aComponent, MODULE* aFootprint );
void loadLibraryCoppers( const SYMDEF_PCB& aComponent, MODULE* aModule ); void loadLibraryCoppers( const SYMDEF_PCB& aComponent, MODULE* aFootprint );
void loadLibraryAreas( const SYMDEF_PCB& aComponent, MODULE* aModule ); void loadLibraryAreas( const SYMDEF_PCB& aComponent, MODULE* aFootprint );
void loadLibraryPads( const SYMDEF_PCB& aComponent, MODULE* aModule ); void loadLibraryPads( const SYMDEF_PCB& aComponent, MODULE* aFootprint );
void loadComponentAttributes( const COMPONENT& aComponent, MODULE* aModule ); void loadComponentAttributes( const COMPONENT& aComponent, MODULE* aFootprint );
void loadNetTracks( const NET_ID& aCadstarNetID, const NET_PCB::ROUTE& aCadstarRoute ); void loadNetTracks( const NET_ID& aCadstarNetID, const NET_PCB::ROUTE& aCadstarRoute );
void loadNetVia( const NET_ID& aCadstarNetID, const NET_PCB::VIA& aCadstarVia ); void loadNetVia( const NET_ID& aCadstarNetID, const NET_PCB::VIA& aCadstarVia );
void checkAndLogHatchCode( const HATCHCODE_ID& aCadstarHatchcodeID ); void checkAndLogHatchCode( const HATCHCODE_ID& aCadstarHatchcodeID );
@ -315,11 +315,11 @@ private:
* @brief Adds a CADSTAR Attribute to a KiCad module * @brief Adds a CADSTAR Attribute to a KiCad module
* @param aCadstarAttrLoc * @param aCadstarAttrLoc
* @param aCadstarAttributeID * @param aCadstarAttributeID
* @param aModule * @param aFootprint
* @param aAttributeValue * @param aAttributeValue
*/ */
void addAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc, void addAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
const ATTRIBUTE_ID& aCadstarAttributeID, MODULE* aModule, const ATTRIBUTE_ID& aCadstarAttributeID, MODULE* aFootprint,
const wxString& aAttributeValue ); const wxString& aAttributeValue );
//Helper Functions for obtaining CADSTAR elements in the parsed structures //Helper Functions for obtaining CADSTAR elements in the parsed structures

View File

@ -1387,27 +1387,29 @@ ZONE* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
} }
void EAGLE_PLUGIN::orientModuleAndText( MODULE* m, const EELEMENT& e, const EATTR* nameAttr, void EAGLE_PLUGIN::orientModuleAndText( MODULE* aFootprint, const EELEMENT& e,
const EATTR* valueAttr ) const EATTR* aNameAttr, const EATTR* aValueAttr )
{ {
if( e.rot ) if( e.rot )
{ {
if( e.rot->mirror ) if( e.rot->mirror )
{ {
double orientation = e.rot->degrees + 180.0; double orientation = e.rot->degrees + 180.0;
m->SetOrientation( orientation * 10 ); aFootprint->SetOrientation( orientation * 10 );
m->Flip( m->GetPosition(), false ); aFootprint->Flip( aFootprint->GetPosition(), false );
} }
else else
m->SetOrientation( e.rot->degrees * 10 ); {
aFootprint->SetOrientation( e.rot->degrees * 10 );
}
} }
orientModuleText( m, e, &m->Reference(), nameAttr ); orientModuleText( aFootprint, e, &aFootprint->Reference(), aNameAttr );
orientModuleText( m, e, &m->Value(), valueAttr ); orientModuleText( aFootprint, e, &aFootprint->Value(), aValueAttr );
} }
void EAGLE_PLUGIN::orientModuleText( MODULE* m, const EELEMENT& e, FP_TEXT* txt, void EAGLE_PLUGIN::orientModuleText( MODULE* aFootprint, const EELEMENT& e, FP_TEXT* aFPText,
const EATTR* aAttr ) const EATTR* aAttr )
{ {
// Smashed part ? // Smashed part ?
@ -1417,26 +1419,26 @@ void EAGLE_PLUGIN::orientModuleText( MODULE* m, const EELEMENT& e, FP_TEXT* txt,
if( a.value ) if( a.value )
{ {
txt->SetText( FROM_UTF8( a.value->c_str() ) ); aFPText->SetText( FROM_UTF8( a.value->c_str() ) );
} }
if( a.x && a.y ) // OPT if( a.x && a.y ) // OPT
{ {
wxPoint pos( kicad_x( *a.x ), kicad_y( *a.y ) ); wxPoint pos( kicad_x( *a.x ), kicad_y( *a.y ) );
txt->SetTextPos( pos ); aFPText->SetTextPos( pos );
} }
// Even though size and ratio are both optional, I am not seeing // Even though size and ratio are both optional, I am not seeing
// a case where ratio is present but size is not. // a case where ratio is present but size is not.
double ratio = 8; double ratio = 8;
wxSize fontz = txt->GetTextSize(); wxSize fontz = aFPText->GetTextSize();
int textThickness = KiROUND( fontz.y * ratio / 100 ); int textThickness = KiROUND( fontz.y * ratio / 100 );
txt->SetTextThickness( textThickness ); aFPText->SetTextThickness( textThickness );
if( a.size ) if( a.size )
{ {
fontz = kicad_fontz( *a.size, textThickness ); fontz = kicad_fontz( *a.size, textThickness );
txt->SetTextSize( fontz ); aFPText->SetTextSize( fontz );
if( a.ratio ) if( a.ratio )
ratio = *a.ratio; ratio = *a.ratio;
@ -1463,62 +1465,62 @@ void EAGLE_PLUGIN::orientModuleText( MODULE* m, const EELEMENT& e, FP_TEXT* txt,
{ {
spin = a.rot->spin; spin = a.rot->spin;
sign = a.rot->mirror ? -1 : 1; sign = a.rot->mirror ? -1 : 1;
txt->SetMirrored( a.rot->mirror ); aFPText->SetMirrored( a.rot->mirror );
} }
if( degrees == 90 || degrees == 0 || spin ) if( degrees == 90 || degrees == 0 || spin )
{ {
orient = degrees - m->GetOrientation() / 10; orient = degrees - aFootprint->GetOrientation() / 10;
txt->SetTextAngle( sign * orient * 10 ); aFPText->SetTextAngle( sign * orient * 10 );
} }
else if( degrees == 180 ) else if( degrees == 180 )
{ {
orient = 0 - m->GetOrientation() / 10; orient = 0 - aFootprint->GetOrientation() / 10;
txt->SetTextAngle( sign * orient * 10 ); aFPText->SetTextAngle( sign * orient * 10 );
align = -align; align = -align;
} }
else if( degrees == 270 ) else if( degrees == 270 )
{ {
orient = 90 - m->GetOrientation() / 10; orient = 90 - aFootprint->GetOrientation() / 10;
align = -align; align = -align;
txt->SetTextAngle( sign * orient * 10 ); aFPText->SetTextAngle( sign * orient * 10 );
} }
else else
{ {
orient = 90 - degrees - m->GetOrientation() / 10; orient = 90 - degrees - aFootprint->GetOrientation() / 10;
txt->SetTextAngle( sign * orient * 10 ); aFPText->SetTextAngle( sign * orient * 10 );
} }
switch( align ) switch( align )
{ {
case ETEXT::TOP_RIGHT: case ETEXT::TOP_RIGHT:
txt->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT ); aFPText->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
txt->SetVertJustify( GR_TEXT_VJUSTIFY_TOP ); aFPText->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
break; break;
case ETEXT::BOTTOM_LEFT: case ETEXT::BOTTOM_LEFT:
txt->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT ); aFPText->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
txt->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM ); aFPText->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
break; break;
case ETEXT::TOP_LEFT: case ETEXT::TOP_LEFT:
txt->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT ); aFPText->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
txt->SetVertJustify( GR_TEXT_VJUSTIFY_TOP ); aFPText->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
break; break;
case ETEXT::BOTTOM_RIGHT: case ETEXT::BOTTOM_RIGHT:
txt->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT ); aFPText->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
txt->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM ); aFPText->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
break; break;
case ETEXT::TOP_CENTER: case ETEXT::TOP_CENTER:
txt->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER ); aFPText->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
txt->SetVertJustify( GR_TEXT_VJUSTIFY_TOP ); aFPText->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
break; break;
case ETEXT::BOTTOM_CENTER: case ETEXT::BOTTOM_CENTER:
txt->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER ); aFPText->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
txt->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM ); aFPText->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
break; break;
default: default:
@ -1527,15 +1529,15 @@ void EAGLE_PLUGIN::orientModuleText( MODULE* m, const EELEMENT& e, FP_TEXT* txt,
} }
else // Part is not smash so use Lib default for NAME/VALUE // the text is per the original package, sans <attribute> else // Part is not smash so use Lib default for NAME/VALUE // the text is per the original package, sans <attribute>
{ {
double degrees = ( txt->GetTextAngle() + m->GetOrientation() ) / 10; double degrees = ( aFPText->GetTextAngle() + aFootprint->GetOrientation() ) / 10;
// @todo there are a few more cases than these to contend with: // @todo there are a few more cases than these to contend with:
if( (!txt->IsMirrored() && ( abs( degrees ) == 180 || abs( degrees ) == 270 )) if( ( !aFPText->IsMirrored() && ( abs( degrees ) == 180 || abs( degrees ) == 270 ))
|| ( txt->IsMirrored() && ( degrees == 360 ) ) ) || ( aFPText->IsMirrored() && ( degrees == 360 ) ) )
{ {
// ETEXT::TOP_RIGHT: // ETEXT::TOP_RIGHT:
txt->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT ); aFPText->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
txt->SetVertJustify( GR_TEXT_VJUSTIFY_TOP ); aFPText->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
} }
} }
} }
@ -1590,7 +1592,7 @@ MODULE* EAGLE_PLUGIN::makeModule( wxXmlNode* aPackage, const wxString& aPkgName
} }
void EAGLE_PLUGIN::packageWire( MODULE* aModule, wxXmlNode* aTree ) const void EAGLE_PLUGIN::packageWire( MODULE* aFootprint, wxXmlNode* aTree ) const
{ {
EWIRE w( aTree ); EWIRE w( aTree );
PCB_LAYER_ID layer = kicad_layer( w.layer ); PCB_LAYER_ID layer = kicad_layer( w.layer );
@ -1598,9 +1600,9 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, wxXmlNode* aTree ) const
wxPoint end( kicad_x( w.x2 ), kicad_y( w.y2 ) ); wxPoint end( kicad_x( w.x2 ), kicad_y( w.y2 ) );
int width = w.width.ToPcbUnits(); int width = w.width.ToPcbUnits();
if( layer == UNDEFINED_LAYER ) { if( layer == UNDEFINED_LAYER )
wxLogMessage( wxString::Format( {
_( "Ignoring a wire since Eagle layer '%s' (%d) " wxLogMessage( wxString::Format( _( "Ignoring a wire since Eagle layer '%s' (%d) "
"was not mapped" ), "was not mapped" ),
eagle_layer_name( w.layer ), eagle_layer_name( w.layer ),
w.layer ) ); w.layer ) );
@ -1610,7 +1612,7 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, wxXmlNode* aTree ) const
// KiCad cannot handle zero or negative line widths which apparently have meaning in Eagle. // KiCad cannot handle zero or negative line widths which apparently have meaning in Eagle.
if( width <= 0 ) if( width <= 0 )
{ {
BOARD* board = aModule->GetBoard(); BOARD* board = aFootprint->GetBoard();
if( board ) if( board )
{ {
@ -1641,14 +1643,14 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, wxXmlNode* aTree ) const
if( !w.curve ) if( !w.curve )
{ {
dwg = new FP_SHAPE( aModule, S_SEGMENT ); dwg = new FP_SHAPE( aFootprint, S_SEGMENT );
dwg->SetStart0( start ); dwg->SetStart0( start );
dwg->SetEnd0( end ); dwg->SetEnd0( end );
} }
else else
{ {
dwg = new FP_SHAPE( aModule, S_ARC ); dwg = new FP_SHAPE( aFootprint, S_ARC );
wxPoint center = ConvertArcCenter( start, end, *w.curve ); wxPoint center = ConvertArcCenter( start, end, *w.curve );
dwg->SetStart0( center ); dwg->SetStart0( center );
@ -1660,26 +1662,26 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, wxXmlNode* aTree ) const
dwg->SetWidth( width ); dwg->SetWidth( width );
dwg->SetDrawCoord(); dwg->SetDrawCoord();
aModule->Add( dwg ); aFootprint->Add( dwg );
} }
void EAGLE_PLUGIN::packagePad( MODULE* aModule, wxXmlNode* aTree ) void EAGLE_PLUGIN::packagePad( MODULE* aFootprint, wxXmlNode* aTree )
{ {
// this is thru hole technology here, no SMDs // this is thru hole technology here, no SMDs
EPAD e( aTree ); EPAD e( aTree );
int shape = EPAD::UNDEF; int shape = EPAD::UNDEF;
int eagleDrillz = e.drill.ToPcbUnits(); int eagleDrillz = e.drill.ToPcbUnits();
PAD* pad = new PAD( aModule ); PAD* pad = new PAD( aFootprint );
aModule->Add( pad ); aFootprint->Add( pad );
transferPad( e, pad ); transferPad( e, pad );
if( e.first && *e.first && m_rules->psFirst != EPAD::UNDEF ) if( e.first && *e.first && m_rules->psFirst != EPAD::UNDEF )
shape = m_rules->psFirst; shape = m_rules->psFirst;
else if( aModule->GetLayer() == F_Cu && m_rules->psTop != EPAD::UNDEF ) else if( aFootprint->GetLayer() == F_Cu && m_rules->psTop != EPAD::UNDEF )
shape = m_rules->psTop; shape = m_rules->psTop;
else if( aModule->GetLayer() == B_Cu && m_rules->psBottom != EPAD::UNDEF ) else if( aFootprint->GetLayer() == B_Cu && m_rules->psBottom != EPAD::UNDEF )
shape = m_rules->psBottom; shape = m_rules->psBottom;
pad->SetDrillSize( wxSize( eagleDrillz, eagleDrillz ) ); pad->SetDrillSize( wxSize( eagleDrillz, eagleDrillz ) );
@ -1766,14 +1768,14 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, wxXmlNode* aTree )
} }
void EAGLE_PLUGIN::packageText( MODULE* aModule, wxXmlNode* aTree ) const void EAGLE_PLUGIN::packageText( MODULE* aFootprint, wxXmlNode* aTree ) const
{ {
ETEXT t( aTree ); ETEXT t( aTree );
PCB_LAYER_ID layer = kicad_layer( t.layer ); PCB_LAYER_ID layer = kicad_layer( t.layer );
if( layer == UNDEFINED_LAYER ) { if( layer == UNDEFINED_LAYER )
wxLogMessage( wxString::Format( {
_( "Ignoring a text since Eagle layer '%s' (%d) " wxLogMessage( wxString::Format( _( "Ignoring a text since Eagle layer '%s' (%d) "
"was not mapped" ), "was not mapped" ),
eagle_layer_name( t.layer ), eagle_layer_name( t.layer ),
t.layer ) ); t.layer ) );
@ -1783,14 +1785,14 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, wxXmlNode* aTree ) const
FP_TEXT* txt; FP_TEXT* txt;
if( t.text == ">NAME" || t.text == ">name" ) if( t.text == ">NAME" || t.text == ">name" )
txt = &aModule->Reference(); txt = &aFootprint->Reference();
else if( t.text == ">VALUE" || t.text == ">value" ) else if( t.text == ">VALUE" || t.text == ">value" )
txt = &aModule->Value(); txt = &aFootprint->Value();
else else
{ {
// FIXME: graphical text items are rotated for some reason. // FIXME: graphical text items are rotated for some reason.
txt = new FP_TEXT( aModule ); txt = new FP_TEXT( aFootprint );
aModule->Add( txt ); aFootprint->Add( txt );
} }
txt->SetText( FROM_UTF8( t.text.c_str() ) ); txt->SetText( FROM_UTF8( t.text.c_str() ) );
@ -1798,7 +1800,7 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, wxXmlNode* aTree ) const
wxPoint pos( kicad_x( t.x ), kicad_y( t.y ) ); wxPoint pos( kicad_x( t.x ), kicad_y( t.y ) );
txt->SetTextPos( pos ); txt->SetTextPos( pos );
txt->SetPos0( pos - aModule->GetPosition() ); txt->SetPos0( pos - aFootprint->GetPosition() );
txt->SetLayer( layer ); txt->SetLayer( layer );
@ -1812,7 +1814,7 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, wxXmlNode* aTree ) const
int align = t.align ? *t.align : ETEXT::BOTTOM_LEFT; // bottom-left is eagle default int align = t.align ? *t.align : ETEXT::BOTTOM_LEFT; // bottom-left is eagle default
// An eagle package is never rotated, the DTD does not allow it. // An eagle package is never rotated, the DTD does not allow it.
// angle -= aModule->GetOrienation(); // angle -= aFootprint->GetOrienation();
if( t.rot ) if( t.rot )
{ {
@ -1877,15 +1879,15 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, wxXmlNode* aTree ) const
} }
void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const void EAGLE_PLUGIN::packageRectangle( MODULE* aFootprint, wxXmlNode* aTree ) const
{ {
ERECT r( aTree ); ERECT r( aTree );
if( r.layer == EAGLE_LAYER::TRESTRICT || r.layer == EAGLE_LAYER::BRESTRICT if( r.layer == EAGLE_LAYER::TRESTRICT || r.layer == EAGLE_LAYER::BRESTRICT
|| r.layer == EAGLE_LAYER::VRESTRICT ) || r.layer == EAGLE_LAYER::VRESTRICT )
{ {
FP_ZONE* zone = new FP_ZONE( aModule ); FP_ZONE* zone = new FP_ZONE( aFootprint );
aModule->Add( zone, ADD_MODE::APPEND ); aFootprint->Add( zone, ADD_MODE::APPEND );
setKeepoutSettingsToZone( zone, r.layer ); setKeepoutSettingsToZone( zone, r.layer );
@ -1908,18 +1910,19 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const
else else
{ {
PCB_LAYER_ID layer = kicad_layer( r.layer ); PCB_LAYER_ID layer = kicad_layer( r.layer );
if( layer == UNDEFINED_LAYER ) {
wxLogMessage( wxString::Format( if( layer == UNDEFINED_LAYER )
_( "Ignoring a rectange since Eagle layer '%s' (%d) " {
wxLogMessage( wxString::Format( _( "Ignoring a rectange since Eagle layer '%s' (%d) "
"was not mapped" ), "was not mapped" ),
eagle_layer_name( r.layer ), eagle_layer_name( r.layer ),
r.layer ) ); r.layer ) );
return; return;
} }
FP_SHAPE* dwg = new FP_SHAPE( aModule, S_POLYGON ); FP_SHAPE* dwg = new FP_SHAPE( aFootprint, S_POLYGON );
aModule->Add( dwg ); aFootprint->Add( dwg );
dwg->SetLayer( layer ); dwg->SetLayer( layer );
dwg->SetWidth( 0 ); dwg->SetWidth( 0 );
@ -1945,7 +1948,7 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const
} }
void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const void EAGLE_PLUGIN::packagePolygon( MODULE* aFootprint, wxXmlNode* aTree ) const
{ {
EPOLYGON p( aTree ); EPOLYGON p( aTree );
@ -2007,8 +2010,8 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const
|| p.layer == EAGLE_LAYER::BRESTRICT || p.layer == EAGLE_LAYER::BRESTRICT
|| p.layer == EAGLE_LAYER::VRESTRICT ) || p.layer == EAGLE_LAYER::VRESTRICT )
{ {
FP_ZONE* zone = new FP_ZONE( aModule ); FP_ZONE* zone = new FP_ZONE( aFootprint );
aModule->Add( zone, ADD_MODE::APPEND ); aFootprint->Add( zone, ADD_MODE::APPEND );
setKeepoutSettingsToZone( zone, p.layer ); setKeepoutSettingsToZone( zone, p.layer );
@ -2022,18 +2025,19 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const
else else
{ {
PCB_LAYER_ID layer = kicad_layer( p.layer ); PCB_LAYER_ID layer = kicad_layer( p.layer );
if( layer == UNDEFINED_LAYER ) {
wxLogMessage( wxString::Format( if( layer == UNDEFINED_LAYER )
_( "Ignoring a polygon since Eagle layer '%s' (%d) " {
wxLogMessage( wxString::Format( _( "Ignoring a polygon since Eagle layer '%s' (%d) "
"was not mapped" ), "was not mapped" ),
eagle_layer_name( p.layer ), eagle_layer_name( p.layer ),
p.layer ) ); p.layer ) );
return; return;
} }
FP_SHAPE* dwg = new FP_SHAPE( aModule, S_POLYGON ); FP_SHAPE* dwg = new FP_SHAPE( aFootprint, S_POLYGON );
aModule->Add( dwg ); aFootprint->Add( dwg );
dwg->SetWidth( 0 ); // it's filled, no need for boundary width dwg->SetWidth( 0 ); // it's filled, no need for boundary width
dwg->SetLayer( layer ); dwg->SetLayer( layer );
@ -2047,7 +2051,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const
} }
} }
void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const void EAGLE_PLUGIN::packageCircle( MODULE* aFootprint, wxXmlNode* aTree ) const
{ {
ECIRCLE e( aTree ); ECIRCLE e( aTree );
@ -2058,8 +2062,8 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const
|| e.layer == EAGLE_LAYER::BRESTRICT || e.layer == EAGLE_LAYER::BRESTRICT
|| e.layer == EAGLE_LAYER::VRESTRICT ) || e.layer == EAGLE_LAYER::VRESTRICT )
{ {
FP_ZONE* zone = new FP_ZONE( aModule ); FP_ZONE* zone = new FP_ZONE( aFootprint );
aModule->Add( zone, ADD_MODE::APPEND ); aFootprint->Add( zone, ADD_MODE::APPEND );
setKeepoutSettingsToZone( zone, e.layer ); setKeepoutSettingsToZone( zone, e.layer );
@ -2091,16 +2095,17 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const
else else
{ {
PCB_LAYER_ID layer = kicad_layer( e.layer ); PCB_LAYER_ID layer = kicad_layer( e.layer );
if( layer == UNDEFINED_LAYER ) {
wxLogMessage( wxString::Format( if( layer == UNDEFINED_LAYER )
_( "Ignoring a cricle since Eagle layer '%s' (%d) " {
wxLogMessage( wxString::Format( _( "Ignoring a cricle since Eagle layer '%s' (%d) "
"was not mapped" ), "was not mapped" ),
eagle_layer_name( e.layer ), eagle_layer_name( e.layer ),
e.layer ) ); e.layer ) );
return; return;
} }
FP_SHAPE* gr = new FP_SHAPE( aModule, S_CIRCLE ); FP_SHAPE* gr = new FP_SHAPE( aFootprint, S_CIRCLE );
// with == 0 means filled circle // with == 0 means filled circle
if( width <= 0 ) if( width <= 0 )
@ -2109,7 +2114,7 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const
radius = radius / 2; radius = radius / 2;
} }
aModule->Add( gr ); aFootprint->Add( gr );
gr->SetWidth( width ); gr->SetWidth( width );
switch( (int) layer ) switch( (int) layer )
@ -2129,13 +2134,13 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, wxXmlNode* aTree ) const
} }
void EAGLE_PLUGIN::packageHole( MODULE* aModule, wxXmlNode* aTree, bool aCenter ) const void EAGLE_PLUGIN::packageHole( MODULE* aFootprint, wxXmlNode* aTree, bool aCenter ) const
{ {
EHOLE e( aTree ); EHOLE e( aTree );
// we add a PAD_ATTRIB_NPTH pad to this module. // we add a PAD_ATTRIB_NPTH pad to this module.
PAD* pad = new PAD( aModule ); PAD* pad = new PAD( aFootprint );
aModule->Add( pad ); aFootprint->Add( pad );
pad->SetShape( PAD_SHAPE_CIRCLE ); pad->SetShape( PAD_SHAPE_CIRCLE );
pad->SetAttribute( PAD_ATTRIB_NPTH ); pad->SetAttribute( PAD_ATTRIB_NPTH );
@ -2150,13 +2155,13 @@ void EAGLE_PLUGIN::packageHole( MODULE* aModule, wxXmlNode* aTree, bool aCenter
if( aCenter ) if( aCenter )
{ {
pad->SetPos0( wxPoint( 0, 0 ) ); pad->SetPos0( wxPoint( 0, 0 ) );
aModule->SetPosition( padpos ); aFootprint->SetPosition( padpos );
pad->SetPosition( padpos ); pad->SetPosition( padpos );
} }
else else
{ {
pad->SetPos0( padpos ); pad->SetPos0( padpos );
pad->SetPosition( padpos + aModule->GetPosition() ); pad->SetPosition( padpos + aFootprint->GetPosition() );
} }
wxSize sz( e.drill.ToPcbUnits(), e.drill.ToPcbUnits() ); wxSize sz( e.drill.ToPcbUnits(), e.drill.ToPcbUnits() );
@ -2168,7 +2173,7 @@ void EAGLE_PLUGIN::packageHole( MODULE* aModule, wxXmlNode* aTree, bool aCenter
} }
void EAGLE_PLUGIN::packageSMD( MODULE* aModule, wxXmlNode* aTree ) const void EAGLE_PLUGIN::packageSMD( MODULE* aFootprint, wxXmlNode* aTree ) const
{ {
ESMD e( aTree ); ESMD e( aTree );
PCB_LAYER_ID layer = kicad_layer( e.layer ); PCB_LAYER_ID layer = kicad_layer( e.layer );
@ -2176,8 +2181,8 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, wxXmlNode* aTree ) const
if( !IsCopperLayer( layer ) ) if( !IsCopperLayer( layer ) )
return; return;
PAD* pad = new PAD( aModule ); PAD* pad = new PAD( aFootprint );
aModule->Add( pad ); aFootprint->Add( pad );
transferPad( e, pad ); transferPad( e, pad );
pad->SetShape( PAD_SHAPE_RECT ); pad->SetShape( PAD_SHAPE_RECT );

View File

@ -276,8 +276,10 @@ private:
*/ */
ZONE* loadPolygon( wxXmlNode* aPolyNode ); ZONE* loadPolygon( wxXmlNode* aPolyNode );
void orientModuleAndText( MODULE* m, const EELEMENT& e, const EATTR* nameAttr, const EATTR* valueAttr ); void orientModuleAndText( MODULE* aFootprint, const EELEMENT& e, const EATTR* aNameAttr,
void orientModuleText( MODULE* m, const EELEMENT& e, FP_TEXT* txt, const EATTR* a ); const EATTR* aValueAttr );
void orientModuleText( MODULE* aFootprint, const EELEMENT& e, FP_TEXT* aFPText, const EATTR* a );
/// move the BOARD into the center of the page /// move the BOARD into the center of the page
@ -289,22 +291,22 @@ private:
*/ */
MODULE* makeModule( wxXmlNode* aPackage, const wxString& aPkgName ); MODULE* makeModule( wxXmlNode* aPackage, const wxString& aPkgName );
void packageWire( MODULE* aModule, wxXmlNode* aTree ) const; void packageWire( MODULE* aFootprint, wxXmlNode* aTree ) const;
void packagePad( MODULE* aModule, wxXmlNode* aTree ); void packagePad( MODULE* aFootprint, wxXmlNode* aTree );
void packageText( MODULE* aModule, wxXmlNode* aTree ) const; void packageText( MODULE* aFootprint, wxXmlNode* aTree ) const;
void packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const; void packageRectangle( MODULE* aFootprint, wxXmlNode* aTree ) const;
void packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const; void packagePolygon( MODULE* aFootprint, wxXmlNode* aTree ) const;
void packageCircle( MODULE* aModule, wxXmlNode* aTree ) const; void packageCircle( MODULE* aFootprint, wxXmlNode* aTree ) const;
/** /**
* Function packageHole * Function packageHole
* @parameter aModule - The KiCad module to which to assign the hole * @parameter aFootprint - The KiCad module to which to assign the hole
* @parameter aTree - The Eagle XML node that is of type "hole" * @parameter aTree - The Eagle XML node that is of type "hole"
* @parameter aCenter - If true, center the hole in the module and * @parameter aCenter - If true, center the hole in the module and
* offset the module position * offset the module position
*/ */
void packageHole( MODULE* aModule, wxXmlNode* aTree, bool aCenter ) const; void packageHole( MODULE* aFootprint, wxXmlNode* aTree, bool aCenter ) const;
void packageSMD( MODULE* aModule, wxXmlNode* aTree ) const; void packageSMD( MODULE* aFootprint, wxXmlNode* aTree ) const;
///> Handles common pad properties ///> Handles common pad properties
void transferPad( const EPAD_COMMON& aEaglePad, PAD* aPad ) const; void transferPad( const EPAD_COMMON& aEaglePad, PAD* aPad ) const;

View File

@ -111,16 +111,16 @@ class GPCB_FPL_CACHE_ITEM
std::unique_ptr<MODULE> m_module; std::unique_ptr<MODULE> m_module;
public: public:
GPCB_FPL_CACHE_ITEM( MODULE* aModule, const WX_FILENAME& aFileName ); GPCB_FPL_CACHE_ITEM( MODULE* aFootprint, const WX_FILENAME& aFileName );
WX_FILENAME GetFileName() const { return m_filename; } WX_FILENAME GetFileName() const { return m_filename; }
MODULE* GetModule() const { return m_module.get(); } MODULE* GetModule() const { return m_module.get(); }
}; };
GPCB_FPL_CACHE_ITEM::GPCB_FPL_CACHE_ITEM( MODULE* aModule, const WX_FILENAME& aFileName ) : GPCB_FPL_CACHE_ITEM::GPCB_FPL_CACHE_ITEM( MODULE* aFootprint, const WX_FILENAME& aFileName ) :
m_filename( aFileName ), m_filename( aFileName ),
m_module( aModule ) m_module( aFootprint )
{ {
} }