7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-07 20:05:30 +00:00

A bit of "module" erradication, nameing conventions, and formatting.

This commit is contained in:
Jeff Young 2020-11-14 21:21:54 +00:00
parent d2a88234b6
commit 61bca4aaa4
47 changed files with 667 additions and 763 deletions

View File

@ -304,9 +304,9 @@ public:
// when importing values or creating a new pad
// Set to true if the board has a stackup management.
// If not set a default basic stackup witll be used to generate the ;gbrjob file.
// If not set a default basic stackup will be used to generate the gbrjob file.
// Could be removed later, or at least always set to true
bool m_HasStackup;
bool m_HasStackup;
private:
// Indicies into the trackWidth, viaSizes and diffPairDimensions lists.

View File

@ -313,7 +313,7 @@ void MICROWAVE_TOOL::createInductorBetween( const VECTOR2I& aStart, const VECTOR
}
else
{
// at this point, we can save the module
// at this point, we can save the footprint
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, inductorFP.get() );
BOARD_COMMIT commit( this );

View File

@ -54,7 +54,7 @@ class PCB_BASE_FRAME;
#define CH_UNROUTABLE 2 /* Don't use autorouter. */
#define CH_ROUTE_REQ 4 /* Must be routed by the autorouter. */
#define CH_ACTIF 8 /* Not routed. */
#define LOCAL_RATSNEST_ITEM 0x8000 /* Line between two pads of a single module. */
#define LOCAL_RATSNEST_ITEM 0x8000 /* Line between two pads of a single footprint. */
DECL_VEC_FOR_SWIG( PADS_VEC, PAD* )

View File

@ -85,7 +85,7 @@ class FP_CACHE
PCB_IO* m_owner; // Plugin object that owns the cache.
wxFileName m_lib_path; // The path of the library.
wxString m_lib_raw_path; // For quick comparisons.
FOOTPRINT_MAP m_modules; // Map of footprint file name per FOOTPRINT*.
FOOTPRINT_MAP m_footprints; // Map of footprint filename to FOOTPRINT*.
bool m_cache_dirty; // Stored separately because it's expensive to check
// m_cache_timestamp against all the files.
@ -101,16 +101,16 @@ public:
bool Exists() const { return m_lib_path.IsOk() && m_lib_path.DirExists(); }
FOOTPRINT_MAP& GetFootprints() { return m_modules; }
FOOTPRINT_MAP& GetFootprints() { return m_footprints; }
// Most all functions in this class throw IO_ERROR exceptions. There are no
// error codes nor user interface calls from here, nor in any PLUGIN.
// Catch these exceptions higher up please.
/**
* Save the footprint cache or a single module from it to disk
* Save the footprint cache or a single footprint from it to disk
*
* @param aFootprint if set, save only this module, otherwise, save the full library
* @param aFootprint if set, save only this footprint, otherwise, save the full library
*/
void Save( FOOTPRINT* aFootprint = NULL );
@ -171,7 +171,7 @@ void FP_CACHE::Save( FOOTPRINT* aFootprint )
m_lib_raw_path ) );
}
for( FOOTPRINT_MAP::iterator it = m_modules.begin(); it != m_modules.end(); ++it )
for( FOOTPRINT_MAP::iterator it = m_footprints.begin(); it != m_footprints.end(); ++it )
{
if( aFootprint && aFootprint != it->second->GetModule() )
continue;
@ -263,7 +263,7 @@ void FP_CACHE::Load()
wxString fpName = fn.GetName();
footprint->SetFPID( LIB_ID( wxEmptyString, fpName ) );
m_modules.insert( fpName, new FP_CACHE_ITEM( footprint, fn ) );
m_footprints.insert( fpName, new FP_CACHE_ITEM( footprint, fn ) );
m_cache_timestamp += fn.GetTimestamp();
}
@ -284,9 +284,9 @@ void FP_CACHE::Load()
void FP_CACHE::Remove( const wxString& aFootprintName )
{
FOOTPRINT_MAP::const_iterator it = m_modules.find( aFootprintName );
FOOTPRINT_MAP::const_iterator it = m_footprints.find( aFootprintName );
if( it == m_modules.end() )
if( it == m_footprints.end() )
{
wxString msg = wxString::Format( _( "library \"%s\" has no footprint \"%s\" to delete" ),
m_lib_raw_path,
@ -296,7 +296,7 @@ void FP_CACHE::Remove( const wxString& aFootprintName )
// Remove the module from the cache and delete the module file from the library.
wxString fullPath = it->second->GetFileName().GetFullPath();
m_modules.erase( aFootprintName );
m_footprints.erase( aFootprintName );
wxRemoveFile( fullPath );
}
@ -640,7 +640,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
m_out->Print( 0, "\n" );
}
// Save the graphical items on the board (not owned by a module)
// Save the graphical items on the board (not owned by a footprint)
for( BOARD_ITEM* item : sorted_drawings )
Format( item, aNestLevel );

View File

@ -73,7 +73,7 @@ class PCB_TEXT;
//#define SEXPR_BOARD_FILE_VERSION 20200614 // Add support for fp_rects and gr_rects
//#define SEXPR_BOARD_FILE_VERSION 20200625 // Multilayer zones, zone names, island controls
//#define SEXPR_BOARD_FILE_VERSION 20200628 // remove visibility settings
//#define SEXPR_BOARD_FILE_VERSION 20200724 // Add KIID to module components
//#define SEXPR_BOARD_FILE_VERSION 20200724 // Add KIID to footprints
//#define SEXPR_BOARD_FILE_VERSION 20200807 // Add zone hatch advanced settings
//#define SEXPR_BOARD_FILE_VERSION 20200808 // Add properties to footprints
//#define SEXPR_BOARD_FILE_VERSION 20200809 // Add REMOVE_UNUSED_LAYERS option to vias and THT pads

View File

@ -163,7 +163,7 @@ class PCB_PARSER : public PCB_LEXER
/**
* Function parseFOOTPRINT_unchecked
* Parse a module, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically.
* Parse a footprint, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically.
*/
FOOTPRINT* parseFOOTPRINT_unchecked( wxArrayString* aInitialComments = 0 );
FP_TEXT* parseFP_TEXT();
@ -182,7 +182,7 @@ class PCB_PARSER : public PCB_LEXER
/**
* Function parseBOARD_unchecked
* Parse a module, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically.
* Parse a board, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically.
*/
BOARD* parseBOARD_unchecked();

View File

@ -1284,7 +1284,7 @@ void LEGACY_PLUGIN::loadFOOTPRINT( FOOTPRINT* aFootprint )
aFootprint->SetPlacementCost90((itmp1 << 4) | cntRot90 );
}
else if( TESTLINE( "At" ) ) // (At)tributes of module
else if( TESTLINE( "At" ) ) // (At)tributes of footprint
{
int attrs = 0;
@ -1607,8 +1607,8 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint )
else if( TESTLINE( "$EndPAD" ) )
{
// pad's "Position" is not relative to the module's,
// whereas Pos0 is relative to the module's but is the unrotated coordinate.
// pad's "Position" is not relative to the footprint's, whereas Pos0 is relative
// to the footprint's but is the unrotated coordinate.
wxPoint padpos = pad->GetPos0();
@ -1754,7 +1754,7 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
aFootprint->Add( fpShape );
// this had been done at the FOOTPRINT level before, presumably because the FP_SHAPE needs
// to be already added to a module before this function will work.
// to be already added to a footprint before this function will work.
fpShape->SetDrawCoord();
}

View File

