More module -> footprint.

This commit is contained in:
Jeff Young 2020-11-13 00:43:45 +00:00
parent 52a46341db
commit fc9cf1d827
32 changed files with 271 additions and 307 deletions

View File

@ -36,12 +36,12 @@
#include <wx/string.h> #include <wx/string.h>
#include <plugins/3dapi/sg_base.h> #include <plugins/3dapi/sg_base.h>
class MODULE_3D_SETTINGS; class FP_3DMODEL;
struct S3D_INFO struct S3D_INFO
{ {
S3D_INFO(); S3D_INFO();
S3D_INFO( const MODULE_3D_SETTINGS& aModel ); S3D_INFO( const FP_3DMODEL& aModel );
SGPOINT m_Scale; ///< scaling factors for the 3D footprint shape SGPOINT m_Scale; ///< scaling factors for the 3D footprint shape
SGPOINT m_Rotation; ///< an X,Y,Z rotation (unit = degrees) for the 3D shape SGPOINT m_Rotation; ///< an X,Y,Z rotation (unit = degrees) for the 3D shape

View File

@ -31,7 +31,7 @@
bool S3D::Select3DModel( wxWindow* aParent, S3D_CACHE* aCache, wxString& prevModelSelectDir, bool S3D::Select3DModel( wxWindow* aParent, S3D_CACHE* aCache, wxString& prevModelSelectDir,
int& prevModelWildcard, MODULE_3D_SETTINGS* aModel ) int& prevModelWildcard, FP_3DMODEL* aModel )
{ {
if( NULL == aModel ) if( NULL == aModel )
return false; return false;

View File

@ -31,8 +31,8 @@ class FILENAME_RESOLVER;
namespace S3D namespace S3D
{ {
bool Select3DModel( wxWindow* aParent, S3D_CACHE* aCache, bool Select3DModel( wxWindow* aParent, S3D_CACHE* aCache, wxString& prevModelSelectDir,
wxString& prevModelSelectDir, int& prevModelWildcard, MODULE_3D_SETTINGS* aModel ); int& prevModelWildcard, FP_3DMODEL* aModel );
bool Configure3DPaths( wxWindow* aParent, FILENAME_RESOLVER* aResolver ); bool Configure3DPaths( wxWindow* aParent, FILENAME_RESOLVER* aResolver );
} }

View File

@ -41,7 +41,8 @@
DLG_SELECT_3DMODEL::DLG_SELECT_3DMODEL( wxWindow* aParent, S3D_CACHE* aCacheManager, DLG_SELECT_3DMODEL::DLG_SELECT_3DMODEL( wxWindow* aParent, S3D_CACHE* aCacheManager,
MODULE_3D_SETTINGS* aModelItem, wxString& prevModelSelectDir, int& prevModelWildcard ) : FP_3DMODEL* aModelItem, wxString& prevModelSelectDir,
int& prevModelWildcard ) :
DLG_SELECT_3D_MODELE_BASE( aParent ), DLG_SELECT_3D_MODELE_BASE( aParent ),
m_model( aModelItem ), m_cache( aCacheManager ), m_previousDir( prevModelSelectDir ), m_model( aModelItem ), m_cache( aCacheManager ), m_previousDir( prevModelSelectDir ),
m_previousFilterIndex( prevModelWildcard ) m_previousFilterIndex( prevModelWildcard )

View File

@ -33,7 +33,7 @@
#include "dlg_select_3dmodel_base.h" #include "dlg_select_3dmodel_base.h"
class MODULE_3D_SETTINGS; class FP_3DMODEL;
class S3D_CACHE; class S3D_CACHE;
class FILENAME_RESOLVER; class FILENAME_RESOLVER;
class C3D_MODEL_VIEWER; class C3D_MODEL_VIEWER;
@ -41,9 +41,9 @@ class C3D_MODEL_VIEWER;
class DLG_SELECT_3DMODEL : public DLG_SELECT_3D_MODELE_BASE class DLG_SELECT_3DMODEL : public DLG_SELECT_3D_MODELE_BASE
{ {
private: private:
MODULE_3D_SETTINGS* m_model; // data for the selected model FP_3DMODEL* m_model; // data for the selected model
S3D_CACHE* m_cache; // cache manager S3D_CACHE* m_cache; // cache manager
FILENAME_RESOLVER* m_resolver; // 3D filename resolver FILENAME_RESOLVER* m_resolver; // 3D filename resolver
wxString& m_previousDir; wxString& m_previousDir;
int& m_previousFilterIndex; int& m_previousFilterIndex;
@ -53,8 +53,8 @@ private:
void updateDirChoiceList( void ); void updateDirChoiceList( void );
public: public:
DLG_SELECT_3DMODEL( wxWindow* aParent, S3D_CACHE* aCacheManager, MODULE_3D_SETTINGS* aModelItem, DLG_SELECT_3DMODEL( wxWindow* aParent, S3D_CACHE* aCacheManager, FP_3DMODEL* aModelItem,
wxString& prevModelSelectDir, int& prevModelWildcard ); wxString& prevModelSelectDir, int& prevModelWildcard );
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
void OnSelectionChanged( wxCommandEvent& event )override; void OnSelectionChanged( wxCommandEvent& event )override;

View File

@ -41,8 +41,8 @@
#include <widgets/infobar.h> #include <widgets/infobar.h>
PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE* aModule, PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE* aFootprint,
std::vector<MODULE_3D_SETTINGS>* aParentModelList ) : std::vector<FP_3DMODEL>* aParentModelList ) :
PANEL_PREV_3D_BASE( aParent, wxID_ANY ), PANEL_PREV_3D_BASE( aParent, wxID_ANY ),
m_previewPane( nullptr ), m_previewPane( nullptr ),
m_infobar( nullptr ), m_infobar( nullptr ),
@ -86,8 +86,8 @@ PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE*
m_parentModelList = aParentModelList; m_parentModelList = aParentModelList;
m_dummyModule = new MODULE( *aModule ); m_dummyFootprint = new MODULE( *aFootprint );
m_dummyBoard->Add( m_dummyModule ); m_dummyBoard->Add( m_dummyFootprint );
// Create the infobar // Create the infobar
m_infobar = new WX_INFOBAR( this ); m_infobar = new WX_INFOBAR( this );
@ -228,7 +228,7 @@ void PANEL_PREV_3D::SetSelectedModel( int idx )
if( m_parentModelList && idx >= 0 && idx < (int) m_parentModelList->size() ) if( m_parentModelList && idx >= 0 && idx < (int) m_parentModelList->size() )
{ {
m_selected = idx; m_selected = idx;
const MODULE_3D_SETTINGS& modelInfo = m_parentModelList->at( (unsigned) m_selected ); const FP_3DMODEL& modelInfo = m_parentModelList->at( (unsigned) m_selected );
// Use ChangeValue() instead of SetValue(). It's not the user making the change, so we // Use ChangeValue() instead of SetValue(). It's not the user making the change, so we
// don't want to generate wxEVT_GRID_CELL_CHANGED events. // don't want to generate wxEVT_GRID_CELL_CHANGED events.
@ -273,7 +273,7 @@ void PANEL_PREV_3D::updateOrientation( wxCommandEvent &event )
if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() ) if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
{ {
// Write settings back to the parent // Write settings back to the parent
MODULE_3D_SETTINGS* modelInfo = &m_parentModelList->at( (unsigned) m_selected ); FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
modelInfo->m_Scale.x = DoubleValueFromString( EDA_UNITS::UNSCALED, xscale->GetValue() ); modelInfo->m_Scale.x = DoubleValueFromString( EDA_UNITS::UNSCALED, xscale->GetValue() );
modelInfo->m_Scale.y = DoubleValueFromString( EDA_UNITS::UNSCALED, yscale->GetValue() ); modelInfo->m_Scale.y = DoubleValueFromString( EDA_UNITS::UNSCALED, yscale->GetValue() );
@ -298,7 +298,7 @@ void PANEL_PREV_3D::onOpacitySlider( wxCommandEvent& event )
if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() ) if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
{ {
// Write settings back to the parent // Write settings back to the parent
MODULE_3D_SETTINGS* modelInfo = &m_parentModelList->at( (unsigned) m_selected ); FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
modelInfo->m_Opacity = m_opacity->GetValue() / 100.0; modelInfo->m_Opacity = m_opacity->GetValue() / 100.0;
@ -451,12 +451,12 @@ void PANEL_PREV_3D::onMouseWheelOffset( wxMouseEvent& event )
void PANEL_PREV_3D::UpdateDummyFootprint( bool aReloadRequired ) void PANEL_PREV_3D::UpdateDummyFootprint( bool aReloadRequired )
{ {
m_dummyModule->Models().clear(); m_dummyFootprint->Models().clear();
for( MODULE_3D_SETTINGS& model : *m_parentModelList) for( FP_3DMODEL& model : *m_parentModelList)
{ {
if( model.m_Show ) if( model.m_Show )
m_dummyModule->Models().push_back( model ); m_dummyFootprint->Models().push_back( model );
} }
if( aReloadRequired ) if( aReloadRequired )

View File

@ -74,23 +74,23 @@ class MODULE;
class PANEL_PREV_3D: public EDA_3D_BOARD_HOLDER, public TOOLS_HOLDER, public PANEL_PREV_3D_BASE class PANEL_PREV_3D: public EDA_3D_BOARD_HOLDER, public TOOLS_HOLDER, public PANEL_PREV_3D_BASE
{ {
public: public:
PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE* aModule, PANEL_PREV_3D( wxWindow* aParent, PCB_BASE_FRAME* aFrame, MODULE* aFootprint,
std::vector<MODULE_3D_SETTINGS>* aParentModelList ); std::vector<FP_3DMODEL>* aParentModelList );
~PANEL_PREV_3D(); ~PANEL_PREV_3D();
private: private:
EDA_3D_CANVAS* m_previewPane; EDA_3D_CANVAS* m_previewPane;
WX_INFOBAR* m_infobar; WX_INFOBAR* m_infobar;
BOARD_ADAPTER m_boardAdapter; BOARD_ADAPTER m_boardAdapter;
CCAMERA& m_currentCamera; CCAMERA& m_currentCamera;
CTRACK_BALL m_trackBallCamera; CTRACK_BALL m_trackBallCamera;
BOARD* m_dummyBoard; BOARD* m_dummyBoard;
MODULE* m_dummyModule; MODULE* m_dummyFootprint;
std::vector<MODULE_3D_SETTINGS>* m_parentModelList; std::vector<FP_3DMODEL>* m_parentModelList;
int m_selected; /// Index into m_parentInfoList int m_selected; /// Index into m_parentInfoList
EDA_UNITS m_userUnits; EDA_UNITS m_userUnits;

View File

@ -540,65 +540,50 @@ class BOARD_ADAPTER
void createNewTrack( const TRACK* aTrack, CGENERICCONTAINER2D *aDstContainer, void createNewTrack( const TRACK* aTrack, CGENERICCONTAINER2D *aDstContainer,
int aClearanceValue ); int aClearanceValue );
void createNewPadWithClearance( const PAD *aPad, void createNewPadWithClearance( const PAD *aPad, CGENERICCONTAINER2D *aDstContainer,
CGENERICCONTAINER2D *aDstContainer, PCB_LAYER_ID aLayer, wxSize aClearanceValue ) const;
PCB_LAYER_ID aLayer,
wxSize aClearanceValue ) const;
COBJECT2D *createNewPadDrill( const PAD* aPad, int aInflateValue ); COBJECT2D *createNewPadDrill( const PAD* aPad, int aInflateValue );
void AddPadsShapesWithClearanceToContainer( const MODULE *aModule, void AddPadsWithClearanceToContainer( const MODULE *aModule,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, PCB_LAYER_ID aLayerId, int aInflateValue,
int aInflateValue, bool aSkipNPTHPadsWihNoCopper, bool aSkipPlatedPads,
bool aSkipNPTHPadsWihNoCopper, bool aSkipNonPlatedPads );
bool aSkipPlatedPads,
bool aSkipNonPlatedPads );
void AddGraphicsShapesWithClearanceToContainer( const MODULE *aModule, void AddFPShapesWithClearanceToContainer( const MODULE *aModule,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, PCB_LAYER_ID aLayerId, int aInflateValue );
int aInflateValue );
void AddShapeWithClearanceToContainer( const PCB_TEXT *aText, void AddShapeWithClearanceToContainer( const PCB_TEXT *aText,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, PCB_LAYER_ID aLayerId, int aClearanceValue );
int aClearanceValue );
void AddShapeWithClearanceToContainer( const PCB_SHAPE *aShape, void AddShapeWithClearanceToContainer( const PCB_SHAPE *aShape,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, PCB_LAYER_ID aLayerId, int aClearanceValue );
int aClearanceValue );
void AddShapeWithClearanceToContainer( const DIMENSION_BASE *aDimension, void AddShapeWithClearanceToContainer( const DIMENSION_BASE *aDimension,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, PCB_LAYER_ID aLayerId, int aClearanceValue );
int aClearanceValue );
void AddSolidAreasShapesToContainer( const ZONE *aZoneContainer, void AddSolidAreasShapesToContainer( const ZONE *aZoneContainer,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId ); PCB_LAYER_ID aLayerId );
void TransformArcToSegments( const wxPoint &aCentre, void TransformArcToSegments( const wxPoint &aCentre, const wxPoint &aStart, double aArcAngle,
const wxPoint &aStart, int aCircleToSegmentsCount, int aWidth,
double aArcAngle, CGENERICCONTAINER2D *aDstContainer, const BOARD_ITEM &aBoardItem );
int aCircleToSegmentsCount,
int aWidth,
CGENERICCONTAINER2D *aDstContainer,
const BOARD_ITEM &aBoardItem );
void buildPadShapeThickOutlineAsSegments( const PAD *aPad, void buildPadShapeThickOutlineAsSegments( const PAD *aPad, CGENERICCONTAINER2D *aDstContainer,
CGENERICCONTAINER2D *aDstContainer,
int aWidth ); int aWidth );
// Helper functions to create poly contours // Helper functions to create poly contours
void buildPadShapeThickOutlineAsPolygon( const PAD *aPad, void buildPadShapeThickOutlineAsPolygon( const PAD *aPad, SHAPE_POLY_SET &aCornerBuffer,
SHAPE_POLY_SET &aCornerBuffer,
int aWidth) const; int aWidth) const;
void transformGraphicModuleEdgeToPolygonSet( const MODULE *aModule, void transformFPShapesToPolygon( const MODULE *aFootprint, PCB_LAYER_ID aLayer,
PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aCornerBuffer ) const;
SHAPE_POLY_SET& aCornerBuffer ) const;
public: public:
SFVEC4F m_BgColorBot; ///< background bottom color SFVEC4F m_BgColorBot; ///< background bottom color

View File

@ -183,12 +183,12 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const DIMENSION_BASE* aDim
// Based on // Based on
// void MODULE::TransformGraphicShapesWithClearanceToPolygonSet // void FOOTPRINT::TransformFPShapesWithClearanceToPolygonSet
// board_items_to_polygon_shape_transform.cpp#L204 // board_items_to_polygon_shape_transform.cpp#L204
void BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer( const MODULE* aModule, void BOARD_ADAPTER::AddFPShapesWithClearanceToContainer( const MODULE* aModule,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aInflateValue ) int aInflateValue )
{ {
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;
@ -473,13 +473,13 @@ COBJECT2D *BOARD_ADAPTER::createNewPadDrill( const PAD* aPad, int aInflateValue
} }
void BOARD_ADAPTER::AddPadsShapesWithClearanceToContainer( const MODULE* aModule, void BOARD_ADAPTER::AddPadsWithClearanceToContainer( const MODULE* aModule,
CGENERICCONTAINER2D *aDstContainer, CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
int aInflateValue, int aInflateValue,
bool aSkipNPTHPadsWihNoCopper, bool aSkipNPTHPadsWihNoCopper,
bool aSkipPlatedPads, bool aSkipPlatedPads,
bool aSkipNonPlatedPads ) bool aSkipNonPlatedPads )
{ {
for( PAD* pad : aModule->Pads() ) for( PAD* pad : aModule->Pads() )
{ {

View File

@ -553,11 +553,11 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{ {
// Note: NPTH pads are not drawn on copper layers when the pad // Note: NPTH pads are not drawn on copper layers when the pad
// has same shape as its hole // has same shape as its hole
AddPadsShapesWithClearanceToContainer( footprint, layerContainer, curr_layer_id, 0, AddPadsWithClearanceToContainer( footprint, layerContainer, curr_layer_id, 0,
true, renderPlatedPadsAsPlated, false ); true, renderPlatedPadsAsPlated, false );
// Micro-wave footprints may have items on copper layers // Micro-wave footprints may have items on copper layers
AddGraphicsShapesWithClearanceToContainer( footprint, layerContainer, curr_layer_id, 0 ); AddFPShapesWithClearanceToContainer( footprint, layerContainer, curr_layer_id, 0 );
} }
} }
@ -566,11 +566,11 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// ADD PLATED PADS // ADD PLATED PADS
for( MODULE* footprint : m_board->Footprints() ) for( MODULE* footprint : m_board->Footprints() )
{ {
AddPadsShapesWithClearanceToContainer( footprint, m_platedpads_container2D_F_Cu, F_Cu, AddPadsWithClearanceToContainer( footprint, m_platedpads_container2D_F_Cu, F_Cu,
0, true, false, true ); 0, true, false, true );
AddPadsShapesWithClearanceToContainer( footprint, m_platedpads_container2D_B_Cu, B_Cu, AddPadsWithClearanceToContainer( footprint, m_platedpads_container2D_B_Cu, B_Cu,
0, true, false, true ); 0, true, false, true );
} }
m_platedpads_container2D_F_Cu->BuildBVH(); m_platedpads_container2D_F_Cu->BuildBVH();
@ -592,12 +592,12 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
{ {
// Note: NPTH pads are not drawn on copper layers when the pad // Note: NPTH pads are not drawn on copper layers when the pad
// has same shape as its hole // has same shape as its hole
footprint->TransformPadsShapesWithClearanceToPolygon( *layerPoly, curr_layer_id, footprint->TransformPadsWithClearanceToPolygon( *layerPoly, curr_layer_id,
0, ARC_HIGH_DEF, ERROR_INSIDE, 0, ARC_HIGH_DEF, ERROR_INSIDE,
true, renderPlatedPadsAsPlated, true, renderPlatedPadsAsPlated,
false ); false );
transformGraphicModuleEdgeToPolygonSet( footprint, curr_layer_id, *layerPoly ); transformFPShapesToPolygon( footprint, curr_layer_id, *layerPoly );
} }
} }
@ -606,17 +606,17 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// ADD PLATED PADS contourns // ADD PLATED PADS contourns
for( MODULE* footprint : m_board->Footprints() ) for( MODULE* footprint : m_board->Footprints() )
{ {
footprint->TransformPadsShapesWithClearanceToPolygon( *m_F_Cu_PlatedPads_poly, F_Cu, footprint->TransformPadsWithClearanceToPolygon( *m_F_Cu_PlatedPads_poly, F_Cu,
0, ARC_HIGH_DEF, ERROR_INSIDE, 0, ARC_HIGH_DEF, ERROR_INSIDE,
true, false, true ); true, false, true );
//transformGraphicModuleEdgeToPolygonSet( module, F_Cu, *m_F_Cu_PlatedPads_poly ); //transformFPShapesToPolygon( footprint, F_Cu, *m_F_Cu_PlatedPads_poly );
footprint->TransformPadsShapesWithClearanceToPolygon( *m_B_Cu_PlatedPads_poly, B_Cu, footprint->TransformPadsWithClearanceToPolygon( *m_B_Cu_PlatedPads_poly, B_Cu,
0, ARC_HIGH_DEF, ERROR_INSIDE, 0, ARC_HIGH_DEF, ERROR_INSIDE,
true, false, true ); true, false, true );
//transformGraphicModuleEdgeToPolygonSet( module, B_Cu, *m_B_Cu_PlatedPads_poly ); //transformFPShapesToPolygon( footprint, B_Cu, *m_B_Cu_PlatedPads_poly );
} }
} }
} }
@ -638,28 +638,25 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_SHAPE_T: case PCB_SHAPE_T:
{ AddShapeWithClearanceToContainer( static_cast<PCB_SHAPE*>( item ), layerContainer,
AddShapeWithClearanceToContainer( (PCB_SHAPE*)item, layerContainer, curr_layer_id, curr_layer_id, 0 );
0 );
}
break; break;
case PCB_TEXT_T: case PCB_TEXT_T:
AddShapeWithClearanceToContainer( (PCB_TEXT*) item, layerContainer, curr_layer_id, AddShapeWithClearanceToContainer( static_cast<PCB_TEXT*>( item ), layerContainer,
0 ); curr_layer_id, 0 );
break; break;
case PCB_DIM_ALIGNED_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T: case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T: case PCB_DIM_LEADER_T:
AddShapeWithClearanceToContainer( (DIMENSION_BASE*) item, layerContainer, AddShapeWithClearanceToContainer( static_cast<DIMENSION_BASE*>( item ),
curr_layer_id, 0 ); layerContainer, curr_layer_id, 0 );
break; break;
default: default:
wxLogTrace( m_logTrace, wxLogTrace( m_logTrace, wxT( "createLayers: item type: %d not implemented" ),
wxT( "createLayers: item type: %d not implemented" ),
item->Type() ); item->Type() );
break; break;
} }
@ -685,16 +682,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_SHAPE_T: case PCB_SHAPE_T:
( (PCB_SHAPE*) item )->TransformShapeWithClearanceToPolygon( *layerPoly,
cur_layer_id, 0,
ARC_HIGH_DEF,
ERROR_INSIDE );
break;
case PCB_TEXT_T: case PCB_TEXT_T:
( (PCB_TEXT*) item )->TransformShapeWithClearanceToPolygonSet( *layerPoly, 0, item->TransformShapeWithClearanceToPolygon( *layerPoly, cur_layer_id, 0,
ARC_HIGH_DEF, ARC_HIGH_DEF, ERROR_INSIDE );
ERROR_INSIDE );
break; break;
default: default:
@ -974,16 +964,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_SHAPE_T: case PCB_SHAPE_T:
( (PCB_SHAPE*) item )->TransformShapeWithClearanceToPolygon( *layerPoly,
curr_layer_id, 0,
ARC_HIGH_DEF,
ERROR_INSIDE );
break;
case PCB_TEXT_T: case PCB_TEXT_T:
( (PCB_TEXT*) item )->TransformShapeWithClearanceToPolygonSet( *layerPoly, 0, item->TransformShapeWithClearanceToPolygon( *layerPoly, curr_layer_id, 0,
ARC_HIGH_DEF, ARC_HIGH_DEF, ERROR_INSIDE );
ERROR_INSIDE );
break; break;
default: default:
@ -994,13 +977,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// Add footprints tech layers - objects // Add footprints tech layers - objects
// ///////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////
for( MODULE* module : m_board->Footprints() ) for( MODULE* footprint : m_board->Footprints() )
{ {
if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) ) if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) )
{ {
int linewidth = g_DrawDefaultLineThickness; int linewidth = g_DrawDefaultLineThickness;
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
if( !pad->IsOnLayer( curr_layer_id ) ) if( !pad->IsOnLayer( curr_layer_id ) )
continue; continue;
@ -1010,24 +993,22 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
else else
{ {
AddPadsShapesWithClearanceToContainer( module, layerContainer, curr_layer_id, 0, AddPadsWithClearanceToContainer( footprint, layerContainer, curr_layer_id, 0,
false, false, false, false );
false,
false );
} }
AddGraphicsShapesWithClearanceToContainer( module, layerContainer, curr_layer_id, 0 ); AddFPShapesWithClearanceToContainer( footprint, layerContainer, curr_layer_id, 0 );
} }
// Add footprints tech layers - contours // Add footprints tech layers - contours
for( MODULE* module : m_board->Footprints() ) for( MODULE* footprint : m_board->Footprints() )
{ {
if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) ) if( (curr_layer_id == F_SilkS) || (curr_layer_id == B_SilkS) )
{ {
const int linewidth = g_DrawDefaultLineThickness; const int linewidth = g_DrawDefaultLineThickness;
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
if( !pad->IsOnLayer( curr_layer_id ) ) if( !pad->IsOnLayer( curr_layer_id ) )
continue; continue;
@ -1037,16 +1018,16 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
else else
{ {
module->TransformPadsShapesWithClearanceToPolygon( *layerPoly, curr_layer_id, 0, footprint->TransformPadsWithClearanceToPolygon( *layerPoly, curr_layer_id, 0,
ARC_HIGH_DEF, ERROR_INSIDE ); ARC_HIGH_DEF, ERROR_INSIDE );
} }
// On tech layers, use a poor circle approximation, only for texts (stroke font) // On tech layers, use a poor circle approximation, only for texts (stroke font)
module->TransformGraphicTextWithClearanceToPolygonSet( *layerPoly, curr_layer_id, 0, footprint->TransformFPTextWithClearanceToPolygonSet( *layerPoly, curr_layer_id, 0,
ARC_HIGH_DEF, ERROR_INSIDE ); ARC_HIGH_DEF, ERROR_INSIDE );
// Add the remaining things with dynamic seg count for circles // Add the remaining things with dynamic seg count for circles
transformGraphicModuleEdgeToPolygonSet( module, curr_layer_id, *layerPoly ); transformFPShapesToPolygon( footprint, curr_layer_id, *layerPoly );
} }

View File

@ -60,11 +60,10 @@ void BOARD_ADAPTER::buildPadShapeThickOutlineAsPolygon( const PAD* aPad,
} }
void BOARD_ADAPTER::transformGraphicModuleEdgeToPolygonSet( const MODULE *aModule, void BOARD_ADAPTER::transformFPShapesToPolygon( const MODULE *aFootprint, PCB_LAYER_ID aLayer,
PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aCornerBuffer ) const
SHAPE_POLY_SET& aCornerBuffer ) const
{ {
for( BOARD_ITEM* item : aModule->GraphicalItems() ) for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
{ {
if( item->Type() == PCB_FP_SHAPE_T ) if( item->Type() == PCB_FP_SHAPE_T )
{ {

View File

@ -749,27 +749,24 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent &event )
{ {
case PCB_PAD_T: case PCB_PAD_T:
{ {
PAD* item = dynamic_cast<PAD *>( intersectedBoardItem ); PAD* pad = dynamic_cast<PAD*>( intersectedBoardItem );
if( item ) if( pad && pad->IsOnCopperLayer() )
{ {
if( item->IsOnCopperLayer() ) activityReporter.Report( wxString::Format( _( "Net %s\tNetClass %s\tPadName %s" ),
activityReporter.Report( wxString::Format( _( "Net %s\tNetClass %s\tPadName %s" ), pad->GetNet()->GetNetname(),
item->GetNet()->GetNetname(), pad->GetNet()->GetClassName(),
item->GetNet()->GetClassName(), pad->GetName() ) );
item->GetName() ) );
} }
} }
break; break;
case PCB_MODULE_T: case PCB_MODULE_T:
{ {
MODULE* module = dynamic_cast<MODULE *>( intersectedBoardItem ); MODULE* footprint = dynamic_cast<MODULE *>( intersectedBoardItem );
if( module ) if( footprint )
{ activityReporter.Report( footprint->GetReference() );
activityReporter.Report( module->GetReference() );
}
} }
break; break;
@ -777,27 +774,26 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent &event )
case PCB_VIA_T: case PCB_VIA_T:
case PCB_ARC_T: case PCB_ARC_T:
{ {
TRACK* item = dynamic_cast<TRACK *>( intersectedBoardItem ); TRACK* track = dynamic_cast<TRACK *>( intersectedBoardItem );
if( item ) if( track )
{ {
activityReporter.Report( wxString::Format( _( "Net %s\tNetClass %s" ), activityReporter.Report( wxString::Format( _( "Net %s\tNetClass %s" ),
item->GetNet()->GetNetname(), track->GetNet()->GetNetname(),
item->GetNet()->GetClassName() ) ); track->GetNet()->GetClassName() ) );
} }
} }
break; break;
case PCB_ZONE_T: case PCB_ZONE_T:
{ {
ZONE* item = dynamic_cast<ZONE*>( intersectedBoardItem ); ZONE* zone = dynamic_cast<ZONE*>( intersectedBoardItem );
if( item ) if( zone && zone->IsOnCopperLayer() )
{ {
if( item->IsOnCopperLayer() ) activityReporter.Report( wxString::Format( _( "Net %s\tNetClass %s" ),
activityReporter.Report( wxString::Format( _( "Net %s\tNetClass %s" ), zone->GetNet()->GetNetname(),
item->GetNet()->GetNetname(), zone->GetNet()->GetClassName() ) );
item->GetNet()->GetClassName() ) );
} }
} }
break; break;

View File

@ -967,7 +967,7 @@ void C3D_RENDER_OGL_LEGACY::load_3D_models( REPORTER* aStatusReporter )
// Go for all footprints // Go for all footprints
for( MODULE* footprint : m_boardAdapter.GetBoard()->Footprints() ) for( MODULE* footprint : m_boardAdapter.GetBoard()->Footprints() )
{ {
for( const MODULE_3D_SETTINGS& model : footprint->Models() ) for( const FP_3DMODEL& model : footprint->Models() )
{ {
if( model.m_Show && !model.m_Filename.empty() ) if( model.m_Show && !model.m_Filename.empty() )
{ {

View File

@ -1351,7 +1351,7 @@ void C3D_RENDER_OGL_LEGACY::render_3D_module( const MODULE* module,
modelunit_to_3d_units_factor ); modelunit_to_3d_units_factor );
// Get the list of model files for this model // Get the list of model files for this model
for( const MODULE_3D_SETTINGS& sM : module->Models() ) for( const FP_3DMODEL& sM : module->Models() )
{ {
if( !sM.m_Show || sM.m_Filename.empty() ) if( !sM.m_Show || sM.m_Filename.empty() )
continue; continue;

View File

@ -79,12 +79,12 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_
// convert pads // convert pads
for( MODULE* footprint : m_footprints ) for( MODULE* footprint : m_footprints )
{ {
footprint->TransformPadsShapesWithClearanceToPolygon( aOutlines, aLayer, 0, maxError, footprint->TransformPadsWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE ); ERROR_INSIDE );
// Micro-wave footprints may have items on copper layers // Micro-wave footprints may have items on copper layers
footprint->TransformGraphicShapesWithClearanceToPolygonSet( aOutlines, aLayer, 0, maxError, footprint->TransformFPShapesWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE ); ERROR_INSIDE );
} }
// convert copper zones // convert copper zones
@ -113,7 +113,8 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_
case PCB_TEXT_T: case PCB_TEXT_T:
{ {
PCB_TEXT* text = static_cast<PCB_TEXT*>( item ); PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
text->TransformShapeWithClearanceToPolygonSet( aOutlines, 0, maxError, ERROR_INSIDE ); text->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
} }
break; break;
@ -124,12 +125,12 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_
} }
void MODULE::TransformPadsShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, void MODULE::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance, PCB_LAYER_ID aLayer, int aClearance,
int aMaxError, ERROR_LOC aErrorLoc, int aMaxError, ERROR_LOC aErrorLoc,
bool aSkipNPTHPadsWihNoCopper, bool aSkipNPTHPadsWihNoCopper,
bool aSkipPlatedPads, bool aSkipPlatedPads,
bool aSkipNonPlatedPads ) const bool aSkipNonPlatedPads ) const
{ {
for( PAD* pad : m_pads ) for( PAD* pad : m_pads )
{ {
@ -222,11 +223,11 @@ void MODULE::TransformPadsShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerB
* @aIncludeText = indicates footprint text items (reference, value, etc.) should be included * @aIncludeText = indicates footprint text items (reference, value, etc.) should be included
* in the outline * in the outline
*/ */
void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( SHAPE_POLY_SET& aCornerBuffer, void MODULE::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc, int aError, ERROR_LOC aErrorLoc,
bool aIncludeText, bool aIncludeText,
bool aIncludeEdges ) const bool aIncludeEdges ) const
{ {
std::vector<FP_TEXT*> texts; // List of FP_TEXT to convert std::vector<FP_TEXT*> texts; // List of FP_TEXT to convert
@ -346,15 +347,16 @@ void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCorn
/** /**
* Function TransformShapeWithClearanceToPolygonSet * Function TransformShapeWithClearanceToPolygon
* Convert the text shape to a set of polygons (one per segment). * Convert the text shape to a set of polygons (one per segment).
* @aCornerBuffer = SHAPE_POLY_SET to store the polygon corners * @aCornerBuffer = SHAPE_POLY_SET to store the polygon corners
* @aClearanceValue = the clearance around the text * @aClearanceValue = the clearance around the text
* @aError = the maximum error to allow when approximating curves * @aError = the maximum error to allow when approximating curves
*/ */
void PCB_TEXT::TransformShapeWithClearanceToPolygonSet( SHAPE_POLY_SET& aCornerBuffer, void PCB_TEXT::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
int aClearanceValue, PCB_LAYER_ID aLayer, int aClearanceValue,
int aError, ERROR_LOC aErrorLoc ) const int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth ) const
{ {
wxSize size = GetTextSize(); wxSize size = GetTextSize();

View File

@ -52,7 +52,7 @@ int DIALOG_FOOTPRINT_FP_EDITOR::m_page = 0; // remember the last open page d
DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aParent, DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aParent,
MODULE* aModule ) : MODULE* aFootprint ) :
DIALOG_FOOTPRINT_FP_EDITOR_BASE( aParent ), DIALOG_FOOTPRINT_FP_EDITOR_BASE( aParent ),
m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits, true ), m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits, true ),
m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl, m_SolderMaskMarginUnits ), m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl, m_SolderMaskMarginUnits ),
@ -60,7 +60,7 @@ DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aP
m_inSelect( false ) m_inSelect( false )
{ {
m_frame = aParent; m_frame = aParent;
m_footprint = aModule; m_footprint = aFootprint;
m_texts = new TEXT_MOD_GRID_TABLE( m_units, m_frame ); m_texts = new TEXT_MOD_GRID_TABLE( m_units, m_frame );
@ -298,7 +298,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow()
wxString origPath, alias, shortPath; wxString origPath, alias, shortPath;
FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver(); FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
for( const MODULE_3D_SETTINGS& model : m_footprint->Models() ) for( const FP_3DMODEL& model : m_footprint->Models() )
{ {
m_shapes3D_list.push_back( model ); m_shapes3D_list.push_back( model );
origPath = model.m_Filename; origPath = model.m_Filename;
@ -434,8 +434,8 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel( wxCommandEvent& )
int selected = m_modelsGrid->GetGridCursorRow(); int selected = m_modelsGrid->GetGridCursorRow();
PROJECT& prj = Prj(); PROJECT& prj = Prj();
MODULE_3D_SETTINGS model; FP_3DMODEL model;
wxString initialpath = prj.GetRString( PROJECT::VIEWER_3D_PATH ); wxString initialpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
wxString sidx = prj.GetRString( PROJECT::VIEWER_3D_FILTER_INDEX ); wxString sidx = prj.GetRString( PROJECT::VIEWER_3D_FILTER_INDEX );
@ -499,7 +499,7 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DRow( wxCommandEvent& )
if( !m_modelsGrid->CommitPendingChanges() ) if( !m_modelsGrid->CommitPendingChanges() )
return; return;
MODULE_3D_SETTINGS model; FP_3DMODEL model;
model.m_Show = true; model.m_Show = true;
m_shapes3D_list.push_back( model ); m_shapes3D_list.push_back( model );
@ -697,7 +697,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow()
case 3: m_footprint->SetZoneConnection( ZONE_CONNECTION::NONE ); break; case 3: m_footprint->SetZoneConnection( ZONE_CONNECTION::NONE ); break;
} }
std::list<MODULE_3D_SETTINGS>* draw3D = &m_footprint->Models(); std::list<FP_3DMODEL>* draw3D = &m_footprint->Models();
draw3D->clear(); draw3D->clear();
draw3D->insert( draw3D->end(), m_shapes3D_list.begin(), m_shapes3D_list.end() ); draw3D->insert( draw3D->end(), m_shapes3D_list.begin(), m_shapes3D_list.end() );

View File

@ -39,33 +39,33 @@ class FOOTPRINT_EDIT_FRAME;
class DIALOG_FOOTPRINT_FP_EDITOR : public DIALOG_FOOTPRINT_FP_EDITOR_BASE class DIALOG_FOOTPRINT_FP_EDITOR : public DIALOG_FOOTPRINT_FP_EDITOR_BASE
{ {
private: private:
FOOTPRINT_EDIT_FRAME* m_frame; FOOTPRINT_EDIT_FRAME* m_frame;
MODULE* m_footprint; MODULE* m_footprint;
static int m_page; // remember the last open page during session static int m_page; // remember the last open page during session
TEXT_MOD_GRID_TABLE* m_texts; TEXT_MOD_GRID_TABLE* m_texts;
UNIT_BINDER m_netClearance; UNIT_BINDER m_netClearance;
UNIT_BINDER m_solderMask; UNIT_BINDER m_solderMask;
UNIT_BINDER m_solderPaste; UNIT_BINDER m_solderPaste;
std::vector<MODULE_3D_SETTINGS> m_shapes3D_list; std::vector<FP_3DMODEL> m_shapes3D_list;
PANEL_PREV_3D* m_PreviewPane; PANEL_PREV_3D* m_PreviewPane;
wxControl* m_delayedFocusCtrl; wxControl* m_delayedFocusCtrl;
int m_delayedFocusPage; int m_delayedFocusPage;
WX_GRID* m_delayedFocusGrid; WX_GRID* m_delayedFocusGrid;
int m_delayedFocusRow; int m_delayedFocusRow;
int m_delayedFocusColumn; int m_delayedFocusColumn;
wxString m_delayedErrorMessage; wxString m_delayedErrorMessage;
bool m_inSelect; bool m_inSelect;
public: public:
// Constructor and destructor // Constructor and destructor
DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aParent, MODULE* aModule ); DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aParent, MODULE* aFootprint );
~DIALOG_FOOTPRINT_FP_EDITOR() override; ~DIALOG_FOOTPRINT_FP_EDITOR() override;
bool Validate() override; bool Validate() override;

View File

@ -364,7 +364,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
wxString origPath, alias, shortPath; wxString origPath, alias, shortPath;
FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver(); FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
for( const MODULE_3D_SETTINGS& model : m_footprint->Models() ) for( const FP_3DMODEL& model : m_footprint->Models() )
{ {
m_shapes3D_list.push_back( model ); m_shapes3D_list.push_back( model );
origPath = model.m_Filename; origPath = model.m_Filename;
@ -503,8 +503,8 @@ void DIALOG_FOOTPRINT_PROPERTIES::OnAdd3DModel( wxCommandEvent& )
int selected = m_modelsGrid->GetGridCursorRow(); int selected = m_modelsGrid->GetGridCursorRow();
PROJECT& prj = Prj(); PROJECT& prj = Prj();
MODULE_3D_SETTINGS model; FP_3DMODEL model;
wxString initialpath = prj.GetRString( PROJECT::VIEWER_3D_PATH ); wxString initialpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
wxString sidx = prj.GetRString( PROJECT::VIEWER_3D_FILTER_INDEX ); wxString sidx = prj.GetRString( PROJECT::VIEWER_3D_FILTER_INDEX );
@ -568,7 +568,7 @@ void DIALOG_FOOTPRINT_PROPERTIES::OnAdd3DRow( wxCommandEvent& )
if( !m_modelsGrid->CommitPendingChanges() ) if( !m_modelsGrid->CommitPendingChanges() )
return; return;
MODULE_3D_SETTINGS model; FP_3DMODEL model;
model.m_Show = true; model.m_Show = true;
m_shapes3D_list.push_back( model ); m_shapes3D_list.push_back( model );
@ -747,7 +747,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
if( change_layer ) if( change_layer )
m_footprint->Flip( m_footprint->GetPosition(), m_frame->Settings().m_FlipLeftRight ); m_footprint->Flip( m_footprint->GetPosition(), m_frame->Settings().m_FlipLeftRight );
std::list<MODULE_3D_SETTINGS>* draw3D = &m_footprint->Models(); std::list<FP_3DMODEL>* draw3D = &m_footprint->Models();
draw3D->clear(); draw3D->clear();
draw3D->insert( draw3D->end(), m_shapes3D_list.begin(), m_shapes3D_list.end() ); draw3D->insert( draw3D->end(), m_shapes3D_list.begin(), m_shapes3D_list.end() );

View File

@ -56,7 +56,7 @@ private:
UNIT_BINDER m_solderMask; UNIT_BINDER m_solderMask;
UNIT_BINDER m_solderPaste; UNIT_BINDER m_solderPaste;
std::vector<MODULE_3D_SETTINGS> m_shapes3D_list; std::vector<FP_3DMODEL> m_shapes3D_list;
PANEL_PREV_3D* m_PreviewPane; PANEL_PREV_3D* m_PreviewPane;
wxString m_delayedErrorMessage; wxString m_delayedErrorMessage;

View File

@ -942,7 +942,7 @@ unsigned MODULE::GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH ) const
} }
void MODULE::Add3DModel( MODULE_3D_SETTINGS* a3DModel ) void MODULE::Add3DModel( FP_3DMODEL* a3DModel )
{ {
if( NULL == a3DModel ) if( NULL == a3DModel )
return; return;

View File

@ -22,8 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef MODULE_H_ #ifndef FOOTPRINT_H
#define MODULE_H_ #define FOOTPRINT_H
#include <deque> #include <deque>
@ -72,10 +72,10 @@ enum MODULE_ATTR_T
MOD_BOARD_ONLY = 0x0010 // Footprint has no corresponding symbol MOD_BOARD_ONLY = 0x0010 // Footprint has no corresponding symbol
}; };
class MODULE_3D_SETTINGS class FP_3DMODEL
{ {
public: public:
MODULE_3D_SETTINGS() : FP_3DMODEL() :
// Initialize with sensible values // Initialize with sensible values
m_Scale { 1, 1, 1 }, m_Scale { 1, 1, 1 },
m_Rotation { 0, 0, 0 }, m_Rotation { 0, 0, 0 },
@ -192,8 +192,8 @@ public:
bool HasThroughHolePads() const; bool HasThroughHolePads() const;
std::list<MODULE_3D_SETTINGS>& Models() { return m_3D_Drawings; } std::list<FP_3DMODEL>& Models() { return m_3D_Drawings; }
const std::list<MODULE_3D_SETTINGS>& Models() const { return m_3D_Drawings; } const std::list<FP_3DMODEL>& Models() const { return m_3D_Drawings; }
void SetPosition( const wxPoint& aPos ) override; void SetPosition( const wxPoint& aPos ) override;
wxPoint GetPosition() const override { return m_Pos; } wxPoint GetPosition() const override { return m_Pos; }
@ -357,15 +357,15 @@ public:
* @param aSkipPlatedPads = used on 3D-Viewer to extract plated and nontplated pads. * @param aSkipPlatedPads = used on 3D-Viewer to extract plated and nontplated pads.
* @param aSkipNonPlatedPads = used on 3D-Viewer to extract plated and plated pads. * @param aSkipNonPlatedPads = used on 3D-Viewer to extract plated and plated pads.
*/ */
void TransformPadsShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, void TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer,int aClearance, PCB_LAYER_ID aLayer, int aClearance,
int aMaxError, ERROR_LOC aErrorLoc, int aMaxError, ERROR_LOC aErrorLoc,
bool aSkipNPTHPadsWihNoCopper = false, bool aSkipNPTHPadsWihNoCopper = false,
bool aSkipPlatedPads = false, bool aSkipPlatedPads = false,
bool aSkipNonPlatedPads = false ) const; bool aSkipNonPlatedPads = false ) const;
/** /**
* function TransformGraphicShapesWithClearanceToPolygonSet * function TransformFPShapesWithClearanceToPolygon
* generate shapes of graphic items (outlines) on layer aLayer as polygons and adds these * generate shapes of graphic items (outlines) on layer aLayer as polygons and adds these
* polygons to aCornerBuffer * polygons to aCornerBuffer
* Useful to generate a polygonal representation of a footprint in 3D view and plot functions, * Useful to generate a polygonal representation of a footprint in 3D view and plot functions,
@ -377,23 +377,23 @@ public:
* @param aIncludeText = True to transform text shapes * @param aIncludeText = True to transform text shapes
* @param aIncludeEdges = True to transform module shapes * @param aIncludeEdges = True to transform module shapes
*/ */
void TransformGraphicShapesWithClearanceToPolygonSet( SHAPE_POLY_SET& aCornerBuffer, void TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc, int aError, ERROR_LOC aErrorLoc,
bool aIncludeText = true, bool aIncludeText = true,
bool aIncludeEdges = true ) const; bool aIncludeEdges = true ) const;
/** /**
* @brief TransformGraphicTextWithClearanceToPolygonSet * @brief TransformFPTextWithClearanceToPolygonSet
* This function is the same as TransformGraphicShapesWithClearanceToPolygonSet * This function is the same as TransformGraphicShapesWithClearanceToPolygonSet
* but only generate text * but only generate text
*/ */
void TransformGraphicTextWithClearanceToPolygonSet( SHAPE_POLY_SET& aCornerBuffer, void TransformFPTextWithClearanceToPolygonSet( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance, PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc ) const int aError, ERROR_LOC aErrorLoc ) const
{ {
TransformGraphicShapesWithClearanceToPolygonSet( aCornerBuffer, aLayer, aClearance, TransformFPShapesWithClearanceToPolygon( aCornerBuffer, aLayer, aClearance, aError,
aError, aErrorLoc, true, false ); aErrorLoc, true, false );
} }
/** /**
@ -567,9 +567,9 @@ public:
* Function Add3DModel * Function Add3DModel
* adds \a a3DModel definition to the end of the 3D model list. * adds \a a3DModel definition to the end of the 3D model list.
* *
* @param a3DModel A pointer to a #MODULE_3D_SETTINGS to add to the list. * @param a3DModel A pointer to a #FP_3DMODEL to add to the list.
*/ */
void Add3DModel( MODULE_3D_SETTINGS* a3DModel ); void Add3DModel( FP_3DMODEL* a3DModel );
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
@ -722,7 +722,7 @@ private:
int m_CntRot90; // Horizontal automatic placement cost ( 0..10 ). int m_CntRot90; // Horizontal automatic placement cost ( 0..10 ).
int m_CntRot180; // Vertical automatic placement cost ( 0..10 ). int m_CntRot180; // Vertical automatic placement cost ( 0..10 ).
std::list<MODULE_3D_SETTINGS> m_3D_Drawings; // Linked list of 3D models. std::list<FP_3DMODEL> m_3D_Drawings; // Linked list of 3D models.
std::map<wxString, wxString> m_properties; std::map<wxString, wxString> m_properties;
wxArrayString* m_initial_comments; // s-expression comments in the module, wxArrayString* m_initial_comments; // s-expression comments in the module,
// lazily allocated only if needed for speed // lazily allocated only if needed for speed
@ -731,4 +731,4 @@ private:
SHAPE_POLY_SET m_poly_courtyard_back; // courtyards populated. SHAPE_POLY_SET m_poly_courtyard_back; // courtyards populated.
}; };
#endif // MODULE_H_ #endif // FOOTPRINT_H

View File

@ -33,7 +33,7 @@ MODULE* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprintSha
{ {
int oX; int oX;
PAD* pad; PAD* pad;
MODULE* module; MODULE* footprint;
wxString msg, cmp_name; wxString msg, cmp_name;
int pad_count = 2; int pad_count = 2;
int angle = 0; int angle = 0;
@ -74,7 +74,7 @@ MODULE* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprintSha
} }
wxString value = StringFromValue( editFrame.GetUserUnits(), gap_size ); wxString value = StringFromValue( editFrame.GetUserUnits(), gap_size );
WX_TEXT_ENTRY_DIALOG dlg( &editFrame, msg, _( "Create microwave module" ), value ); WX_TEXT_ENTRY_DIALOG dlg( &editFrame, msg, _( "Create microwave footprint" ), value );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return NULL; // cancelled by user return NULL; // cancelled by user
@ -89,7 +89,7 @@ MODULE* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprintSha
double fcoeff = 10.0, fval; double fcoeff = 10.0, fval;
msg.Printf( wxT( "%3.1f" ), angle / fcoeff ); msg.Printf( wxT( "%3.1f" ), angle / fcoeff );
WX_TEXT_ENTRY_DIALOG angledlg( &editFrame, _( "Angle in degrees:" ), WX_TEXT_ENTRY_DIALOG angledlg( &editFrame, _( "Angle in degrees:" ),
_( "Create microwave module" ), msg ); _( "Create microwave footprint" ), msg );
if( angledlg.ShowModal() != wxID_OK ) if( angledlg.ShowModal() != wxID_OK )
return NULL; // cancelled by user return NULL; // cancelled by user
@ -111,8 +111,8 @@ MODULE* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprintSha
if( abort ) if( abort )
return NULL; return NULL;
module = createBaseFootprint( cmp_name, text_size, pad_count ); footprint = createBaseFootprint( cmp_name, text_size, pad_count );
auto it = module->Pads().begin(); auto it = footprint->Pads().begin();
pad = *it; pad = *it;
switch( aFootprintShape ) switch( aFootprintShape )
@ -173,11 +173,11 @@ MODULE* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprintSha
break; break;
} }
// Update the module and board // Update the footprint and board
module->CalculateBoundingBox(); footprint->CalculateBoundingBox();
editFrame.OnModify(); editFrame.OnModify();
return module; return footprint;
} }

View File

@ -303,11 +303,10 @@ void MICROWAVE_TOOL::createInductorBetween( const VECTOR2I& aStart, const VECTOR
wxString errorMessage; wxString errorMessage;
auto inductorModule = std::unique_ptr<MODULE>( createMicrowaveInductor( pattern, auto inductorFP = std::unique_ptr<MODULE>( createMicrowaveInductor( pattern, errorMessage ) );
errorMessage ) );
// on any error, report if we can // on any error, report if we can
if ( !inductorModule || !errorMessage.IsEmpty() ) if ( !inductorFP || !errorMessage.IsEmpty() )
{ {
if ( !errorMessage.IsEmpty() ) if ( !errorMessage.IsEmpty() )
editFrame.ShowInfoBarError( errorMessage ); editFrame.ShowInfoBarError( errorMessage );
@ -315,10 +314,10 @@ void MICROWAVE_TOOL::createInductorBetween( const VECTOR2I& aStart, const VECTOR
else else
{ {
// at this point, we can save the module // at this point, we can save the module
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, inductorModule.get() ); m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, inductorFP.get() );
BOARD_COMMIT commit( this ); BOARD_COMMIT commit( this );
commit.Add( inductorModule.release() ); commit.Add( inductorFP.release() );
commit.Push( _("Add microwave inductor" ) ); commit.Push( _("Add microwave inductor" ) );
} }
} }

View File

@ -242,7 +242,7 @@ MODULE* MICROWAVE_TOOL::createPolygonShape()
{ {
PAD* pad1; PAD* pad1;
PAD* pad2; PAD* pad2;
MODULE* module; MODULE* footprint;
wxString cmp_name; wxString cmp_name;
int pad_count = 2; int pad_count = 2;
FP_SHAPE* shape; FP_SHAPE* shape;
@ -280,13 +280,13 @@ MODULE* MICROWAVE_TOOL::createPolygonShape()
cmp_name = wxT( "muwave_polygon" ); cmp_name = wxT( "muwave_polygon" );
// Create a footprint with 2 pads, orientation = 0, pos 0 // Create a footprint with 2 pads, orientation = 0, pos 0
module = createBaseFootprint( cmp_name, 0, pad_count ); footprint = createBaseFootprint( cmp_name, 0, pad_count );
// We try to place the footprint anchor to the middle of the shape len // We try to place the footprint anchor to the middle of the shape len
wxPoint offset; wxPoint offset;
offset.x = -ShapeSize.x / 2; offset.x = -ShapeSize.x / 2;
auto it = module->Pads().begin(); auto it = footprint->Pads().begin();
pad1 = *it; pad1 = *it;
pad1->SetX0( offset.x ); pad1->SetX0( offset.x );
@ -297,11 +297,11 @@ MODULE* MICROWAVE_TOOL::createPolygonShape()
pad2->SetX( pad2->GetPos0().x ); pad2->SetX( pad2->GetPos0().x );
// Add a polygonal edge (corners will be added later) on copper layer // Add a polygonal edge (corners will be added later) on copper layer
shape = new FP_SHAPE( module ); shape = new FP_SHAPE( footprint );
shape->SetShape( S_POLYGON ); shape->SetShape( S_POLYGON );
shape->SetLayer( F_Cu ); shape->SetLayer( F_Cu );
module->Add( shape, ADD_MODE::INSERT ); footprint->Add( shape, ADD_MODE::INSERT );
// Get the corner buffer of the polygonal edge // Get the corner buffer of the polygonal edge
std::vector<wxPoint> polyPoints; std::vector<wxPoint> polyPoints;
@ -346,7 +346,7 @@ MODULE* MICROWAVE_TOOL::createPolygonShape()
shape->SetWidth( 0 ); shape->SetWidth( 0 );
PolyEdges.clear(); PolyEdges.clear();
module->CalculateBoundingBox(); footprint->CalculateBoundingBox();
editFrame.OnModify(); editFrame.OnModify();
return module; return footprint;
} }

View File

@ -218,9 +218,9 @@ void NETINFO_MAPPING::Update()
nets.insert( track->GetNetCode() ); nets.insert( track->GetNetCode() );
// footprints/pads // footprints/pads
for( MODULE* module : m_board->Footprints() ) for( MODULE* footprint : m_board->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
nets.insert( pad->GetNetCode() ); nets.insert( pad->GetNetCode() );
} }

View File

@ -111,16 +111,17 @@ public:
} }
/** /**
* Function TransformShapeWithClearanceToPolygonSet * Function TransformShapeWithClearanceToPolygon
* Convert the text shape to a set of polygons (one by segment) * Convert the text shape to a set of polygons (one by segment)
* Used in 3D viewer * Used in 3D viewer
* Circles and arcs are approximated by segments * Circles and arcs are approximated by segments
* @param aCornerBuffer = a buffer to store the polygon * @param aCornerBuffer = a buffer to store the polygon
* @param aClearance = the clearance around the text * @param aClearanceValue = the clearance around the text
* @param aError = deviation from true arc position to segment approx * @param aError = deviation from true arc position to segment approx
*/ */
void TransformShapeWithClearanceToPolygonSet( SHAPE_POLY_SET& aCornerBuffer, int aClearance, void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, PCB_LAYER_ID aLayer,
int aError, ERROR_LOC aErrorLoc ) const; int aClearanceValue, int aError, ERROR_LOC aErrorLoc,
bool aIgnoreLineWidth = false ) const override;
// @copydoc BOARD_ITEM::GetEffectiveShape // @copydoc BOARD_ITEM::GetEffectiveShape
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override; virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;

