void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule, MODULE* aNewModule, BOARD_COMMIT& aCommit ) { aNewModule->SetParent( GetBoard() ); /* place module without ratsnest refresh: this will be made later * when all modules are on board */ PlaceModule( aNewModule, NULL, true ); // Copy full placement and pad net names (when possible) // but not local settings like clearances (use library values) aOldModule->CopyNetlistSettings( aNewModule, false ); // Copy reference and value aNewModule->SetReference( aOldModule->GetReference() ); aNewModule->SetValue( aOldModule->GetValue() ); // Updating other parameters aNewModule->SetTimeStamp( aOldModule->GetTimeStamp() ); aNewModule->SetPath( aOldModule->GetPath() ); aCommit.Remove( aOldModule ); aCommit.Add( aNewModule ); // @todo LEGACY should be unnecessary GetBoard()->m_Status_Pcb = 0; aNewModule->ClearFlags(); }
static bool mergeZones( BOARD_COMMIT& aCommit, std::vector<ZONE_CONTAINER *>& aOriginZones, std::vector<ZONE_CONTAINER *>& aMergedZones ) { for( unsigned int i = 1; i < aOriginZones.size(); i++ ) { aOriginZones[0]->Outline()->BooleanAdd( *aOriginZones[i]->Outline(), SHAPE_POLY_SET::PM_FAST ); } aOriginZones[0]->Outline()->Simplify( SHAPE_POLY_SET::PM_FAST ); // We should have one polygon with hole // We can have 2 polygons with hole, if the 2 initial polygons have only one common corner // and therefore cannot be merged (they are dectected as intersecting) // but we should never have more than 2 polys if( aOriginZones[0]->Outline()->OutlineCount() > 1 ) { wxLogMessage( wxT( "BOARD::CombineAreas error: more than 2 polys after merging" ) ); return false; } for( unsigned int i = 1; i < aOriginZones.size(); i++ ) { aCommit.Remove( aOriginZones[i] ); } aCommit.Modify( aOriginZones[0] ); aMergedZones.push_back( aOriginZones[0] ); aOriginZones[0]->SetLocalFlags( 1 ); aOriginZones[0]->Hatch(); return true; }
void DIALOG_EXCHANGE_MODULE::OnOkClick( wxCommandEvent& event ) { m_selectionMode = m_Selection->GetSelection(); bool result = false; switch( m_Selection->GetSelection() ) { case 0: result = changeCurrentFootprint(); break; case 1: result = changeSameFootprints( false ); break; case 2: result = changeSameFootprints( true ); break; case 3: result = changeAllFootprints(); break; } if( result ) { if( m_parent->GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ) m_parent->Compile_Ratsnest( NULL, true ); m_parent->GetCanvas()->Refresh(); } m_commit.Push( wxT( "Changed footprint" ) ); }
void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule, MODULE* aNewModule, BOARD_COMMIT& aCommit ) { aNewModule->SetParent( GetBoard() ); /* place module without ratsnest refresh: this will be made later * when all modules are on board */ PlaceModule( aNewModule, NULL, true ); // Copy full placement and pad net names (when possible) // but not local settings like clearances (use library values) aOldModule->CopyNetlistSettings( aNewModule, false ); // Copy reference and value aNewModule->SetReference( aOldModule->GetReference() ); aNewModule->SetValue( aOldModule->GetValue() ); // Compare the footprint name only, in case the nickname is empty or in case // user moved the footprint to a new library. Chances are if footprint name is // same then the footprint is very nearly the same and the two texts should // be kept at same size, position, and rotation. if( aNewModule->GetFPID().GetLibItemName() == aOldModule->GetFPID().GetLibItemName() ) { aNewModule->Reference().SetEffects( aOldModule->Reference() ); aNewModule->Value().SetEffects( aOldModule->Value() ); } // Updating other parameters aNewModule->SetTimeStamp( aOldModule->GetTimeStamp() ); aNewModule->SetPath( aOldModule->GetPath() ); aCommit.Remove( aOldModule ); aCommit.Add( aNewModule ); // @todo LEGACY should be unnecessary GetBoard()->m_Status_Pcb = 0; aNewModule->ClearFlags(); }
bool processBoardItem( PCB_EDIT_FRAME* aFrame, BOARD_COMMIT& commit, BOARD_ITEM* aItem, PCB_LAYER_ID* new_layer ) { if( new_layer[ aItem->GetLayer() ] != aItem->GetLayer() ) { commit.Modify( aItem ); aItem->SetLayer( new_layer[ aItem->GetLayer() ] ); aFrame->GetGalCanvas()->GetView()->Update( aItem, KIGFX::GEOMETRY ); return true; } return false; }
void DRC::addMarkerToPcb( MARKER_PCB* aMarker ) { BOARD_COMMIT commit ( m_pcbEditorFrame ); commit.Add( aMarker ); commit.Push( wxEmptyString, false ); }