@ -16,7 +16,7 @@ set( PCAD2PCBNEW_SRCS
pcb_cutout.cpp
pcb_keepout.cpp
pcb_line.cpp
pcb_module.cpp
pcb_footprint.cpp
pcb_net.cpp
pcb_pad.cpp
pcb_pad_shape.cpp

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -32,14 +32,8 @@
#include <common.h>
#include <pcb.h>
#include <pcb_arc.h>
#include <pcb_copper_pour.h>
#include <pcb_cutout.h>
#include <pcb_keepout.h>
#include <pcb_line.h>
#include <pcb_module.h>
#include <pcb_pad_shape.h>
#include <pcb_via_shape.h>
#include <pcb_footprint.h>
#include <pcb_pad.h>
#include <pcb_text.h>
#include <pcb_via.h>
@ -49,9 +43,9 @@ namespace PCAD2KICAD {
PCB_LAYER_ID PCB::GetKiCadLayer( int aPCadLayer )
{
auto it = m_layersMap.find( aPCadLayer );
auto it = m_LayersMap.find( aPCadLayer );
if( it == m_layersMap.end() )
if( it == m_LayersMap.end() )
THROW_IO_ERROR( wxString::Format( _( "Unknown PCad layer %u" ), unsigned( aPCadLayer ) ) );
return it->second.KiCadLayer;
@ -59,9 +53,9 @@ PCB_LAYER_ID PCB::GetKiCadLayer( int aPCadLayer )
LAYER_TYPE_T PCB::GetLayerType( int aPCadLayer )
{
auto it = m_layersMap.find( aPCadLayer );
auto it = m_LayersMap.find( aPCadLayer );
if( it == m_layersMap.end() )
if( it == m_LayersMap.end() )
THROW_IO_ERROR( wxString::Format( _( "Unknown PCad layer %u" ), unsigned( aPCadLayer ) ) );
return it->second.layerType;
@ -69,17 +63,18 @@ LAYER_TYPE_T PCB::GetLayerType( int aPCadLayer )
wxString PCB::GetLayerNetNameRef( int aPCadLayer )
{
auto it = m_layersMap.find( aPCadLayer );
auto it = m_LayersMap.find( aPCadLayer );
if( it == m_layersMap.end() )
if( it == m_LayersMap.end() )
THROW_IO_ERROR( wxString::Format( _( "Unknown PCad layer %u" ), unsigned( aPCadLayer ) ) );
return it->second.netNameRef;
}
PCB::PCB( BOARD* aBoard ) : PCB_MODULE( this, aBoard )
PCB::PCB( BOARD* aBoard ) :
PCB_FOOTPRINT( this, aBoard )
{
m_defaultMeasurementUnit = wxT( "mil" );
m_DefaultMeasurementUnit = wxT( "mil" );
for( size_t i = 0; i < 8; ++i )
{
@ -88,21 +83,21 @@ PCB::PCB( BOARD* aBoard ) : PCB_MODULE( this, aBoard )
layer.layerType = LAYER_TYPE_NONSIGNAL; // default
layer.netNameRef = wxT( "" ); // default
m_layersMap.insert( std::make_pair( i, layer ) );
m_LayersMap.insert( std::make_pair( i, layer ) );
}
m_sizeX = 0;
m_sizeY = 0;
m_SizeX = 0;
m_SizeY = 0;
m_layersMap[1].KiCadLayer = F_Cu;
m_layersMap[1].layerType = LAYER_TYPE_SIGNAL;
m_LayersMap[1].KiCadLayer = F_Cu;
m_LayersMap[1].layerType = LAYER_TYPE_SIGNAL;
m_layersMap[2].KiCadLayer = B_Cu;
m_layersMap[2].layerType = LAYER_TYPE_SIGNAL;
m_LayersMap[2].KiCadLayer = B_Cu;
m_LayersMap[2].layerType = LAYER_TYPE_SIGNAL;
m_layersMap[3].KiCadLayer = Eco2_User;
m_layersMap[6].KiCadLayer = F_SilkS;
m_layersMap[7].KiCadLayer = B_SilkS;
m_LayersMap[3].KiCadLayer = Eco2_User;
m_LayersMap[6].KiCadLayer = F_SilkS;
m_LayersMap[7].KiCadLayer = B_SilkS;
}
@ -110,14 +105,14 @@ PCB::~PCB()
{
int i;
for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ )
for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ )
{
delete m_pcbComponents[i];
delete m_PcbComponents[i];
}
for( i = 0; i < (int) m_pcbNetlist.GetCount(); i++ )
for( i = 0; i < (int) m_PcbNetlist.GetCount(); i++ )
{
delete m_pcbNetlist[i];
delete m_PcbNetlist[i];
}
}
@ -126,13 +121,13 @@ int PCB::GetNetCode( wxString aNetName )
{
PCB_NET* net;
for( int i = 0; i < (int) m_pcbNetlist.GetCount(); i++ )
for( int i = 0; i < (int) m_PcbNetlist.GetCount(); i++ )
{
net = m_pcbNetlist[i];
net = m_PcbNetlist[i];
if( net->m_name == aNetName )
if( net->m_Name == aNetName )
{
return net->m_netCode;
return net->m_NetCode;
}
}
@ -234,7 +229,7 @@ void PCB::SetTextProperty( XNODE* aNode, TTEXTVALUE* aTextValue,
}
if( tNode )
SetTextParameters( tNode, aTextValue, m_defaultMeasurementUnit, aActualConversion );
SetTextParameters( tNode, aTextValue, m_DefaultMeasurementUnit, aActualConversion );
}
@ -243,18 +238,18 @@ void PCB::DoPCBComponents( XNODE* aNode,
const wxString& aActualConversion,
wxStatusBar* aStatusBar )
{
XNODE* lNode, * tNode, * mNode;
PCB_MODULE* mc;
PCB_PAD* pad;
PCB_VIA* via;
PCB_KEEPOUT* keepOut;
wxString cn, str, propValue;
XNODE* lNode, * tNode, * mNode;
PCB_FOOTPRINT* fp;
PCB_PAD* pad;
PCB_VIA* via;
PCB_KEEPOUT* keepOut;
wxString cn, str, propValue;
lNode = aNode->GetChildren();
while( lNode )
{
mc = NULL;
fp = NULL;
if( lNode->GetName() == wxT( "pattern" ) )
{
@ -269,38 +264,37 @@ void PCB::DoPCBComponents( XNODE* aNode,
if( tNode )
{
mc = new PCB_MODULE( this, m_board );
fp = new PCB_FOOTPRINT( this, m_board );
mNode = FindNode( lNode, wxT( "patternGraphicsNameRef" ) );
if( mNode )
mNode->GetAttribute( wxT( "Name" ), &mc->m_patGraphRefName );
mNode->GetAttribute( wxT( "Name" ), &fp->m_patGraphRefName );
mc->Parse( tNode, aStatusBar, m_defaultMeasurementUnit, aActualConversion );
fp->Parse( tNode, aStatusBar, m_DefaultMeasurementUnit, aActualConversion );
}
}
if( mc )
if( fp )
{
mc->m_compRef = cn; // default - in new version of file it is updated later....
fp->m_compRef = cn; // default - in new version of file it is updated later....
tNode = FindNode( lNode, wxT( "refDesRef" ) );
if( tNode )
{
tNode->GetAttribute( wxT( "Name" ), &mc->m_name.text );
SetTextProperty( lNode, &mc->m_name, mc->m_patGraphRefName, wxT(
"RefDes" ), aActualConversion );
SetTextProperty( lNode, &mc->m_value, mc->m_patGraphRefName, wxT(
"Value" ), aActualConversion );
tNode->GetAttribute( wxT( "Name" ), &fp->m_name.text );
SetTextProperty( lNode, &fp->m_name, fp->m_patGraphRefName, wxT( "RefDes" ),
aActualConversion );
SetTextProperty( lNode, &fp->m_Value, fp->m_patGraphRefName, wxT( "Value" ),
aActualConversion );
}
tNode = FindNode( lNode, wxT( "pt" ) );
if( tNode )
SetPosition( tNode->GetNodeContent(),
m_defaultMeasurementUnit,
&mc->m_positionX,
&mc->m_positionY,
aActualConversion );
{
SetPosition( tNode->GetNodeContent(), m_DefaultMeasurementUnit,
&fp->m_positionX, &fp->m_positionY, aActualConversion );
}
tNode = FindNode( lNode, wxT( "rotation" ) );
@ -308,13 +302,13 @@ void PCB::DoPCBComponents( XNODE* aNode,
{
str = tNode->GetNodeContent();
str.Trim( false );
mc->m_rotation = StrToInt1Units( str );
fp->m_rotation = StrToInt1Units( str );
}
str = FindNodeGetContent( lNode, wxT( "isFlipped" ) );
if( str == wxT( "True" ) )
mc->m_mirror = 1;
fp->m_Mirror = 1;
tNode = aNode;
@ -331,24 +325,24 @@ void PCB::DoPCBComponents( XNODE* aNode,
{
tNode->GetAttribute( wxT( "Name" ), &propValue );
if( propValue == mc->m_name.text )
if( propValue == fp->m_name.text )
{
if( FindNode( tNode, wxT( "compValue" ) ) )
{
FindNode( tNode,
wxT( "compValue" ) )->GetAttribute( wxT( "Name" ),
&mc->m_value.text );
mc->m_value.text.Trim( false );
mc->m_value.text.Trim( true );
&fp->m_Value.text );
fp->m_Value.text.Trim( false );
fp->m_Value.text.Trim( true );
}
if( FindNode( tNode, wxT( "compRef" ) ) )
{
FindNode( tNode,
wxT( "compRef" ) )->GetAttribute( wxT( "Name" ),
&mc->m_compRef );
mc->m_compRef.Trim( false );
mc->m_compRef.Trim( true );
&fp->m_compRef );
fp->m_compRef.Trim( false );
fp->m_compRef.Trim( true );
}
tNode = NULL;
@ -360,7 +354,7 @@ void PCB::DoPCBComponents( XNODE* aNode,
// map pins
tNode = FindNode( (XNODE *)aXmlDoc->GetRoot(), wxT( "library" ) );
tNode = FindCompDefName( tNode, mc->m_compRef );
tNode = FindCompDefName( tNode, fp->m_compRef );
if( tNode )
{
@ -381,7 +375,7 @@ void PCB::DoPCBComponents( XNODE* aNode,
break;
mNode->GetAttribute( wxT( "Name" ), &propValue );
mc->SetName( str, propValue );
fp->SetName( str, propValue );
mNode = mNode->GetNext();
}
else
@ -397,27 +391,27 @@ void PCB::DoPCBComponents( XNODE* aNode,
}
}
m_pcbComponents.Add( mc );
m_PcbComponents.Add( fp );
}
}
else if( lNode->GetName() == wxT( "pad" ) )
{
pad = new PCB_PAD( this, m_board );
pad->Parse( lNode, m_defaultMeasurementUnit, aActualConversion );
m_pcbComponents.Add( pad );
pad->Parse( lNode, m_DefaultMeasurementUnit, aActualConversion );
m_PcbComponents.Add( pad );
}
else if( lNode->GetName() == wxT( "via" ) )
{
via = new PCB_VIA( this, m_board );
via->Parse( lNode, m_defaultMeasurementUnit, aActualConversion );
m_pcbComponents.Add( via );
via->Parse( lNode, m_DefaultMeasurementUnit, aActualConversion );
m_PcbComponents.Add( via );
}
else if( lNode->GetName() == wxT( "polyKeepOut" ) )
{
keepOut = new PCB_KEEPOUT( m_callbacks, m_board, 0 );
if( keepOut->Parse( lNode, m_defaultMeasurementUnit, aActualConversion ) )
m_pcbComponents.Add( keepOut );
if( keepOut->Parse( lNode, m_DefaultMeasurementUnit, aActualConversion ) )
m_PcbComponents.Add( keepOut );
else
delete keepOut;
}
@ -427,25 +421,24 @@ void PCB::DoPCBComponents( XNODE* aNode,
}
void PCB::ConnectPinToNet( const wxString& aCompRef,
const wxString& aPinRef,
void PCB::ConnectPinToNet( const wxString& aCompRef, const wxString& aPinRef,
const wxString& aNetName )
{
PCB_MODULE* module;
PCB_PAD* cp;
int i, j;
PCB_FOOTPRINT* footprint;
PCB_PAD* cp;
int i, j;
for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ )
for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ )
{
module = (PCB_MODULE*) m_pcbComponents[i];
footprint = (PCB_FOOTPRINT*) m_PcbComponents[i];
if( module->m_objType == wxT( 'M' ) && module->m_name.text == aCompRef )
if( footprint->m_objType == wxT( 'M' ) && footprint->m_name.text == aCompRef )
{
for( j = 0; j < (int) module->m_moduleObjects.GetCount(); j++ )
for( j = 0; j < (int) footprint->m_FootprintItems.GetCount(); j++ )
{
if( module->m_moduleObjects[j]->m_objType == wxT( 'P' ) )
if( footprint->m_FootprintItems[j]->m_objType == wxT( 'P' ) )
{
cp = (PCB_PAD*) module->m_moduleObjects[j];
cp = (PCB_PAD*) footprint->m_FootprintItems[j];
if( cp->m_name.text == aPinRef )
cp->m_net = aNetName;
@ -552,12 +545,12 @@ void PCB::MapLayer( XNODE* aNode )
newlayer.layerType = LAYER_TYPE_PLANE;
}
m_layersMap.insert( std::make_pair( num, newlayer ) );
m_LayersMap.insert( std::make_pair( num, newlayer ) );
if( FindNode( aNode, wxT( "netNameRef" ) ) )
{
FindNode( aNode, wxT( "netNameRef" ) )->GetAttribute( wxT( "Name" ),
&m_layersMap[(int) num].netNameRef );
&m_LayersMap[(int) num].netNameRef );
}
}
@ -621,11 +614,11 @@ void PCB::GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConver
if( pNode )
{
SetPosition( pNode->GetNodeContent(), m_defaultMeasurementUnit,
SetPosition( pNode->GetNodeContent(), m_DefaultMeasurementUnit,
&x, &y, aActualConversion );
if( FindOutlinePoint( &m_boardOutline, wxRealPoint( x, y) ) == -1 )
m_boardOutline.Add( new wxRealPoint( x, y ) );
if( FindOutlinePoint( &m_BoardOutline, wxRealPoint( x, y) ) == -1 )
m_BoardOutline.Add( new wxRealPoint( x, y ) );
}
if( pNode )
@ -633,11 +626,11 @@ void PCB::GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConver
if( pNode )
{
SetPosition( pNode->GetNodeContent(), m_defaultMeasurementUnit,
SetPosition( pNode->GetNodeContent(), m_DefaultMeasurementUnit,
&x, &y, aActualConversion );
if( FindOutlinePoint( &m_boardOutline, wxRealPoint( x, y) ) == -1 )
m_boardOutline.Add( new wxRealPoint( x, y ) );
if( FindOutlinePoint( &m_BoardOutline, wxRealPoint( x, y) ) == -1 )
m_BoardOutline.Add( new wxRealPoint( x, y ) );
}
}
@ -646,16 +639,16 @@ void PCB::GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConver
//m_boardOutline.Sort( cmpFunc );
// sort vertices according to the distances between them
if( m_boardOutline.GetCount() > 3 )
if( m_BoardOutline.GetCount() > 3 )
{
for( i = 0; i < (int) m_boardOutline.GetCount() - 1; i++ )
for( i = 0; i < (int) m_BoardOutline.GetCount() - 1; i++ )
{
minDistance = GetDistance( m_boardOutline[i], m_boardOutline[i + 1] );
minDistance = GetDistance( m_BoardOutline[i], m_BoardOutline[ i + 1] );
targetInd = i + 1;
for( j = i + 2; j < (int) m_boardOutline.GetCount(); j++ )
for( j = i + 2; j < (int) m_BoardOutline.GetCount(); j++ )
{
distance = GetDistance( m_boardOutline[i], m_boardOutline[j] );
distance = GetDistance( m_BoardOutline[i], m_BoardOutline[j] );
if( distance < minDistance )
{
minDistance = distance;
@ -663,9 +656,9 @@ void PCB::GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConver
}
}
xchgPoint = m_boardOutline[i + 1];
m_boardOutline[i + 1] = m_boardOutline[targetInd];
m_boardOutline[targetInd] = xchgPoint;
xchgPoint = m_BoardOutline[ i + 1];
m_BoardOutline[ i + 1] = m_BoardOutline[targetInd];
m_BoardOutline[targetInd] = xchgPoint;
}
}
@ -683,7 +676,7 @@ void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxS
XNODE* aNode;//, *aaNode;
PCB_NET* net;
PCB_COMPONENT* comp;
PCB_MODULE* module;
PCB_FOOTPRINT* footprint;
wxString compRef, pinRef, layerName, layerType;
int i, j, netCode;
@ -696,9 +689,9 @@ void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxS
if( aNode )
{
m_defaultMeasurementUnit = aNode->GetNodeContent().Lower();
m_defaultMeasurementUnit.Trim( true );
m_defaultMeasurementUnit.Trim( false );
m_DefaultMeasurementUnit = aNode->GetNodeContent().Lower();
m_DefaultMeasurementUnit.Trim( true );
m_DefaultMeasurementUnit.Trim( false );
}
}
@ -793,7 +786,7 @@ void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxS
{
net = new PCB_NET( netCode++ );
net->Parse( aNode );
m_pcbNetlist.Add( net );
m_PcbNetlist.Add( net );
aNode = aNode->GetNext();
}
@ -817,8 +810,8 @@ void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxS
// objects
if( aNode->GetName() == wxT( "layerContents" ) )
DoLayerContentsObjects( aNode, NULL, &m_pcbComponents, aStatusBar,
m_defaultMeasurementUnit, aActualConversion );
DoLayerContentsObjects( aNode, NULL, &m_PcbComponents, aStatusBar,
m_DefaultMeasurementUnit, aActualConversion );
aNode = aNode->GetNext();
}
@ -826,78 +819,78 @@ void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxS
// POSTPROCESS -- SET NETLIST REFERENCES
// aStatusBar->SetStatusText( wxT( "Processing NETLIST " ) );
for( i = 0; i < (int) m_pcbNetlist.GetCount(); i++ )
for( i = 0; i < (int) m_PcbNetlist.GetCount(); i++ )
{
net = m_pcbNetlist[i];
net = m_PcbNetlist[i];
for( j = 0; j < (int) net->m_netNodes.GetCount(); j++ )
for( j = 0; j < (int) net->m_NetNodes.GetCount(); j++ )
{
compRef = net->m_netNodes[j]->m_compRef;
compRef = net->m_NetNodes[j]->m_CompRef;
compRef.Trim( false );
compRef.Trim( true );
pinRef = net->m_netNodes[j]->m_pinRef;
pinRef = net->m_NetNodes[j]->m_PinRef;
pinRef.Trim( false );
pinRef.Trim( true );
ConnectPinToNet( compRef, pinRef, net->m_name );
ConnectPinToNet( compRef, pinRef, net->m_Name );
}
}
// POSTPROCESS -- FLIP COMPONENTS
for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ )
for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ )
{
if( m_pcbComponents[i]->m_objType == wxT( 'M' ) )
( (PCB_MODULE*) m_pcbComponents[i] )->Flip();
if( m_PcbComponents[i]->m_objType == wxT( 'M' ) )
( (PCB_FOOTPRINT*) m_PcbComponents[i] )->Flip();
}
// POSTPROCESS -- SET/OPTIMIZE NEW PCB POSITION
// aStatusBar->SetStatusText( wxT( "Optimizing BOARD POSITION " ) );
m_sizeX = 10000000;
m_sizeY = 0;
m_SizeX = 10000000;
m_SizeY = 0;
for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ )
for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ )
{
comp = m_pcbComponents[i];
comp = m_PcbComponents[i];
if( comp->m_positionY < m_sizeY )
m_sizeY = comp->m_positionY; // max Y
if( comp->m_positionY < m_SizeY )
m_SizeY = comp->m_positionY; // max Y
if( comp->m_positionX < m_sizeX && comp->m_positionX > 0 )
m_sizeX = comp->m_positionX; // Min X
if( comp->m_positionX < m_SizeX && comp->m_positionX > 0 )
m_SizeX = comp->m_positionX; // Min X
}
m_sizeY -= 10000;
m_sizeX -= 10000;
m_SizeY -= 10000;
m_SizeX -= 10000;
// aStatusBar->SetStatusText( wxT( " POSITIONING POSTPROCESS " ) );
for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ )
m_pcbComponents[i]->SetPosOffset( -m_sizeX, -m_sizeY );
for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ )
m_PcbComponents[i]->SetPosOffset( -m_SizeX, -m_SizeY );
m_sizeX = 0;
m_sizeY = 0;
m_SizeX = 0;
m_SizeY = 0;
for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ )
for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ )
{
comp = m_pcbComponents[i];
comp = m_PcbComponents[i];
if( comp->m_positionY < m_sizeY )
m_sizeY = comp->m_positionY; // max Y
if( comp->m_positionY < m_SizeY )
m_SizeY = comp->m_positionY; // max Y
if( comp->m_positionX > m_sizeX )
m_sizeX = comp->m_positionX; // Min X
if( comp->m_positionX > m_SizeX )
m_SizeX = comp->m_positionX; // Min X
}
// SHEET SIZE CALCULATION
m_sizeY = -m_sizeY; // it is in absolute units
m_sizeX += 10000;
m_sizeY += 10000;
m_SizeY = -m_SizeY; // it is in absolute units
m_SizeX += 10000;
m_SizeY += 10000;
// A4 is minimum $Descr A4 11700 8267
if( m_sizeX < 11700 )
m_sizeX = 11700;
if( m_SizeX < 11700 )
m_SizeX = 11700;
if( m_sizeY < 8267 )
m_sizeY = 8267;
if( m_SizeY < 8267 )
m_SizeY = 8267;
}
else
{
@ -916,10 +909,10 @@ void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxS
if( aNode->GetName() == wxT( "compDef" ) )
{
module = new PCB_MODULE( this, m_board );
module->Parse( aNode, aStatusBar, m_defaultMeasurementUnit,
aActualConversion );
m_pcbComponents.Add( module );
footprint = new PCB_FOOTPRINT( this, m_board );
footprint->Parse( aNode, aStatusBar, m_DefaultMeasurementUnit,
aActualConversion );
m_PcbComponents.Add( footprint );
}
aNode = aNode->GetNext();
@ -936,16 +929,16 @@ void PCB::AddToBoard()
m_board->SetCopperLayerCount( m_layersStackup.GetCount() );
for( i = 0; i < (int) m_pcbNetlist.GetCount(); i++ )
for( i = 0; i < (int) m_PcbNetlist.GetCount(); i++ )
{
net = m_pcbNetlist[i];
net = m_PcbNetlist[i];
m_board->Add( new NETINFO_ITEM( m_board, net->m_name, net->m_netCode ) );
m_board->Add( new NETINFO_ITEM( m_board, net->m_Name, net->m_NetCode ) );
}
for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ )
for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ )
{
m_pcbComponents[i]->AddToBoard();
m_PcbComponents[i]->AddToBoard();
}
}

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -34,57 +34,52 @@
#include <wx/wx.h>
#include <xnode.h>
#include <pcb_module.h>
#include <pcb_footprint.h>
#include <pcb_net.h>
namespace PCAD2KICAD {
class PCB : public PCB_MODULE, public PCB_CALLBACKS
class PCB : public PCB_FOOTPRINT, public PCB_CALLBACKS
{
public:
PCB_COMPONENTS_ARRAY m_pcbComponents; // PCB footprints,Lines,Routes,Texts, .... and so on
PCB_NETS_ARRAY m_pcbNetlist; // net objects collection
wxString m_defaultMeasurementUnit;
std::map<int, TLAYER> m_layersMap; // flexible layers mapping
int m_sizeX;
int m_sizeY;
PCB_COMPONENTS_ARRAY m_PcbComponents; // PCB footprints,Lines,Routes,Texts, .... and so on
PCB_NETS_ARRAY m_PcbNetlist; // net objects collection
wxString m_DefaultMeasurementUnit;
std::map<int, TLAYER> m_LayersMap; // flexible layers mapping
int m_SizeX;
int m_SizeY;
PCB( BOARD* aBoard );
~PCB();
PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) override;
LAYER_TYPE_T GetLayerType( int aPCadLayer ) override;
wxString GetLayerNetNameRef( int aPCadLayer ) override;
int GetNetCode( wxString aNetName ) override;
PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) override;
LAYER_TYPE_T GetLayerType( int aPCadLayer ) override;
wxString GetLayerNetNameRef( int aPCadLayer ) override;
int GetNetCode( wxString aNetName ) override;
void ParseBoard( wxStatusBar* aStatusBar,
wxXmlDocument* aXmlDoc,
const wxString& aActualConversion );
void ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc,
const wxString& aActualConversion );
void AddToBoard() override;
void AddToBoard() override;
private:
wxArrayString m_layersStackup;
XNODE* FindCompDefName( XNODE* aNode, const wxString& aName );
void SetTextProperty( XNODE* aNode,
TTEXTVALUE* aTextValue,
const wxString& aPatGraphRefName,
const wxString& aXmlName,
const wxString& aActualConversion );
void DoPCBComponents( XNODE* aNode,
wxXmlDocument* aXmlDoc,
const wxString& aActualConversion,
wxStatusBar* aStatusBar );
void ConnectPinToNet( const wxString& aCr,
const wxString& aPr,
const wxString& aNetName );
int FindLayer( const wxString& aLayerName );
void MapLayer( XNODE* aNode );
int FindOutlinePoint( VERTICES_ARRAY* aOutline, wxRealPoint aPoint );
double GetDistance( wxRealPoint* aPoint1, wxRealPoint* aPoint2 );
void GetBoardOutline( wxXmlDocument* aXmlDoc,
const wxString& aActualConversion );
XNODE* FindCompDefName( XNODE* aNode, const wxString& aName );
void SetTextProperty( XNODE* aNode, TTEXTVALUE* aTextValue, const wxString& aPatGraphRefName,
const wxString& aXmlName, const wxString& aActualConversion );
void DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxString& aActualConversion,
wxStatusBar* aStatusBar );
void ConnectPinToNet( const wxString& aCr, const wxString& aPr, const wxString& aNetName );
int FindLayer( const wxString& aLayerName );
void MapLayer( XNODE* aNode );
int FindOutlinePoint( VERTICES_ARRAY* aOutline, wxRealPoint aPoint );
double GetDistance( wxRealPoint* aPoint1, wxRealPoint* aPoint2 );
void GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConversion );
};
} // namespace PCAD2KICAD