View File

@ -219,19 +219,19 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
itemplotter.PlotBoardGraphicItems(); itemplotter.PlotBoardGraphicItems();
// Draw footprint texts: // Draw footprint texts:
for( MODULE* module : aBoard->Footprints() ) for( MODULE* footprint : aBoard->Footprints() )
itemplotter.PlotFootprintTextItems( module ); itemplotter.PlotFootprintTextItems( footprint );
// Draw footprint other graphic items: // Draw footprint other graphic items:
for( MODULE* module : aBoard->Footprints() ) for( MODULE* footprint : aBoard->Footprints() )
itemplotter.PlotFootprintGraphicItems( module ); itemplotter.PlotFootprintGraphicItems( footprint );
// Plot footprint pads // Plot footprint pads
for( MODULE* module : aBoard->Footprints() ) for( MODULE* footprint : aBoard->Footprints() )
{ {
aPlotter->StartBlock( NULL ); aPlotter->StartBlock( NULL );
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
OUTLINE_MODE padPlotMode = plotMode; OUTLINE_MODE padPlotMode = plotMode;
@ -632,9 +632,9 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
int smallDrill = (aPlotOpt.GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE) int smallDrill = (aPlotOpt.GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE)
? SMALL_DRILL : INT_MAX; ? SMALL_DRILL : INT_MAX;
for( MODULE* module : aBoard->Footprints() ) for( MODULE* footprint : aBoard->Footprints() )
{ {
for( PAD* pad : module->Pads() ) for( PAD* pad : footprint->Pads() )
{ {
wxSize hole = pad->GetDrillSize(); wxSize hole = pad->GetDrillSize();
@ -727,11 +727,11 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
itemplotter.PlotBoardGraphicItems(); itemplotter.PlotBoardGraphicItems();
for( MODULE* module : aBoard->Footprints() ) for( MODULE* footprint : aBoard->Footprints() )
{ {
for( BOARD_ITEM* item : module->GraphicalItems() ) for( BOARD_ITEM* item : footprint->GraphicalItems() )
{ {
itemplotter.PlotFootprintTextItems( module ); itemplotter.PlotFootprintTextItems( footprint );
if( item->Type() == PCB_FP_SHAPE_T && item->GetLayer() == layer ) if( item->Type() == PCB_FP_SHAPE_T && item->GetLayer() == layer )
itemplotter.PlotFootprintGraphicItem( (FP_SHAPE*) item ); itemplotter.PlotFootprintGraphicItem( (FP_SHAPE*) item );
@ -757,14 +757,14 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
#endif #endif
{ {
// Plot pads // Plot pads
for( MODULE* module : aBoard->Footprints() ) for( MODULE* footprint : aBoard->Footprints() )
{ {
// add shapes with their exact mask layer size in initialPolys // add shapes with their exact mask layer size in initialPolys
module->TransformPadsShapesWithClearanceToPolygon( initialPolys, layer, 0, maxError, footprint->TransformPadsWithClearanceToPolygon( initialPolys, layer, 0, maxError,
ERROR_OUTSIDE ); ERROR_OUTSIDE );
// add shapes inflated by aMinThickness/2 in areas // add shapes inflated by aMinThickness/2 in areas
module->TransformPadsShapesWithClearanceToPolygon( areas, layer, inflate, maxError, footprint->TransformPadsWithClearanceToPolygon( areas, layer, inflate, maxError,
ERROR_OUTSIDE ); ERROR_OUTSIDE );
} }
// Plot vias on solder masks, if aPlotOpt.GetPlotViaOnMaskLayer() is true, // Plot vias on solder masks, if aPlotOpt.GetPlotViaOnMaskLayer() is true,

View File

@ -421,7 +421,7 @@ struct AMODEL
wxString id; wxString id;
bool isEmbedded; bool isEmbedded;
MODULE_3D_SETTINGS::VECTOR3D rotation; FP_3DMODEL::VECTOR3D rotation;
explicit AMODEL( ALTIUM_PARSER& aReader ); explicit AMODEL( ALTIUM_PARSER& aReader );
}; };
@ -523,16 +523,16 @@ struct AARC6
struct ACOMPONENTBODY6 struct ACOMPONENTBODY6
{ {
uint16_t component; uint16_t component;
wxString modelName; wxString modelName;
wxString modelId; wxString modelId;
bool modelIsEmbedded; bool modelIsEmbedded;
MODULE_3D_SETTINGS::VECTOR3D modelPosition; FP_3DMODEL::VECTOR3D modelPosition;
MODULE_3D_SETTINGS::VECTOR3D modelRotation; FP_3DMODEL::VECTOR3D modelRotation;
double rotation; double rotation;
double bodyOpacity; double bodyOpacity;
explicit ACOMPONENTBODY6( ALTIUM_PARSER& aReader ); explicit ACOMPONENTBODY6( ALTIUM_PARSER& aReader );
}; };

View File

@ -820,7 +820,7 @@ void ALTIUM_PCB::ParseComponentsBodies6Data(
MODULE* module = m_components.at( elem.component ); MODULE* module = m_components.at( elem.component );
const wxPoint& modulePosition = module->GetPosition(); const wxPoint& modulePosition = module->GetPosition();
MODULE_3D_SETTINGS modelSettings; FP_3DMODEL modelSettings;
modelSettings.m_Filename = modelTuple->second; modelSettings.m_Filename = modelTuple->second;

View File

@ -376,14 +376,14 @@ void PCB_PARSER::parseEDA_TEXT( EDA_TEXT* aText )
} }
MODULE_3D_SETTINGS* PCB_PARSER::parse3DModel() FP_3DMODEL* PCB_PARSER::parse3DModel()
{ {
wxCHECK_MSG( CurTok() == T_model, NULL, wxCHECK_MSG( CurTok() == T_model, NULL,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as MODULE_3D_SETTINGS." ) ); wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as FP_3DMODEL." ) );
T token; T token;
MODULE_3D_SETTINGS* n3D = new MODULE_3D_SETTINGS; FP_3DMODEL* n3D = new FP_3DMODEL;
NeedSYMBOLorNUMBER(); NeedSYMBOLorNUMBER();
n3D->m_Filename = FromUTF8(); n3D->m_Filename = FromUTF8();

View File

@ -58,7 +58,7 @@ class PCB_TARGET;
class VIA; class VIA;
class ZONE; class ZONE;
class MARKER_PCB; class MARKER_PCB;
class MODULE_3D_SETTINGS; class FP_3DMODEL;
struct LAYER; struct LAYER;
@ -250,7 +250,7 @@ class PCB_PARSER : public PCB_LEXER
*/ */
void parseEDA_TEXT( EDA_TEXT* aText ); void parseEDA_TEXT( EDA_TEXT* aText );
MODULE_3D_SETTINGS* parse3DModel(); FP_3DMODEL* parse3DModel();
/** /**
* Function parseDouble * Function parseDouble

View File

@ -1861,7 +1861,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( FP_TEXT* aText )
void LEGACY_PLUGIN::load3D( MODULE* aModule ) void LEGACY_PLUGIN::load3D( MODULE* aModule )
{ {
MODULE_3D_SETTINGS t3D; FP_3DMODEL t3D;
char* line; char* line;
while( ( line = READLINE( m_reader ) ) != NULL ) while( ( line = READLINE( m_reader ) ) != NULL )