View File

@ -30,7 +30,7 @@
#include <pcb_cutout.h>
#include <pcb_plane.h>
#include <pcb_line.h>
#include <pcb_module.h>
#include <pcb_footprint.h>
#include <pcb_pad.h>
#include <pcb_polygon.h>
#include <plugins/pcad/pcb_text.h>
@ -40,28 +40,28 @@
namespace PCAD2KICAD {
PCB_MODULE::PCB_MODULE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCB_FOOTPRINT::PCB_FOOTPRINT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCB_COMPONENT( aCallbacks, aBoard )
{
InitTTextValue( &m_value );
m_mirror = 0;
InitTTextValue( &m_Value );
m_Mirror = 0;
m_objType = wxT( 'M' ); // FOOTPRINT
m_KiCadLayer = F_SilkS; // default
}
PCB_MODULE::~PCB_MODULE()
PCB_FOOTPRINT::~PCB_FOOTPRINT()
{
int i;
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
delete m_moduleObjects[i];
delete m_FootprintItems[i];
}
}
XNODE* PCB_MODULE::FindModulePatternDefName( XNODE* aNode, const wxString& aName )
XNODE* PCB_FOOTPRINT::FindModulePatternDefName( XNODE* aNode, const wxString& aName )
{
XNODE* result, * lNode;
wxString propValue1, propValue2;
@ -115,7 +115,7 @@ XNODE* PCB_MODULE::FindModulePatternDefName( XNODE* aNode, const wxString& aName
}
XNODE* PCB_MODULE::FindPatternMultilayerSection( XNODE* aNode, wxString* aPatGraphRefName )
XNODE* PCB_FOOTPRINT::FindPatternMultilayerSection( XNODE* aNode, wxString* aPatGraphRefName )
{
XNODE* result, * pNode, * lNode;
wxString propValue, patName;
@ -207,12 +207,12 @@ XNODE* PCB_MODULE::FindPatternMultilayerSection( XNODE* aNode, wxString* aPatGra
}
void PCB_MODULE::DoLayerContentsObjects( XNODE* aNode,
PCB_MODULE* aPCBModule,
PCB_COMPONENTS_ARRAY* aList,
wxStatusBar* aStatusBar,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion )
void PCB_FOOTPRINT::DoLayerContentsObjects( XNODE* aNode,
PCB_FOOTPRINT* aFootprint,
PCB_COMPONENTS_ARRAY* aList,
wxStatusBar* aStatusBar,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion )
{
PCB_ARC* arc;
PCB_POLYGON* polygon;
@ -240,7 +240,7 @@ void PCB_MODULE::DoLayerContentsObjects( XNODE* aNode,
{
plane_layer = new PCB_POLYGON( m_callbacks, m_board, PCadLayer );
plane_layer->AssignNet( m_callbacks->GetLayerNetNameRef( PCadLayer ) );
plane_layer->SetOutline( &m_boardOutline );
plane_layer->SetOutline( &m_BoardOutline );
aList->Add( plane_layer );
// fill the polygon with the same contour as its outline is
@ -281,7 +281,7 @@ void PCB_MODULE::DoLayerContentsObjects( XNODE* aNode,
{
tNode = FindNode( lNode, wxT( "textStyleRef" ) );
if( tNode && aPCBModule )
if( tNode && aFootprint )
{
// TODO: to understand and may be repair
// Alexander Lunev: originally in Delphi version of the project there was
@ -291,7 +291,7 @@ void PCB_MODULE::DoLayerContentsObjects( XNODE* aNode,
// required when the function DoLayerContentsObjects() is called from
// function ProcessXMLtoPCBLib().
SetFontProperty( tNode,
&aPCBModule->m_name,
&aFootprint->m_name,
aDefaultMeasurementUnit,
aActualConversion );
}
@ -362,27 +362,27 @@ void PCB_MODULE::DoLayerContentsObjects( XNODE* aNode,
}
void PCB_MODULE::SetName( const wxString& aPin, const wxString& aName )
void PCB_FOOTPRINT::SetName( const wxString& aPin, const wxString& aName )
{
int i;
long num;
aPin.ToLong( &num );
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_moduleObjects[i]->m_objType == wxT( 'P' ) )
if( ( (PCB_PAD*) m_moduleObjects[i] )->m_number == num )
( (PCB_PAD*) m_moduleObjects[i] )->m_name.text = aName;
if( m_FootprintItems[i]->m_objType == wxT( 'P' ) )
if(( (PCB_PAD*) m_FootprintItems[i] )->m_Number == num )
( (PCB_PAD*) m_FootprintItems[i] )->m_name.text = aName;
}
}
void PCB_MODULE::Parse( XNODE* aNode, wxStatusBar* aStatusBar,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion )
void PCB_FOOTPRINT::Parse( XNODE* aNode, wxStatusBar* aStatusBar,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion )
{
XNODE* lNode, * tNode, * mNode;
PCB_PAD* pad;
@ -409,14 +409,14 @@ void PCB_MODULE::Parse( XNODE* aNode, wxStatusBar* aStatusBar,
{
pad = new PCB_PAD( m_callbacks, m_board );
pad->Parse( tNode, aDefaultMeasurementUnit, aActualConversion );
m_moduleObjects.Add( pad );
m_FootprintItems.Add( pad );
}
if( tNode->GetName() == wxT( "via" ) )
{
via = new PCB_VIA( m_callbacks, m_board );
via->Parse( tNode, aDefaultMeasurementUnit, aActualConversion );
m_moduleObjects.Add( via );
m_FootprintItems.Add( via );
}
tNode = tNode->GetNext();
@ -432,7 +432,7 @@ void PCB_MODULE::Parse( XNODE* aNode, wxStatusBar* aStatusBar,
while( lNode )
{
if( lNode->GetName() == wxT( "layerContents" ) )
DoLayerContentsObjects( lNode, this, &m_moduleObjects, aStatusBar,
DoLayerContentsObjects( lNode, this, &m_FootprintItems, aStatusBar,
aDefaultMeasurementUnit, aActualConversion );
lNode = lNode->GetNext();
@ -473,7 +473,7 @@ void PCB_MODULE::Parse( XNODE* aNode, wxStatusBar* aStatusBar,
}
wxString PCB_MODULE::ModuleLayer( int aMirror )
wxString PCB_FOOTPRINT::ModuleLayer( int aMirror )
{
wxString result;
@ -490,7 +490,7 @@ wxString PCB_MODULE::ModuleLayer( int aMirror )
}
void PCB_MODULE::AddToBoard()
void PCB_FOOTPRINT::AddToBoard()
{
int i;
int r;
@ -499,23 +499,23 @@ void PCB_MODULE::AddToBoard()
CorrectTextPosition( &m_name );
RotatePoint( &m_name.correctedPositionX, &m_name.correctedPositionY, (double) -m_rotation );
CorrectTextPosition( &m_value );
RotatePoint( &m_value.correctedPositionX, &m_value.correctedPositionY, (double) -m_rotation );
CorrectTextPosition( &m_Value );
RotatePoint( &m_Value.correctedPositionX, &m_Value.correctedPositionY, (double) -m_rotation );
FOOTPRINT* module = new FOOTPRINT( m_board );
m_board->Add( module, ADD_MODE::APPEND );
FOOTPRINT* footprint = new FOOTPRINT( m_board );
m_board->Add( footprint, ADD_MODE::APPEND );
module->SetPosition( wxPoint( m_positionX, m_positionY ) );
module->SetLayer( m_mirror ? B_Cu : F_Cu );
module->SetOrientation( m_rotation );
module->SetLastEditTime( 0 );
footprint->SetPosition( wxPoint( m_positionX, m_positionY ) );
footprint->SetLayer( m_Mirror ? B_Cu : F_Cu );
footprint->SetOrientation( m_rotation );
footprint->SetLastEditTime( 0 );
LIB_ID fpID;
fpID.Parse( m_compRef, LIB_ID::ID_PCB, true );
module->SetFPID( fpID );
footprint->SetFPID( fpID );
// reference text
FP_TEXT* ref_text = &module->Reference();
FP_TEXT* ref_text = &footprint->Reference();
ref_text->SetText( ValidateReference( m_name.text ) );
ref_text->SetType( FP_TEXT::TEXT_is_REFERENCE );
@ -542,98 +542,98 @@ void PCB_MODULE::AddToBoard()
ref_text->SetDrawCoord();
// value text
FP_TEXT* val_text = &module->Value();
FP_TEXT* val_text = &footprint->Value();
val_text->SetText( m_value.text );
val_text->SetText( m_Value.text );
val_text->SetType( FP_TEXT::TEXT_is_VALUE );
val_text->SetPos0( wxPoint( m_value.correctedPositionX, m_value.correctedPositionY ) );
if( m_value.isTrueType )
SetTextSizeFromTrueTypeFontHeight( val_text, m_value.textHeight );
val_text->SetPos0( wxPoint( m_Value.correctedPositionX, m_Value.correctedPositionY ) );
if( m_Value.isTrueType )
SetTextSizeFromTrueTypeFontHeight( val_text, m_Value.textHeight );
else
SetTextSizeFromStrokeFontHeight( val_text, m_value.textHeight );
SetTextSizeFromStrokeFontHeight( val_text, m_Value.textHeight );
r = m_value.textRotation - m_rotation;
r = m_Value.textRotation - m_rotation;
val_text->SetTextAngle( r );
val_text->SetKeepUpright( false );
val_text->SetItalic( m_value.isItalic );
val_text->SetTextThickness( m_value.textstrokeWidth );
val_text->SetItalic( m_Value.isItalic );
val_text->SetTextThickness( m_Value.textstrokeWidth );
val_text->SetMirrored( m_value.mirror );
val_text->SetVisible( m_value.textIsVisible );
val_text->SetMirrored( m_Value.mirror );
val_text->SetVisible( m_Value.textIsVisible );
val_text->SetLayer( m_value.mirror ? FlipLayer( m_KiCadLayer ) : m_KiCadLayer );
val_text->SetLayer( m_Value.mirror ? FlipLayer( m_KiCadLayer ) : m_KiCadLayer );
// Calculate the actual position.
val_text->SetDrawCoord();
// TEXTS
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_moduleObjects[i]->m_objType == wxT( 'T' ) )
if( m_FootprintItems[i]->m_objType == wxT( 'T' ) )
{
( (PCB_TEXT*) m_moduleObjects[i] )->m_tag = i + 2;
m_moduleObjects[ i ]->AddToFootprint( module );
( (PCB_TEXT*) m_FootprintItems[i] )->m_tag = i + 2;
m_FootprintItems[ i ]->AddToFootprint( footprint );
}
}
// FOOTPRINT LINES
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_moduleObjects[i]->m_objType == wxT( 'L' ) )
m_moduleObjects[ i ]->AddToFootprint( module );
if( m_FootprintItems[i]->m_objType == wxT( 'L' ) )
m_FootprintItems[ i ]->AddToFootprint( footprint );
}
// FOOTPRINT ARCS
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_moduleObjects[i]->m_objType == wxT( 'A' ) )
m_moduleObjects[ i ]->AddToFootprint( module );
if( m_FootprintItems[i]->m_objType == wxT( 'A' ) )
m_FootprintItems[ i ]->AddToFootprint( footprint );
}
// FOOTPRINT POLYGONS
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_moduleObjects[i]->m_objType == wxT( 'Z' ) )
m_moduleObjects[ i ]->AddToFootprint( module );
if( m_FootprintItems[i]->m_objType == wxT( 'Z' ) )
m_FootprintItems[ i ]->AddToFootprint( footprint );
}
// PADS
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_moduleObjects[i]->m_objType == wxT( 'P' ) )
((PCB_PAD*) m_moduleObjects[ i ] )->AddToFootprint( module, m_rotation, false );
if( m_FootprintItems[i]->m_objType == wxT( 'P' ) )
((PCB_PAD*) m_FootprintItems[ i ] )->AddToFootprint( footprint, m_rotation, false );
}
// VIAS
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_moduleObjects[i]->m_objType == wxT( 'V' ) )
((PCB_VIA*) m_moduleObjects[ i ] )->AddToFootprint( module, m_rotation, false );
if( m_FootprintItems[i]->m_objType == wxT( 'V' ) )
((PCB_VIA*) m_FootprintItems[ i ] )->AddToFootprint( footprint, m_rotation, false );
}
module->CalculateBoundingBox();
footprint->CalculateBoundingBox();
}
void PCB_MODULE::Flip()
void PCB_FOOTPRINT::Flip()
{
int i;
if( m_mirror == 1 )
if( m_Mirror == 1 )
{
m_rotation = -m_rotation;
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_moduleObjects[i]->m_objType == wxT( 'L' ) || // lines
m_moduleObjects[i]->m_objType == wxT( 'A' ) || // arcs
m_moduleObjects[i]->m_objType == wxT( 'Z' ) || // polygons
m_moduleObjects[i]->m_objType == wxT( 'P' ) || // pads
m_moduleObjects[i]->m_objType == wxT( 'V' ) ) // vias
if( m_FootprintItems[i]->m_objType == wxT( 'L' ) || // lines
m_FootprintItems[i]->m_objType == wxT( 'A' ) || // arcs
m_FootprintItems[i]->m_objType == wxT( 'Z' ) || // polygons
m_FootprintItems[i]->m_objType == wxT( 'P' ) || // pads
m_FootprintItems[i]->m_objType == wxT( 'V' ) ) // vias
{
m_moduleObjects[i]->Flip();
m_FootprintItems[i]->Flip();
}
}
}

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -37,34 +37,32 @@
namespace PCAD2KICAD {
class PCB_MODULE : public PCB_COMPONENT
class PCB_FOOTPRINT : public PCB_COMPONENT
{
public:
TTEXTVALUE m_value; // has reference (Name from parent) and value
PCB_COMPONENTS_ARRAY m_moduleObjects; // set of objects like PCB_LINE, PCB_PAD, PCB_VIA,....
int m_mirror;
VERTICES_ARRAY m_boardOutline;
TTEXTVALUE m_Value; // has reference (Name from parent) and value
PCB_COMPONENTS_ARRAY m_FootprintItems; // set of objects like PCB_LINE, PCB_PAD, PCB_VIA....
int m_Mirror;
VERTICES_ARRAY m_BoardOutline;
PCB_MODULE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_MODULE();
PCB_FOOTPRINT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_FOOTPRINT();
XNODE* FindModulePatternDefName( XNODE* aNode, const wxString& aName );
XNODE* FindModulePatternDefName( XNODE* aNode, const wxString& aName );
void DoLayerContentsObjects( XNODE* aNode,
PCB_MODULE* aPCBModule,
PCB_COMPONENTS_ARRAY* aList,
wxStatusBar* aStatusBar,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion );
void DoLayerContentsObjects( XNODE* aNode, PCB_FOOTPRINT* aFootprint,
PCB_COMPONENTS_ARRAY* aList, wxStatusBar* aStatusBar,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion );
void SetName( const wxString& aPin, const wxString& aName );
void SetName( const wxString& aPin, const wxString& aName );
virtual void Parse( XNODE* aNode, wxStatusBar* aStatusBar,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion );
virtual void Parse( XNODE* aNode, wxStatusBar* aStatusBar,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion );
virtual void Flip() override;
void AddToBoard() override;
virtual void Flip() override;
void AddToBoard() override;
private:
XNODE* FindPatternMultilayerSection( XNODE* aNode, wxString* aPatGraphRefName );

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -39,9 +39,9 @@ namespace PCAD2KICAD {
PCB_LINE::PCB_LINE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCB_COMPONENT( aCallbacks,
aBoard )
{
m_width = 0;
m_toX = 0;
m_toY = 0;
m_Width = 0;
m_ToX = 0;
m_ToY = 0;
m_objType = wxT( 'L' );
}
@ -63,9 +63,9 @@ void PCB_LINE::Parse( XNODE* aNode,
m_KiCadLayer = GetKiCadLayer();
m_positionX = 0;
m_positionY = 0;
m_toX = 0;
m_toY = 0;
m_width = 0;
m_ToX = 0;
m_ToY = 0;
m_Width = 0;
lNode = FindNode( aNode, wxT( "pt" ) );
if( lNode )
@ -77,12 +77,12 @@ void PCB_LINE::Parse( XNODE* aNode,
if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
&m_toX, &m_toY, aActualConversion );
&m_ToX, &m_ToY, aActualConversion );
lNode = FindNode( aNode, wxT( "width" ) );
if( lNode )
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_width, aActualConversion );
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Width, aActualConversion );
lNode = FindNode( aNode, wxT( "netNameRef" ) );
@ -101,8 +101,8 @@ void PCB_LINE::SetPosOffset( int aX_offs, int aY_offs )
{
PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs );
m_toX += aX_offs;
m_toY += aY_offs;
m_ToX += aX_offs;
m_ToY += aY_offs;
}
@ -110,7 +110,7 @@ void PCB_LINE::Flip()
{
PCB_COMPONENT::Flip();
m_toX = -m_toX;
m_ToX = -m_ToX;
m_KiCadLayer = FlipLayer( m_KiCadLayer );
}
@ -123,9 +123,9 @@ void PCB_LINE::AddToFootprint( FOOTPRINT* aFootprint )
aFootprint->Add( segment );
segment->m_Start0 = wxPoint( m_positionX, m_positionY );
segment->m_End0 = wxPoint( m_toX, m_toY );
segment->m_End0 = wxPoint( m_ToX, m_ToY );
segment->SetWidth( m_width );
segment->SetWidth( m_Width );
segment->SetLayer( m_KiCadLayer );
segment->SetDrawCoord();
@ -141,9 +141,9 @@ void PCB_LINE::AddToBoard()
m_board->Add( track );
track->SetPosition( wxPoint( m_positionX, m_positionY ) );
track->SetEnd( wxPoint( m_toX, m_toY ) );
track->SetEnd( wxPoint( m_ToX, m_ToY ) );
track->SetWidth( m_width );
track->SetWidth( m_Width );
track->SetLayer( m_KiCadLayer );
track->SetNetCode( m_netCode );
@ -155,8 +155,8 @@ void PCB_LINE::AddToBoard()
segment->SetLayer( m_KiCadLayer );
segment->SetStart( wxPoint( m_positionX, m_positionY ) );
segment->SetEnd( wxPoint( m_toX, m_toY ) );
segment->SetWidth( m_width );
segment->SetEnd( wxPoint( m_ToX, m_ToY ) );
segment->SetWidth( m_Width );
}
}

View File

@ -40,9 +40,9 @@ namespace PCAD2KICAD {
class PCB_LINE : public PCB_COMPONENT
{
public:
int m_width;
int m_toX;
int m_toY;
int m_Width;
int m_ToX;
int m_ToY;
PCB_LINE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_LINE();

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -35,8 +35,8 @@ namespace PCAD2KICAD {
PCB_NET_NODE::PCB_NET_NODE()
{
m_compRef = wxEmptyString;
m_pinRef = wxEmptyString;
m_CompRef = wxEmptyString;
m_PinRef = wxEmptyString;
}
@ -45,9 +45,9 @@ PCB_NET_NODE::~PCB_NET_NODE()
}
PCB_NET::PCB_NET( int aNetCode ) : m_netCode( aNetCode )
PCB_NET::PCB_NET( int aNetCode ) : m_NetCode( aNetCode )
{
m_name = wxEmptyString;
m_Name = wxEmptyString;
}
@ -55,9 +55,9 @@ PCB_NET::~PCB_NET()
{
int i;
for( i = 0; i < (int) m_netNodes.GetCount(); i++ )
for( i = 0; i < (int) m_NetNodes.GetCount(); i++ )
{
delete m_netNodes[i];
delete m_NetNodes[i];
}
}
@ -71,7 +71,7 @@ void PCB_NET::Parse( XNODE* aNode )
aNode->GetAttribute( wxT( "Name" ), &propValue );
propValue.Trim( false );
propValue.Trim( true );
m_name = propValue;
m_Name = propValue;
lNode = FindNode( aNode, wxT( "node" ) );
@ -90,12 +90,12 @@ void PCB_NET::Parse( XNODE* aNode )
netNode = new PCB_NET_NODE;
s1.Trim( false );
s1.Trim( true );
netNode->m_compRef = s1;
netNode->m_CompRef = s1;
s2.Trim( false );
s2.Trim( true );
netNode->m_pinRef = s2;
m_netNodes.Add( netNode );
netNode->m_PinRef = s2;
m_NetNodes.Add( netNode );
lNode = lNode->GetNext();
}
}

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -39,8 +39,8 @@ namespace PCAD2KICAD {
class PCB_NET_NODE : public wxObject
{
public:
wxString m_compRef;
wxString m_pinRef;
wxString m_CompRef;
wxString m_PinRef;
PCB_NET_NODE();
~PCB_NET_NODE();
@ -51,9 +51,9 @@ WX_DEFINE_ARRAY( PCB_NET_NODE*, PCB_NET_NODES_ARRAY );
class PCB_NET : public wxObject
{
public:
wxString m_name;
int m_netCode;
PCB_NET_NODES_ARRAY m_netNodes;
wxString m_Name;
int m_NetCode;
PCB_NET_NODES_ARRAY m_NetNodes;
PCB_NET( int aNetCode );
~PCB_NET();

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -38,9 +38,9 @@ PCB_PAD::PCB_PAD( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCB_COMPONENT( aCallbacks, aBoard )
{
m_objType = wxT( 'P' );
m_number = 0;
m_hole = 0;
m_isHolePlated = true;
m_Number = 0;
m_Hole = 0;
m_IsHolePlated = true;
m_defaultPinDes = wxEmptyString;
}
@ -49,8 +49,8 @@ PCB_PAD::~PCB_PAD()
{
int i;
for( i = 0; i < (int) m_shapes.GetCount(); i++ )
delete m_shapes[i];
for( i = 0; i < (int) m_Shapes.GetCount(); i++ )
delete m_Shapes[i];
}
@ -69,7 +69,7 @@ void PCB_PAD::Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit,
if( lNode )
{
lNode->GetNodeContent().ToLong( &num );
m_number = (int) num;
m_Number = (int) num;
}
lNode = FindNode( aNode, wxT( "padStyleRef" ) );
@ -146,10 +146,10 @@ void PCB_PAD::Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit,
cNode = FindNode( lNode, wxT( "holeDiam" ) );
if( cNode )
SetWidth( cNode->GetNodeContent(), aDefaultMeasurementUnit, &m_hole, aActualConversion );
SetWidth( cNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Hole, aActualConversion );
if( FindNodeGetContent( lNode, wxT( "isHolePlated" ) ) == wxT( "False" ) )
m_isHolePlated = false;
m_IsHolePlated = false;
cNode = FindNode( lNode, wxT( "padShape" ) );
@ -163,7 +163,7 @@ void PCB_PAD::Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit,
{
padShape = new PCB_PAD_SHAPE( m_callbacks, m_board );
padShape->Parse( cNode, aDefaultMeasurementUnit, aActualConversion );
m_shapes.Add( padShape );
m_Shapes.Add( padShape );
}
}
@ -181,8 +181,8 @@ void PCB_PAD::Flip()
if( m_objType == wxT( 'P' ) )
m_rotation = -m_rotation;
for( i = 0; i < (int)m_shapes.GetCount(); i++ )
m_shapes[i]->m_KiCadLayer = FlipLayer( m_shapes[i]->m_KiCadLayer );
for( i = 0; i < (int)m_Shapes.GetCount(); i++ )
m_Shapes[i]->m_KiCadLayer = FlipLayer( m_Shapes[i]->m_KiCadLayer );
}
@ -197,21 +197,21 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps
PAD* pad = new PAD( aFootprint );
if( !m_isHolePlated && m_hole )
if( !m_IsHolePlated && m_Hole )
{
// mechanical hole
pad->SetShape( PAD_SHAPE_CIRCLE );
pad->SetAttribute( PAD_ATTRIB_NPTH );
pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
pad->SetDrillSize( wxSize( m_hole, m_hole ) );
pad->SetSize( wxSize( m_hole, m_hole ) );
pad->SetDrillSize( wxSize( m_Hole, m_Hole ) );
pad->SetSize( wxSize( m_Hole, m_Hole ) );
// Mounting Hole: Solder Mask Margin from Top Layer Width size.
// Used the default zone clearance (simplify)
if( m_shapes.GetCount() && m_shapes[0]->m_shape == wxT( "MtHole" ) )
if( m_Shapes.GetCount() && m_Shapes[0]->m_Shape == wxT( "MtHole" ) )
{
int sm_margin = ( m_shapes[0]->m_width - m_hole ) / 2;
int sm_margin = ( m_Shapes[0]->m_Width - m_Hole ) / 2;
pad->SetLocalSolderMaskMargin( sm_margin );
pad->SetLocalClearance( sm_margin + Millimeter2iu( 0.254 ) );
}
@ -220,21 +220,21 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps
}
else
{
( m_hole ) ? padType = PAD_ATTRIB_PTH : padType = PAD_ATTRIB_SMD;
( m_Hole ) ? padType = PAD_ATTRIB_PTH : padType = PAD_ATTRIB_SMD;
// form layer mask
for( i = 0; i < (int) m_shapes.GetCount(); i++ )
for( i = 0; i < (int) m_Shapes.GetCount(); i++ )
{
padShape = m_shapes[i];
padShape = m_Shapes[i];
if( padShape->m_width > 0 && padShape->m_height > 0 )
if( padShape->m_Width > 0 && padShape->m_Height > 0 )
{
if( padShape->m_KiCadLayer == F_Cu ||
padShape->m_KiCadLayer == B_Cu )
{
padShapeName = padShape->m_shape;
width = padShape->m_width;
height = padShape->m_height;
padShapeName = padShape->m_Shape;
width = padShape->m_Width;
height = padShape->m_Height;
// assume this is SMD pad
if( padShape->m_KiCadLayer == F_Cu )
@ -280,7 +280,7 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps
pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
pad->SetOffset( wxPoint( 0, 0 ) );
pad->SetDrillSize( wxSize( m_hole, m_hole ) );
pad->SetDrillSize( wxSize( m_Hole, m_Hole ) );
pad->SetAttribute( padType );
@ -298,8 +298,8 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps
if( !aEncapsulatedPad )
{
// pad's "Position" is not relative to the module's,
// whereas Pos0 is relative to the module's but is the unrotated coordinate.
// pad's "Position" is not relative to the footprint's, whereas Pos0 is relative to
// the footprint's but is the unrotated coordinate.
wxPoint padpos( m_positionX, m_positionY );
pad->SetPos0( padpos );
RotatePoint( &padpos, aFootprint->GetOrientation() );
@ -320,17 +320,17 @@ void PCB_PAD::AddToBoard()
if( m_objType == wxT( 'V' ) ) // via
{
// choose one of the shapes
for( i = 0; i < (int) m_shapes.GetCount(); i++ )
for( i = 0; i < (int) m_Shapes.GetCount(); i++ )
{
padShape = m_shapes[i];
padShape = m_Shapes[i];
if( padShape->m_width > 0 && padShape->m_height > 0 )
if( padShape->m_Width > 0 && padShape->m_Height > 0 )
{
if( padShape->m_KiCadLayer == F_Cu
|| padShape->m_KiCadLayer == B_Cu )
{
width = padShape->m_width;
height = padShape->m_height;
width = padShape->m_Width;
height = padShape->m_Height;
break;
}
@ -351,7 +351,7 @@ void PCB_PAD::AddToBoard()
via->SetWidth( height );
via->SetViaType( VIATYPE::THROUGH );
via->SetLayerPair( F_Cu, B_Cu );
via->SetDrill( m_hole );
via->SetDrill( m_Hole );
via->SetLayer( m_KiCadLayer );
via->SetNetCode( m_netCode );
@ -359,14 +359,13 @@ void PCB_PAD::AddToBoard()
}
else // pad
{
FOOTPRINT* module = new FOOTPRINT( m_board );
m_board->Add( module, ADD_MODE::APPEND );
FOOTPRINT* footprint = new FOOTPRINT( m_board );
m_board->Add( footprint, ADD_MODE::APPEND );
m_name.text = m_defaultPinDes;
module->SetPosition( wxPoint( m_positionX, m_positionY ) );
AddToFootprint( module, 0, true );
footprint->SetPosition( wxPoint( m_positionX, m_positionY ) );
AddToFootprint( footprint, 0, true );
}
}

View File

@ -36,10 +36,10 @@ namespace PCAD2KICAD {
class PCB_PAD : public PCB_COMPONENT
{
public:
int m_number;
int m_hole;
bool m_isHolePlated;
PCB_PAD_SHAPES_ARRAY m_shapes;
int m_Number;
int m_Hole;
bool m_IsHolePlated;
PCB_PAD_SHAPES_ARRAY m_Shapes;
PCB_PAD( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_PAD();

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -38,9 +38,9 @@ namespace PCAD2KICAD {
PCB_PAD_SHAPE::PCB_PAD_SHAPE( PCB_CALLBACKS* aCallbacks,
BOARD* aBoard ) : PCB_COMPONENT( aCallbacks, aBoard )
{
m_shape = wxEmptyString;
m_width = 0;
m_height = 0;
m_Shape = wxEmptyString;
m_Width = 0;
m_Height = 0;
}
@ -64,7 +64,7 @@ void PCB_PAD_SHAPE::Parse( XNODE* aNode,
{
str = lNode->GetNodeContent();
str.Trim( false );
m_shape = str;
m_Shape = str;
}
lNode = FindNode( aNode, wxT( "layerNumRef" ) );
@ -77,25 +77,25 @@ void PCB_PAD_SHAPE::Parse( XNODE* aNode,
m_KiCadLayer = GetKiCadLayer();
if( m_shape == wxT( "Oval" )
|| m_shape == wxT( "Rect" )
|| m_shape == wxT( "Ellipse" )
|| m_shape == wxT( "MtHole" )
|| m_shape == wxT( "RndRect" ) )
if( m_Shape == wxT( "Oval" )
|| m_Shape == wxT( "Rect" )
|| m_Shape == wxT( "Ellipse" )
|| m_Shape == wxT( "MtHole" )
|| m_Shape == wxT( "RndRect" ) )
{
lNode = FindNode( aNode, wxT( "shapeWidth" ) );
if( lNode )
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_width,
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Width,
aActualConversion );
lNode = FindNode( aNode, wxT( "shapeHeight" ) );
if( lNode )
SetWidth(
lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_height, aActualConversion );
lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Height, aActualConversion );
}
else if( m_shape == wxT( "Polygon" ) )
else if( m_Shape == wxT( "Polygon" ) )
{
// aproximation to simplier pad shape .....
lNode = FindNode( aNode, wxT( "shapeOutline" ) );
@ -128,8 +128,8 @@ void PCB_PAD_SHAPE::Parse( XNODE* aNode,
lNode = lNode->GetNext();
}
m_width = maxX - minX;
m_height = maxY - minY;
m_Width = maxX - minX;
m_Height = maxY - minY;
}
}

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -40,18 +40,17 @@ namespace PCAD2KICAD {
class PCB_PAD_SHAPE : public PCB_COMPONENT
{
public:
wxString m_shape;
int m_width;
int m_height;
wxString m_Shape;
int m_Width;
int m_Height;
PCB_PAD_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_PAD_SHAPE();
virtual void Parse( XNODE* aNode,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion );
virtual void Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion );
void AddToBoard() override;
void AddToBoard() override;
};
WX_DEFINE_ARRAY( PCB_PAD_SHAPE*, PCB_PAD_SHAPES_ARRAY );

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -112,7 +112,7 @@ void PCB_VIA::Parse( XNODE* aNode,
lNode = FindNode( tNode, wxT( "holeDiam" ) );
if( lNode )
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_hole,
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Hole,
aActualConversion );
lNode = FindNode( tNode, wxT( "viaShape" ) );
@ -127,7 +127,7 @@ void PCB_VIA::Parse( XNODE* aNode,
{
viaShape = new PCB_VIA_SHAPE( m_callbacks, m_board );
viaShape->Parse( lNode, aDefaultMeasurementUnit, aActualConversion );
m_shapes.Add( viaShape );
m_Shapes.Add( viaShape );
}
}

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -40,12 +40,10 @@ namespace PCAD2KICAD {
class PCB_VIA : public PCB_PAD
{
public:
PCB_VIA( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_VIA();
virtual void Parse( XNODE* aNode,
const wxString& aDefaultMeasurementUnit,
virtual void Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion ) override;
};

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -59,7 +59,7 @@ void PCB_VIA_SHAPE::Parse( XNODE* aNode,
{
str = lNode->GetNodeContent();
str.Trim( false );
m_shape = str;
m_Shape = str;
}
lNode = FindNode( aNode, wxT( "layerNumRef" ) );
@ -74,12 +74,12 @@ void PCB_VIA_SHAPE::Parse( XNODE* aNode,
lNode = FindNode( aNode, wxT( "shapeWidth" ) );
if( lNode )
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_width, aActualConversion );
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Width, aActualConversion );
lNode = FindNode( aNode, wxT( "shapeHeight" ) );
if( lNode )
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_height, aActualConversion );
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Height, aActualConversion );
}

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -42,8 +42,7 @@ public:
PCB_VIA_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_VIA_SHAPE();
virtual void Parse( XNODE* aNode,
const wxString& aDefaultMeasurementUnit,
virtual void Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion ) override;
};

View File

@ -78,9 +78,9 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard )
// Same as KiCad now except for B_Cu
unsigned layerCount = aBoard->GetCopperLayerCount();
layerIds.clear();
pcbLayer2kicad.resize( layerCount );
kicadLayer2pcb.resize( B_Cu + 1 );
m_layerIds.clear();
m_pcbLayer2kicad.resize( layerCount );
m_kicadLayer2pcb.resize( B_Cu + 1 );
#if 0 // was:
for( LAYER_NUM kiNdx = layerCount - 1, pcbNdx=FIRST_LAYER;
@ -99,22 +99,22 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard )
// establish bi-directional mapping between KiCad's BOARD layer and PCB layer
for( unsigned i = 0; i < kicadLayer2pcb.size(); ++i )
for( unsigned i = 0; i < m_kicadLayer2pcb.size(); ++i )
{
if( i < layerCount-1 )
kicadLayer2pcb[i] = i;
m_kicadLayer2pcb[i] = i;
else
kicadLayer2pcb[i] = layerCount - 1;
m_kicadLayer2pcb[i] = layerCount - 1;
}
for( unsigned i = 0; i < pcbLayer2kicad.size(); ++i )
for( unsigned i = 0; i < m_pcbLayer2kicad.size(); ++i )
{
PCB_LAYER_ID id = ( i < layerCount-1 ) ? ToLAYER_ID( i ) : B_Cu;
pcbLayer2kicad[i] = id;
m_pcbLayer2kicad[i] = id;
// save the specctra layer name in SPECCTRA_DB::layerIds for later.
layerIds.push_back( TO_UTF8( aBoard->GetLayerName( id ) ) );
m_layerIds.push_back(TO_UTF8( aBoard->GetLayerName( id ) ) );
}
#endif
@ -123,9 +123,9 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard )
int SPECCTRA_DB::findLayerName( const std::string& aLayerName ) const
{
for( int i=0; i < int(layerIds.size()); ++i )
for( int i=0; i < int( m_layerIds.size()); ++i )
{
if( 0 == aLayerName.compare( layerIds[i] ) )
if( 0 == aLayerName.compare( m_layerIds[i] ) )
return i;
}
return -1;
@ -254,7 +254,7 @@ void SPECCTRA_DB::LoadPCB( const wxString& aFilename )
SetPCB( new PCB() );
doPCB( pcb );
doPCB( m_pcb );
PopReader();
}
@ -273,7 +273,7 @@ void SPECCTRA_DB::LoadSESSION( const wxString& aFilename )
SetSESSION( new SESSION() );
doSESSION( session );
doSESSION( m_session );
PopReader();
}
@ -420,7 +420,7 @@ void SPECCTRA_DB::doPARSER( PARSER* growth )
Expecting( T_QUOTE_DEF );
SetStringDelimiter( (unsigned char) *CurText() );
growth->string_quote = *CurText();
quote_char = CurText();
m_quote_char = CurText();
NeedRIGHT();
break;
@ -1400,12 +1400,12 @@ void SPECCTRA_DB::doRULE( RULE* growth )
builder += ' ';
if( tok==T_STRING )
builder += quote_char;
builder += m_quote_char;
builder += CurText();
if( tok==T_STRING )
builder += quote_char;
builder += m_quote_char;
}
// When the nested rule is closed with a T_RIGHT and we are back down
@ -2576,12 +2576,12 @@ void SPECCTRA_DB::doCLASS( CLASS* growth )
builder += ' ';
if( tok==T_STRING )
builder += quote_char;
builder += m_quote_char;
builder += CurText();
if( tok==T_STRING )
builder += quote_char;
builder += m_quote_char;
}
// When the nested rule is closed with a T_RIGHT and we are back down
@ -3441,25 +3441,25 @@ void SPECCTRA_DB::doSUPPLY_PIN( SUPPLY_PIN* growth )
void SPECCTRA_DB::ExportPCB( const wxString& aFilename, bool aNameChange )
{
if( pcb )
if( m_pcb )
{
FILE_OUTPUTFORMATTER formatter( aFilename, wxT( "wt" ), quote_char[0] );
FILE_OUTPUTFORMATTER formatter( aFilename, wxT( "wt" ), m_quote_char[0] );
if( aNameChange )
pcb->pcbname = TO_UTF8( aFilename );
m_pcb->pcbname = TO_UTF8( aFilename );
pcb->Format( &formatter, 0 );
m_pcb->Format( &formatter, 0 );
}
}
void SPECCTRA_DB::ExportSESSION( const wxString& aFilename )
{
if( session )
if( m_session )
{
FILE_OUTPUTFORMATTER formatter( aFilename, wxT( "wt" ), quote_char[0] );
FILE_OUTPUTFORMATTER formatter( aFilename, wxT( "wt" ), m_quote_char[0] );
session->Format( &formatter, 0 );
m_session->Format( &formatter, 0 );
}
}

Some files were not shown because too many files have changed in this diff Show More