Naming conventions. (No functional changes.)

This commit is contained in:
Jeff Young 2023-04-01 21:05:58 +01:00
parent 054de5687c
commit b78e0a55b1
35 changed files with 416 additions and 424 deletions

View File

@ -9,15 +9,15 @@ set( PCAD2PCBNEW_SRCS
pcad_pcb.cpp
pcad_arc.cpp
pcad_pcb_component.cpp
pcb_copper_pour.cpp
pcb_cutout.cpp
pcb_keepout.cpp
pcad_copper_pour.cpp
pcad_cutout.cpp
pcad_keepout.cpp
pcad_line.cpp
pcad_footprint.cpp
pcb_net.cpp
pcad_nets.cpp
pcad_pad.cpp
pcad_pad_shape.cpp
pcb_plane.cpp
pcad_plane.cpp
pcad_polygon.cpp
pcad_text.cpp
pcad_via.cpp

View File

@ -36,10 +36,10 @@
namespace PCAD2KICAD {
PCAD_ARC::PCAD_ARC( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCAD_ARC::PCAD_ARC( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCAD_PCB_COMPONENT( aCallbacks, aBoard )
{
m_objType = wxT( 'A' );
m_ObjType = wxT( 'A' );
m_StartX = 0;
m_StartY = 0;
m_Angle = ANGLE_0;
@ -75,7 +75,7 @@ void PCAD_ARC::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
if( lNode )
{
SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_positionX, &m_positionY,
SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_PositionX, &m_PositionY,
aActualConversion );
}
@ -99,7 +99,7 @@ void PCAD_ARC::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
aActualConversion );
}
VECTOR2I position( m_positionX, m_positionY );
VECTOR2I position( m_PositionX, m_PositionY );
VECTOR2I start( m_StartX, m_StartY );
if( start == end )
@ -121,7 +121,7 @@ void PCAD_ARC::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
if( lNode )
{
SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_positionX, &m_positionY,
SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_PositionX, &m_PositionY,
aActualConversion );
}
@ -146,8 +146,8 @@ void PCAD_ARC::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
if( lNode )
m_Angle = EDA_ANGLE( StrToInt1Units( lNode->GetNodeContent() ), TENTHS_OF_A_DEGREE_T );
m_StartX = m_positionX + KiROUND( r * a.Cos() );
m_StartY = m_positionY - KiROUND( r * a.Sin() );
m_StartX = m_PositionX + KiROUND( r * a.Cos() );
m_StartY = m_PositionY - KiROUND( r * a.Sin() );
}
}
@ -177,7 +177,7 @@ void PCAD_ARC::AddToBoard( FOOTPRINT* aFootprint )
PCB_SHAPE* arc = new PCB_SHAPE( aFootprint, IsCircle() ? SHAPE_T::CIRCLE : SHAPE_T::ARC );
aFootprint->Add( arc );
arc->SetCenter( VECTOR2I( m_positionX, m_positionY ) );
arc->SetCenter( VECTOR2I( m_PositionX, m_PositionY ) );
arc->SetStart( VECTOR2I( m_StartX, m_StartY ) );
arc->SetArcAngleAndEnd( -m_Angle, true );

View File

@ -38,7 +38,7 @@ namespace PCAD2KICAD {
class PCAD_ARC : public PCAD_PCB_COMPONENT
{
public:
PCAD_ARC( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
PCAD_ARC( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCAD_ARC();
virtual void Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
@ -50,13 +50,14 @@ public:
void AddToBoard( FOOTPRINT* aFootprint = nullptr ) override;
private:
bool IsCircle();
public:
int m_StartX;
int m_StartY;
EDA_ANGLE m_Angle;
int m_Width;
private:
bool IsCircle();
};
} // namespace PCAD2KICAD

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, 2022 KiCad Developers, see AUTHORS.TXT for contributors.
* Copyright (C) 2012, 2023 KiCad Developers, see AUTHORS.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
@ -23,12 +23,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file pcb_callbacks.h
*/
#ifndef PCB_CALLBACKS_H_
#define PCB_CALLBACKS_H_
#ifndef PCAD_CALLBACKS_H
#define PCAD_CALLBACKS_H
#include <layer_ids.h>
@ -50,11 +46,10 @@ struct TLAYER
namespace PCAD2KICAD
{
class PCB_CALLBACKS
class PCAD_CALLBACKS
{
public:
virtual ~PCB_CALLBACKS()
virtual ~PCAD_CALLBACKS()
{
}
@ -65,4 +60,4 @@ namespace PCAD2KICAD
};
}
#endif // PCB_CALLBACKS_H_
#endif // PCAD_CALLBACKS_H

View File

@ -23,7 +23,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <pcad/pcb_copper_pour.h>
#include <pcad/pcad_copper_pour.h>
#include <common.h>
#include <xnode.h>
@ -32,20 +32,20 @@
namespace PCAD2KICAD {
PCB_COPPER_POUR::PCB_COPPER_POUR( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer ) :
PCAD_COPPER_POUR::PCAD_COPPER_POUR( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer ) :
PCAD_POLYGON( aCallbacks, aBoard, aPCadLayer )
{
m_filled = false;
}
PCB_COPPER_POUR::~PCB_COPPER_POUR()
PCAD_COPPER_POUR::~PCAD_COPPER_POUR()
{
}
bool PCB_COPPER_POUR::Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion )
bool PCAD_COPPER_POUR::Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion )
{
XNODE* lNode;
wxString pourType, str, propValue;
@ -58,13 +58,13 @@ bool PCB_COPPER_POUR::Parse( XNODE* aNode, const wxString& aDefaultUnits,
lNode->GetAttribute( wxT( "Name" ), &propValue );
propValue.Trim( false );
propValue.Trim( true );
m_net = propValue;
m_netCode = GetNetCode( m_net );
m_Net = propValue;
m_NetCode = GetNetCode( m_Net );
}
if( FindNode( aNode, wxT( "width" ) ) )
{
SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(), aDefaultUnits, &m_width,
SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(), aDefaultUnits, &m_Width,
aActualConversion );
}
@ -92,10 +92,10 @@ bool PCB_COPPER_POUR::Parse( XNODE* aNode, const wxString& aDefaultUnits,
if( lNode )
{
// retrieve copper pour outline
FormPolygon( lNode, &m_outline, aDefaultUnits, aActualConversion );
FormPolygon( lNode, &m_Outline, aDefaultUnits, aActualConversion );
m_positionX = m_outline[0]->x;
m_positionY = m_outline[0]->y;
m_PositionX = m_Outline[0]->x;
m_PositionY = m_Outline[0]->y;
}
else
{

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 AUTHORS.TXT for contributors.
* Copyright (C) 2012-2023 KiCad Developers, see AUTHORS.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
@ -23,8 +23,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PCB_COPPER_POUR_H_
#define PCB_COPPER_POUR_H_
#ifndef PCAD_COPPER_POUR_H
#define PCAD_COPPER_POUR_H
#include <pcad/pcad_polygon.h>
@ -34,11 +34,11 @@ class XNODE;
namespace PCAD2KICAD {
class PCB_COPPER_POUR : public PCAD_POLYGON
class PCAD_COPPER_POUR : public PCAD_POLYGON
{
public:
PCB_COPPER_POUR( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCB_COPPER_POUR();
PCAD_COPPER_POUR( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCAD_COPPER_POUR();
virtual bool Parse( XNODE* aNode,
const wxString& aDefaultUnits,
@ -47,4 +47,4 @@ public:
} // namespace PCAD2KICAD
#endif // PCB_COPPER_POUR_H_
#endif // PCAD_COPPER_POUR_H

View File

@ -27,7 +27,7 @@
* @file pcb_cutout.cpp
*/
#include <pcad/pcb_cutout.h>
#include <pcad/pcad_cutout.h>
#include <xnode.h>
@ -36,33 +36,29 @@
namespace PCAD2KICAD {
PCB_CUTOUT::PCB_CUTOUT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer ) :
PCAD_CUTOUT::PCAD_CUTOUT( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer ) :
PCAD_POLYGON( aCallbacks, aBoard, aPCadLayer )
{
m_objType = wxT( 'C' );
m_ObjType = wxT( 'C' );
}
PCB_CUTOUT::~PCB_CUTOUT()
PCAD_CUTOUT::~PCAD_CUTOUT()
{
}
bool PCB_CUTOUT::Parse( XNODE* aNode,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion )
bool PCAD_CUTOUT::Parse( XNODE* aNode,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion )
{
XNODE* lNode;
lNode = FindNode( aNode, wxT( "pcbPoly" ) );
if( lNode )
if( XNODE* lNode = FindNode( aNode, wxT( "pcbPoly" ) ) )
{
// retrieve cutout outline
FormPolygon( lNode, &m_outline, aDefaultMeasurementUnit, aActualConversion );
FormPolygon( lNode, &m_Outline, aDefaultMeasurementUnit, aActualConversion );
m_positionX = m_outline[0]->x;
m_positionY = m_outline[0]->y;
m_PositionX = m_Outline[0]->x;
m_PositionY = m_Outline[0]->y;
}
else
{

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 AUTHORS.TXT for contributors.
* Copyright (C) 2012-2023 KiCad Developers, see AUTHORS.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
@ -23,8 +23,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PCB_CUTOUT_H_
#define PCB_CUTOUT_H_
#ifndef PCAD_CUTOUT_H
#define PCAD_CUTOUT_H
#include <pcad/pcad_polygon.h>
@ -34,11 +34,11 @@ class XNODE;
namespace PCAD2KICAD {
class PCB_CUTOUT : public PCAD_POLYGON
class PCAD_CUTOUT : public PCAD_POLYGON
{
public:
PCB_CUTOUT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCB_CUTOUT();
PCAD_CUTOUT( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCAD_CUTOUT();
virtual bool Parse( XNODE* aNode,
const wxString& aDefaultMeasurementUnit,

View File

@ -24,9 +24,9 @@
*/
#include <pcad/pcad_arc.h>
#include <pcad/pcb_copper_pour.h>
#include <pcad/pcb_cutout.h>
#include <pcad/pcb_plane.h>
#include <pcad/pcad_copper_pour.h>
#include <pcad/pcad_cutout.h>
#include <pcad/pcad_plane.h>
#include <pcad/pcad_line.h>
#include <pcad/pcad_footprint.h>
#include <pcad/pcad_pad.h>
@ -45,12 +45,12 @@
namespace PCAD2KICAD {
PCAD_FOOTPRINT::PCAD_FOOTPRINT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCAD_FOOTPRINT::PCAD_FOOTPRINT( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCAD_PCB_COMPONENT( aCallbacks, aBoard )
{
InitTTextValue( &m_Value );
m_Mirror = 0;
m_objType = wxT( 'M' ); // FOOTPRINT
m_ObjType = wxT( 'M' ); // FOOTPRINT
m_KiCadLayer = F_SilkS; // default
}
@ -216,24 +216,25 @@ XNODE* PCAD_FOOTPRINT::FindPatternMultilayerSection( XNODE* aNode, wxString* aPa
void PCAD_FOOTPRINT::DoLayerContentsObjects( XNODE* aNode, PCAD_FOOTPRINT* aFootprint,
PCB_COMPONENTS_ARRAY* aList, wxStatusBar* aStatusBar,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion )
PCAD_COMPONENTS_ARRAY* aList, wxStatusBar* aStatusBar,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion )
{
PCAD_ARC* arc;
PCAD_POLYGON* polygon;
PCAD_POLYGON*plane_layer = nullptr;
PCB_COPPER_POUR* copperPour;
PCB_CUTOUT* cutout;
PCB_PLANE* plane;
VERTICES_ARRAY* plane_layer_polygon;
PCAD_LINE* line;
PCAD_TEXT* text;
XNODE* lNode, * tNode;
wxString propValue;
long long i;
int PCadLayer;
long num = 0;
PCAD_ARC* arc;
PCAD_POLYGON* polygon;
PCAD_POLYGON* plane_layer = nullptr;
PCAD_COPPER_POUR* copperPour;
PCAD_CUTOUT* cutout;
PCAD_PLANE* plane;
VERTICES_ARRAY* plane_layer_polygon;
PCAD_LINE* line;
PCAD_TEXT* text;
XNODE* lNode;
XNODE* tNode;
wxString propValue;
long long i;
int PCadLayer;
long num = 0;
i = 0;
@ -292,12 +293,12 @@ void PCAD_FOOTPRINT::DoLayerContentsObjects( XNODE* aNode, PCAD_FOOTPRINT* aFoot
{
// TODO: to understand and may be repair
// Alexander Lunev: originally in Delphi version of the project there was
// a strange access to pcbModule->m_name (it was global variable). This access
// a strange access to pcbModule->m_Name (it was global variable). This access
// is necessary when the function DoLayerContentsObjects() is called from
// function CreatePCBModule(). However it is not clear whether the access is
// required when the function DoLayerContentsObjects() is called from
// function ProcessXMLtoPCBLib().
SetFontProperty( tNode, &aFootprint->m_name, aDefaultMeasurementUnit,
SetFontProperty( tNode, &aFootprint->m_Name, aDefaultMeasurementUnit,
aActualConversion );
}
}
@ -318,7 +319,7 @@ void PCAD_FOOTPRINT::DoLayerContentsObjects( XNODE* aNode, PCAD_FOOTPRINT* aFoot
plane_layer_polygon = new VERTICES_ARRAY;
plane_layer->FormPolygon( lNode, plane_layer_polygon, aDefaultMeasurementUnit,
aActualConversion );
plane_layer->m_cutouts.Add( plane_layer_polygon );
plane_layer->m_Cutouts.Add( plane_layer_polygon );
}
else
{
@ -333,7 +334,7 @@ void PCAD_FOOTPRINT::DoLayerContentsObjects( XNODE* aNode, PCAD_FOOTPRINT* aFoot
if( lNode->GetName() == wxT( "copperPour95" ) )
{
copperPour = new PCB_COPPER_POUR( m_callbacks, m_board, PCadLayer );
copperPour = new PCAD_COPPER_POUR( m_callbacks, m_board, PCadLayer );
if( copperPour->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
aList->Add( copperPour );
@ -343,7 +344,7 @@ void PCAD_FOOTPRINT::DoLayerContentsObjects( XNODE* aNode, PCAD_FOOTPRINT* aFoot
if( lNode->GetName() == wxT( "polyCutOut" ) )
{
cutout = new PCB_CUTOUT( m_callbacks, m_board, PCadLayer );
cutout = new PCAD_CUTOUT( m_callbacks, m_board, PCadLayer );
if( cutout->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
aList->Add( cutout );
@ -353,7 +354,7 @@ void PCAD_FOOTPRINT::DoLayerContentsObjects( XNODE* aNode, PCAD_FOOTPRINT* aFoot
if( lNode->GetName() == wxT( "planeObj" ) )
{
plane = new PCB_PLANE( m_callbacks, m_board, PCadLayer );
plane = new PCAD_PLANE( m_callbacks, m_board, PCadLayer );
if( plane->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ) )
aList->Add( plane );
@ -375,10 +376,10 @@ void PCAD_FOOTPRINT::SetName( const wxString& aPin, const wxString& aName )
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_FootprintItems[i]->m_objType == wxT( 'P' ) )
if( m_FootprintItems[i]->m_ObjType == wxT( 'P' ) )
{
if( ( (PCAD_PAD*) m_FootprintItems[i] )->m_Number == num )
( (PCAD_PAD*) m_FootprintItems[i] )->m_name.text = aName;
( (PCAD_PAD*) m_FootprintItems[i] )->m_Name.text = aName;
}
}
}
@ -395,11 +396,11 @@ void PCAD_FOOTPRINT::Parse( XNODE* aNode, wxStatusBar* aStatusBar,
FindNode( aNode, wxT( "originalName" ) )->GetAttribute( wxT( "Name" ), &propValue );
propValue.Trim( false );
m_name.text = propValue;
m_Name.text = propValue;
// aStatusBar->SetStatusText( wxT( "Creating Component : " ) + m_name.text );
// aStatusBar->SetStatusText( wxT( "Creating Component : " ) + m_Name.text );
lNode = aNode;
lNode = FindPatternMultilayerSection( lNode, &m_patGraphRefName );
lNode = FindPatternMultilayerSection( lNode, &m_PatGraphRefName );
if( lNode )
{
@ -484,46 +485,46 @@ void PCAD_FOOTPRINT::AddToBoard( FOOTPRINT* aFootprint )
EDA_ANGLE r;
// transform text positions
CorrectTextPosition( &m_name );
RotatePoint( &m_name.correctedPositionX, &m_name.correctedPositionY, -m_rotation );
CorrectTextPosition( &m_Name );
RotatePoint( &m_Name.correctedPositionX, &m_Name.correctedPositionY, -m_Rotation );
CorrectTextPosition( &m_Value );
RotatePoint( &m_Value.correctedPositionX, &m_Value.correctedPositionY, -m_rotation );
RotatePoint( &m_Value.correctedPositionX, &m_Value.correctedPositionY, -m_Rotation );
FOOTPRINT* footprint = new FOOTPRINT( m_board );
m_board->Add( footprint, ADD_MODE::APPEND );
footprint->SetPosition( VECTOR2I( m_positionX, m_positionY ) );
footprint->SetPosition( VECTOR2I( m_PositionX, m_PositionY ) );
footprint->SetLayer( m_Mirror ? B_Cu : F_Cu );
footprint->SetOrientation( m_rotation );
footprint->SetOrientation( m_Rotation );
LIB_ID fpID;
fpID.Parse( m_compRef, true );
fpID.Parse( m_CompRef, true );
footprint->SetFPID( fpID );
// reference text
PCB_TEXT* ref_text = &footprint->Reference();
ref_text->SetText( ValidateReference( m_name.text ) );
ref_text->SetText( ValidateReference( m_Name.text ) );
ref_text->SetType( PCB_TEXT::TEXT_is_REFERENCE );
ref_text->SetFPRelativePosition( VECTOR2I( m_name.correctedPositionX,
m_name.correctedPositionY ) );
ref_text->SetFPRelativePosition( VECTOR2I( m_Name.correctedPositionX,
m_Name.correctedPositionY ) );
if( m_name.isTrueType )
SetTextSizeFromTrueTypeFontHeight( ref_text, m_name.textHeight );
if( m_Name.isTrueType )
SetTextSizeFromTrueTypeFontHeight( ref_text, m_Name.textHeight );
else
SetTextSizeFromStrokeFontHeight( ref_text, m_name.textHeight );
SetTextSizeFromStrokeFontHeight( ref_text, m_Name.textHeight );
r = m_name.textRotation - m_rotation;
r = m_Name.textRotation - m_Rotation;
ref_text->SetTextAngle( r );
ref_text->SetKeepUpright( false );
ref_text->SetItalic( m_name.isItalic );
ref_text->SetTextThickness( m_name.textstrokeWidth );
ref_text->SetItalic( m_Name.isItalic );
ref_text->SetTextThickness( m_Name.textstrokeWidth );
ref_text->SetMirrored( m_name.mirror );
ref_text->SetVisible( m_name.textIsVisible );
ref_text->SetMirrored( m_Name.mirror );
ref_text->SetVisible( m_Name.textIsVisible );
ref_text->SetLayer( m_Mirror ? FlipLayer( m_KiCadLayer ) : m_KiCadLayer );
@ -541,7 +542,7 @@ void PCAD_FOOTPRINT::AddToBoard( FOOTPRINT* aFootprint )
else
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 );
@ -556,46 +557,43 @@ void PCAD_FOOTPRINT::AddToBoard( FOOTPRINT* aFootprint )
// TEXTS
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_FootprintItems[i]->m_objType == wxT( 'T' ) )
{
( (PCAD_TEXT*) m_FootprintItems[i] )->m_tag = i + 2;
if( m_FootprintItems[i]->m_ObjType == wxT( 'T' ) )
m_FootprintItems[ i ]->AddToBoard( footprint );
}
}
// FOOTPRINT LINES
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_FootprintItems[i]->m_objType == wxT( 'L' ) )
if( m_FootprintItems[i]->m_ObjType == wxT( 'L' ) )
m_FootprintItems[ i ]->AddToBoard( footprint );
}
// FOOTPRINT ARCS
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_FootprintItems[i]->m_objType == wxT( 'A' ) )
if( m_FootprintItems[i]->m_ObjType == wxT( 'A' ) )
m_FootprintItems[ i ]->AddToBoard( footprint );
}
// FOOTPRINT POLYGONS
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_FootprintItems[i]->m_objType == wxT( 'Z' ) )
if( m_FootprintItems[i]->m_ObjType == wxT( 'Z' ) )
m_FootprintItems[ i ]->AddToBoard( footprint );
}
// PADS
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_FootprintItems[i]->m_objType == wxT( 'P' ) )
((PCAD_PAD*) m_FootprintItems[ i ] )->AddToFootprint( footprint, m_rotation, false );
if( m_FootprintItems[i]->m_ObjType == wxT( 'P' ) )
((PCAD_PAD*) m_FootprintItems[ i ] )->AddToFootprint( footprint, m_Rotation, false );
}
// VIAS
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
if( m_FootprintItems[i]->m_objType == wxT( 'V' ) )
((PCAD_VIA*) m_FootprintItems[ i ] )->AddToFootprint( footprint, m_rotation, false );
if( m_FootprintItems[i]->m_ObjType == wxT( 'V' ) )
((PCAD_VIA*) m_FootprintItems[ i ] )->AddToFootprint( footprint, m_Rotation, false );
}
}
@ -606,15 +604,15 @@ void PCAD_FOOTPRINT::Flip()
if( m_Mirror == 1 )
{
m_rotation = -m_rotation;
m_Rotation = -m_Rotation;
for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ )
{
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
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_FootprintItems[i]->Flip();
}

View File

@ -41,13 +41,13 @@ namespace PCAD2KICAD {
class PCAD_FOOTPRINT : public PCAD_PCB_COMPONENT
{
public:
PCAD_FOOTPRINT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
PCAD_FOOTPRINT( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCAD_FOOTPRINT();
XNODE* FindModulePatternDefName( XNODE* aNode, const wxString& aName );
void DoLayerContentsObjects( XNODE* aNode, PCAD_FOOTPRINT* aFootprint,
PCB_COMPONENTS_ARRAY* aList, wxStatusBar* aStatusBar,
PCAD_COMPONENTS_ARRAY* aList, wxStatusBar* aStatusBar,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion );
@ -60,13 +60,14 @@ public:
virtual void Flip() override;
void AddToBoard( FOOTPRINT* aFootprint = nullptr ) override;
TTEXTVALUE m_Value; // has reference (Name from parent) and value
PCB_COMPONENTS_ARRAY m_FootprintItems; // set of objects like PCAD_LINE, PCAD_PAD, PCAD_VIA....
int m_Mirror;
VERTICES_ARRAY m_BoardOutline;
private:
XNODE* FindPatternMultilayerSection( XNODE* aNode, wxString* aPatGraphRefName );
public:
TTEXTVALUE m_Value; // has reference (Name from parent) and value
PCAD_COMPONENTS_ARRAY m_FootprintItems; // set of objects like PCAD_LINE, PCAD_PAD, PCAD_VIA....
int m_Mirror;
VERTICES_ARRAY m_BoardOutline;
};
} // namespace PCAD2KICAD

View File

@ -36,14 +36,14 @@ WX_DEFINE_ARRAY( VERTICES_ARRAY*, ISLANDS_ARRAY );
namespace PCAD2KICAD {
class PCAD_PCB_COMPONENT;
class PCB_NET;
class PCB_NET_NODE;
class PCAD_NET;
class PCAD_NET_NODE;
class PCAD_PAD_SHAPE;
WX_DEFINE_ARRAY( PCAD_PCB_COMPONENT*, PCB_COMPONENTS_ARRAY );
WX_DEFINE_ARRAY( PCB_NET*, PCB_NETS_ARRAY );
WX_DEFINE_ARRAY( PCB_NET_NODE*, PCB_NET_NODES_ARRAY );
WX_DEFINE_ARRAY( PCAD_PAD_SHAPE*, PCB_PAD_SHAPES_ARRAY );
WX_DEFINE_ARRAY( PCAD_PCB_COMPONENT*, PCAD_COMPONENTS_ARRAY );
WX_DEFINE_ARRAY( PCAD_NET*, PCAD_NETS_ARRAY );
WX_DEFINE_ARRAY( PCAD_NET_NODE*, PCAD_NET_NODES_ARRAY );
WX_DEFINE_ARRAY( PCAD_PAD_SHAPE*, PCAD_PAD_SHAPES_ARRAY );
}
#endif

View File

@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <pcad/pcb_keepout.h>
#include <pcad/pcad_keepout.h>
#include <common.h>
#include <xnode.h>
@ -31,23 +31,21 @@
namespace PCAD2KICAD {
PCB_KEEPOUT::PCB_KEEPOUT( PCB_CALLBACKS* aCallbacks,
BOARD* aBoard,
int aPCadLayer ) :
PCAD_KEEPOUT::PCAD_KEEPOUT( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer ) :
PCAD_POLYGON( aCallbacks, aBoard, aPCadLayer )
{
m_objType = wxT( 'K' );
m_ObjType = wxT( 'K' );
}
PCB_KEEPOUT::~PCB_KEEPOUT()
PCAD_KEEPOUT::~PCAD_KEEPOUT()
{
}
bool PCB_KEEPOUT::Parse( XNODE* aNode,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion )
bool PCAD_KEEPOUT::Parse( XNODE* aNode,
const wxString& aDefaultMeasurementUnit,
const wxString& aActualConversion )
{
XNODE* lNode;
@ -56,10 +54,10 @@ bool PCB_KEEPOUT::Parse( XNODE* aNode,
if( lNode )
{
// retrieve keepOut outline
FormPolygon( lNode, &m_outline, aDefaultMeasurementUnit, aActualConversion );
FormPolygon( lNode, &m_Outline, aDefaultMeasurementUnit, aActualConversion );
m_positionX = m_outline[0]->x;
m_positionY = m_outline[0]->y;
m_PositionX = m_Outline[0]->x;
m_PositionY = m_Outline[0]->y;
}
else
{

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see AUTHORS.TXT for contributors.
* Copyright (C) 2012-2023 KiCad Developers, see AUTHORS.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
@ -22,8 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PCB_KEEPOUT_H_
#define PCB_KEEPOUT_H_
#ifndef PCAD_KEEPOUT_H
#define PCAD_KEEPOUT_H
#include <pcad/pcad_polygon.h>
@ -33,11 +33,11 @@ class XNODE;
namespace PCAD2KICAD {
class PCB_KEEPOUT : public PCAD_POLYGON
class PCAD_KEEPOUT : public PCAD_POLYGON
{
public:
PCB_KEEPOUT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCB_KEEPOUT();
PCAD_KEEPOUT( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCAD_KEEPOUT();
virtual bool Parse( XNODE* aNode,
const wxString& aDefaultMeasurementUnit,
@ -46,4 +46,4 @@ public:
} // namespace PCAD2KICAD
#endif // PCB_KEEPOUT_H_
#endif // PCAD_KEEPOUT_H

View File

@ -36,13 +36,13 @@
namespace PCAD2KICAD {
PCAD_LINE::PCAD_LINE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCAD_LINE::PCAD_LINE( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCAD_PCB_COMPONENT( aCallbacks, aBoard )
{
m_Width = 0;
m_ToX = 0;
m_ToY = 0;
m_objType = wxT( 'L' );
m_ObjType = wxT( 'L' );
}
@ -59,8 +59,8 @@ void PCAD_LINE::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
m_PCadLayer = aLayer;
m_KiCadLayer = GetKiCadLayer();
m_positionX = 0;
m_positionY = 0;
m_PositionX = 0;
m_PositionY = 0;
m_ToX = 0;
m_ToY = 0;
m_Width = 0;
@ -68,7 +68,7 @@ void PCAD_LINE::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
if( lNode )
{
SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_positionX, &m_positionY,
SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_PositionX, &m_PositionY,
aActualConversion );
}
@ -90,8 +90,8 @@ void PCAD_LINE::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
lNode->GetAttribute( wxT( "Name" ), &propValue );
propValue.Trim( false );
propValue.Trim( true );
m_net = propValue;
m_netCode = GetNetCode( m_net );
m_Net = propValue;
m_NetCode = GetNetCode( m_Net );
}
}
@ -121,13 +121,13 @@ void PCAD_LINE::AddToBoard( FOOTPRINT* aFootprint )
PCB_TRACK* track = new PCB_TRACK( m_board );
m_board->Add( track );
track->SetPosition( VECTOR2I( m_positionX, m_positionY ) );
track->SetPosition( VECTOR2I( m_PositionX, m_PositionY ) );
track->SetEnd( VECTOR2I( m_ToX, m_ToY ) );
track->SetWidth( m_Width );
track->SetLayer( m_KiCadLayer );
track->SetNetCode( m_netCode );
track->SetNetCode( m_NetCode );
}
else
{
@ -135,7 +135,7 @@ void PCAD_LINE::AddToBoard( FOOTPRINT* aFootprint )
m_board->Add( segment, ADD_MODE::APPEND );
segment->SetLayer( m_KiCadLayer );
segment->SetStart( VECTOR2I( m_positionX, m_positionY ) );
segment->SetStart( VECTOR2I( m_PositionX, m_PositionY ) );
segment->SetEnd( VECTOR2I( m_ToX, m_ToY ) );
segment->SetStroke( STROKE_PARAMS( m_Width, PLOT_DASH_TYPE::SOLID ) );

View File

@ -39,7 +39,7 @@ namespace PCAD2KICAD {
class PCAD_LINE : public PCAD_PCB_COMPONENT
{
public:
PCAD_LINE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
PCAD_LINE( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCAD_LINE();
virtual void Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
@ -51,6 +51,7 @@ public:
void AddToBoard( FOOTPRINT* aFootprint = nullptr ) override;
public:
int m_Width;
int m_ToX;
int m_ToY;

View File

@ -23,7 +23,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <pcad/pcb_net.h>
#include <pcad/pcad_nets.h>
#include <xnode.h>
@ -31,25 +31,25 @@
namespace PCAD2KICAD {
PCB_NET_NODE::PCB_NET_NODE()
PCAD_NET_NODE::PCAD_NET_NODE()
{
m_CompRef = wxEmptyString;
m_PinRef = wxEmptyString;
}
PCB_NET_NODE::~PCB_NET_NODE()
PCAD_NET_NODE::~PCAD_NET_NODE()
{
}
PCB_NET::PCB_NET( int aNetCode ) : m_NetCode( aNetCode )
PCAD_NET::PCAD_NET( int aNetCode ) : m_NetCode( aNetCode )
{
m_Name = wxEmptyString;
}
PCB_NET::~PCB_NET()
PCAD_NET::~PCAD_NET()
{
int i;
@ -60,10 +60,10 @@ PCB_NET::~PCB_NET()
}
void PCB_NET::Parse( XNODE* aNode )
void PCAD_NET::Parse( XNODE* aNode )
{
wxString propValue, s1, s2;
PCB_NET_NODE* netNode;
PCAD_NET_NODE* netNode;
XNODE* lNode;
aNode->GetAttribute( wxT( "Name" ), &propValue );
@ -85,7 +85,7 @@ void PCB_NET::Parse( XNODE* aNode )
s2 = s2.Mid( 1 );
}
netNode = new PCB_NET_NODE;
netNode = new PCAD_NET_NODE;
s1.Trim( false );
s1.Trim( true );
netNode->m_CompRef = s1;

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-2020 KiCad Developers, see AUTHORS.TXT for contributors.
* Copyright (C) 2012-2023 KiCad Developers, see AUTHORS.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
@ -23,8 +23,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PCB_NET_H_
#define PCB_NET_H_
#ifndef PCAD_NETS_H
#define PCAD_NETS_H
#include <pcad/pcad2kicad_common.h>
@ -35,29 +35,31 @@ class XNODE;
namespace PCAD2KICAD {
class PCB_NET_NODE : public wxObject
class PCAD_NET_NODE : public wxObject
{
public:
PCB_NET_NODE();
~PCB_NET_NODE();
PCAD_NET_NODE();
~PCAD_NET_NODE();
public:
wxString m_CompRef;
wxString m_PinRef;
};
class PCB_NET : public wxObject
class PCAD_NET : public wxObject
{
public:
PCB_NET( int aNetCode );
~PCB_NET();
PCAD_NET( int aNetCode );
~PCAD_NET();
void Parse( XNODE* aNode );
wxString m_Name;
int m_NetCode;
PCB_NET_NODES_ARRAY m_NetNodes;
public:
wxString m_Name;
int m_NetCode;
PCAD_NET_NODES_ARRAY m_NetNodes;
};
} // namespace PCAD2KICAD
#endif // PCB_NET_H_
#endif // PCAD_NETS_H

View File

@ -38,10 +38,10 @@
namespace PCAD2KICAD {
PCAD_PAD::PCAD_PAD( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCAD_PAD::PCAD_PAD( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCAD_PCB_COMPONENT( aCallbacks, aBoard )
{
m_objType = wxT( 'P' );
m_ObjType = wxT( 'P' );
m_Number = 0;
m_Hole = 0;
m_IsHolePlated = true;
@ -59,15 +59,15 @@ PCAD_PAD::~PCAD_PAD()
void PCAD_PAD::Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion )
const wxString& aActualConversion )
{
XNODE* lNode;
XNODE* cNode;
long num;
wxString propValue, str, emsg;
PCAD_PAD_SHAPE* padShape;
PCAD_PAD_SHAPE* padShape;
m_rotation = ANGLE_0;
m_Rotation = ANGLE_0;
lNode = FindNode( aNode, wxT( "padNum" ) );
if( lNode )
@ -82,14 +82,14 @@ void PCAD_PAD::Parse( XNODE* aNode, const wxString& aDefaultUnits,
{
lNode->GetAttribute( wxT( "Name" ), &propValue );
propValue.Trim( false );
m_name.text = propValue;
m_Name.text = propValue;
}
lNode = FindNode( aNode, wxT( "pt" ) );
if( lNode )
{
SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_positionX, &m_positionY,
SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_PositionX, &m_PositionY,
aActualConversion );
}
@ -99,7 +99,7 @@ void PCAD_PAD::Parse( XNODE* aNode, const wxString& aDefaultUnits,
{
str = lNode->GetNodeContent();
str.Trim( false );
m_rotation = EDA_ANGLE( StrToInt1Units( str ), TENTHS_OF_A_DEGREE_T );
m_Rotation = EDA_ANGLE( StrToInt1Units( str ), TENTHS_OF_A_DEGREE_T );
}
lNode = FindNode( aNode, wxT( "netNameRef" ) );
@ -109,8 +109,8 @@ void PCAD_PAD::Parse( XNODE* aNode, const wxString& aDefaultUnits,
lNode->GetAttribute( wxT( "Name" ), &propValue );
propValue.Trim( false );
propValue.Trim( true );
m_net = propValue;
m_netCode = GetNetCode( m_net );
m_Net = propValue;
m_NetCode = GetNetCode( m_Net );
}
lNode = FindNode( aNode, wxT( "defaultPinDes" ) );
@ -139,14 +139,14 @@ void PCAD_PAD::Parse( XNODE* aNode, const wxString& aDefaultUnits,
{
lNode->GetAttribute( wxT( "Name" ), &propValue );
if( propValue.IsSameAs( m_name.text, false) )
if( propValue.IsSameAs( m_Name.text, false) )
break;
lNode = lNode->GetNext();
}
if ( !lNode )
THROW_IO_ERROR( wxString::Format( wxT( "Unable to find padStyleDef " ) + m_name.text ) );
THROW_IO_ERROR( wxString::Format( wxT( "Unable to find padStyleDef " ) + m_Name.text ) );
cNode = FindNode( lNode, wxT( "holeDiam" ) );
@ -183,8 +183,8 @@ void PCAD_PAD::Flip()
PCAD_PCB_COMPONENT::Flip();
if( m_objType == wxT( 'P' ) )
m_rotation = -m_rotation;
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 );
@ -263,7 +263,7 @@ void PCAD_PAD::AddToFootprint( FOOTPRINT* aFootprint, const EDA_ANGLE& aRotation
// actually this is a thru-hole pad
pad->SetLayerSet( LSET::AllCuMask() | LSET( 2, B_Mask, F_Mask ) );
pad->SetNumber( m_name.text );
pad->SetNumber( m_Name.text );
if( padShapeName.IsSameAs( wxT( "Oval" ), false )
|| padShapeName.IsSameAs( wxT( "Ellipse" ), false )
@ -289,7 +289,7 @@ void PCAD_PAD::AddToFootprint( FOOTPRINT* aFootprint, const EDA_ANGLE& aRotation
pad->SetSize( VECTOR2I( width, height ) );
pad->SetDelta( VECTOR2I( 0, 0 ) );
pad->SetOrientation( m_rotation + aRotation );
pad->SetOrientation( m_Rotation + aRotation );
pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
pad->SetOffset( VECTOR2I( 0, 0 ) );
@ -298,12 +298,12 @@ void PCAD_PAD::AddToFootprint( FOOTPRINT* aFootprint, const EDA_ANGLE& aRotation
pad->SetAttribute( padType );
// Set the proper net code
NETINFO_ITEM* netinfo = m_board->FindNet( m_net );
NETINFO_ITEM* netinfo = m_board->FindNet( m_Net );
if( netinfo == nullptr ) // I believe this should not happen, but just in case
{
// It is a new net
netinfo = new NETINFO_ITEM( m_board, m_net );
netinfo = new NETINFO_ITEM( m_board, m_Net );
m_board->Add( netinfo );
}
@ -314,7 +314,7 @@ void PCAD_PAD::AddToFootprint( FOOTPRINT* aFootprint, const EDA_ANGLE& aRotation
{
// pad's "Position" is not relative to the footprint's, whereas Pos0 is relative to
// the footprint's but is the unrotated coordinate.
VECTOR2I padpos( m_positionX, m_positionY );
VECTOR2I padpos( m_PositionX, m_PositionY );
pad->SetPos0( padpos );
RotatePoint( padpos, aFootprint->GetOrientation() );
pad->SetPosition( padpos + aFootprint->GetPosition() );
@ -331,7 +331,7 @@ void PCAD_PAD::AddToBoard( FOOTPRINT* aFootprint )
int width = 0;
int height = 0;
if( m_objType == wxT( 'V' ) ) // via
if( m_ObjType == wxT( 'V' ) ) // via
{
// choose one of the shapes
for( i = 0; i < (int) m_Shapes.GetCount(); i++ )
@ -359,8 +359,8 @@ void PCAD_PAD::AddToBoard( FOOTPRINT* aFootprint )
PCB_VIA* via = new PCB_VIA( m_board );
m_board->Add( via );
via->SetPosition( VECTOR2I( m_positionX, m_positionY ) );
via->SetEnd( VECTOR2I( m_positionX, m_positionY ) );
via->SetPosition( VECTOR2I( m_PositionX, m_PositionY ) );
via->SetEnd( VECTOR2I( m_PositionX, m_PositionY ) );
via->SetWidth( height );
via->SetViaType( VIATYPE::THROUGH );
@ -368,7 +368,7 @@ void PCAD_PAD::AddToBoard( FOOTPRINT* aFootprint )
via->SetDrill( m_Hole );
via->SetLayer( m_KiCadLayer );
via->SetNetCode( m_netCode );
via->SetNetCode( m_NetCode );
}
}
else // pad
@ -377,10 +377,10 @@ void PCAD_PAD::AddToBoard( FOOTPRINT* aFootprint )
{
aFootprint = new FOOTPRINT( m_board );
m_board->Add( aFootprint, ADD_MODE::APPEND );
aFootprint->SetPosition( VECTOR2I( m_positionX, m_positionY ) );
aFootprint->SetPosition( VECTOR2I( m_PositionX, m_PositionY ) );
}
m_name.text = m_defaultPinDes;
m_Name.text = m_defaultPinDes;
AddToFootprint( aFootprint, ANGLE_0, true );
}

View File

@ -38,7 +38,7 @@ namespace PCAD2KICAD {
class PCAD_PAD : public PCAD_PCB_COMPONENT
{
public:
PCAD_PAD( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
PCAD_PAD( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCAD_PAD();
virtual void Parse( XNODE* aNode, const wxString& aDefaultUnits,
@ -50,10 +50,11 @@ public:
void AddToBoard( FOOTPRINT* aFootprint = nullptr ) override;
int m_Number;
int m_Hole;
bool m_IsHolePlated;
PCB_PAD_SHAPES_ARRAY m_Shapes;
public:
int m_Number;
int m_Hole;
bool m_IsHolePlated;
PCAD_PAD_SHAPES_ARRAY m_Shapes;
private:
wxString m_defaultPinDes;

View File

@ -32,7 +32,7 @@
namespace PCAD2KICAD {
PCAD_PAD_SHAPE::PCAD_PAD_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCAD_PAD_SHAPE::PCAD_PAD_SHAPE( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCAD_PCB_COMPONENT( aCallbacks, aBoard )
{
m_Shape = wxEmptyString;
@ -47,7 +47,7 @@ PCAD_PAD_SHAPE::~PCAD_PAD_SHAPE()
void PCAD_PAD_SHAPE::Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion )
const wxString& aActualConversion )
{
wxString str, s;
long num;

View File

@ -37,7 +37,7 @@ namespace PCAD2KICAD {
class PCAD_PAD_SHAPE : public PCAD_PCB_COMPONENT
{
public:
PCAD_PAD_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
PCAD_PAD_SHAPE( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCAD_PAD_SHAPE();
virtual void Parse( XNODE* aNode, const wxString& aDefaultUnits,
@ -45,6 +45,7 @@ public:
void AddToBoard( FOOTPRINT* aFootprint = nullptr ) override {}
public:
wxString m_Shape;
int m_Width;
int m_Height;

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-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012-2023 KiCad Developers, see AUTHORS.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
@ -25,13 +25,11 @@
#include <pcad/pcad_pcb.h>
#include <pcad/pcb_keepout.h>
#include <pcad/pcad_keepout.h>
#include <pcad/pcad_footprint.h>
#include <pcad/pcb_net.h>
#include <pcad/pcad_nets.h>
#include <pcad/pcad_pad.h>
#include <pcad/pcad_text.h>
#include <pcad/pcad_via.h>
#include <pcad/s_expr_loader.h>
#include <board.h>
#include <common.h>
@ -122,7 +120,7 @@ PCAD_PCB::~PCAD_PCB()
int PCAD_PCB::GetNetCode( const wxString& aNetName ) const
{
const PCB_NET* net;
const PCAD_NET* net;
for( int i = 0; i < (int) m_PcbNetlist.GetCount(); i++ )
{
@ -241,7 +239,7 @@ void PCAD_PCB::DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxSt
PCAD_FOOTPRINT* fp;
PCAD_PAD* pad;
PCAD_VIA* via;
PCB_KEEPOUT* keepOut;
PCAD_KEEPOUT* keepOut;
wxString cn, str, propValue;
lNode = aNode->GetChildren();
@ -268,7 +266,7 @@ void PCAD_PCB::DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxSt
mNode = FindNode( lNode, wxT( "patternGraphicsNameRef" ) );
if( mNode )
mNode->GetAttribute( wxT( "Name" ), &fp->m_patGraphRefName );
mNode->GetAttribute( wxT( "Name" ), &fp->m_PatGraphRefName );
fp->Parse( tNode, aStatusBar, m_DefaultMeasurementUnit, aActualConversion );
}
@ -276,15 +274,15 @@ void PCAD_PCB::DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxSt
if( fp )
{
fp->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" ), &fp->m_name.text );
SetTextProperty( lNode, &fp->m_name, fp->m_patGraphRefName, wxT( "RefDes" ),
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" ),
SetTextProperty( lNode, &fp->m_Value, fp->m_PatGraphRefName, wxT( "Value" ),
aActualConversion );
}
@ -293,7 +291,7 @@ void PCAD_PCB::DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxSt
if( tNode )
{
SetPosition( tNode->GetNodeContent(), m_DefaultMeasurementUnit,
&fp->m_positionX, &fp->m_positionY, aActualConversion );
&fp->m_PositionX, &fp->m_PositionY, aActualConversion );
}
tNode = FindNode( lNode, wxT( "rotation" ) );
@ -302,7 +300,7 @@ void PCAD_PCB::DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxSt
{
str = tNode->GetNodeContent();
str.Trim( false );
fp->m_rotation = EDA_ANGLE( StrToInt1Units( str ), TENTHS_OF_A_DEGREE_T );
fp->m_Rotation = EDA_ANGLE( StrToInt1Units( str ), TENTHS_OF_A_DEGREE_T );
}
str = FindNodeGetContent( lNode, wxT( "isFlipped" ) );
@ -325,7 +323,7 @@ void PCAD_PCB::DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxSt
{
tNode->GetAttribute( wxT( "Name" ), &propValue );
if( propValue == fp->m_name.text )
if( propValue == fp->m_Name.text )
{
if( FindNode( tNode, wxT( "compValue" ) ) )
{
@ -340,9 +338,9 @@ void PCAD_PCB::DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxSt
{
FindNode( tNode,
wxT( "compRef" ) )->GetAttribute( wxT( "Name" ),
&fp->m_compRef );
fp->m_compRef.Trim( false );
fp->m_compRef.Trim( true );
&fp->m_CompRef );
fp->m_CompRef.Trim( false );
fp->m_CompRef.Trim( true );
}
tNode = nullptr;
@ -356,7 +354,7 @@ void PCAD_PCB::DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxSt
// map pins
tNode = FindNode( (XNODE *)aXmlDoc->GetRoot(), wxT( "library" ) );
tNode = FindCompDefName( tNode, fp->m_compRef );
tNode = FindCompDefName( tNode, fp->m_CompRef );
if( tNode )
{
@ -410,7 +408,7 @@ void PCAD_PCB::DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxSt
}
else if( lNode->GetName().IsSameAs( wxT( "polyKeepOut" ), false ) )
{
keepOut = new PCB_KEEPOUT( m_callbacks, m_board, 0 );
keepOut = new PCAD_KEEPOUT( m_callbacks, m_board, 0 );
if( keepOut->Parse( lNode, m_DefaultMeasurementUnit, aActualConversion ) )
m_PcbComponents.Add( keepOut );
@ -434,16 +432,16 @@ void PCAD_PCB::ConnectPinToNet( const wxString& aCompRef, const wxString& aPinRe
{
footprint = (PCAD_FOOTPRINT*) m_PcbComponents[i];
if( footprint->m_objType == wxT( 'M' ) && footprint->m_name.text == aCompRef )
if( footprint->m_ObjType == wxT( 'M' ) && footprint->m_Name.text == aCompRef )
{
for( j = 0; j < (int) footprint->m_FootprintItems.GetCount(); j++ )
{
if( footprint->m_FootprintItems[j]->m_objType == wxT( 'P' ) )
if( footprint->m_FootprintItems[j]->m_ObjType == wxT( 'P' ) )
{
cp = (PCAD_PAD*) footprint->m_FootprintItems[j];
if( cp->m_name.text == aPinRef )
cp->m_net = aNetName;
if( cp->m_Name.text == aPinRef )
cp->m_Net = aNetName;
}
}
}
@ -676,7 +674,7 @@ void PCAD_PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc,
const wxString& aActualConversion )
{
XNODE* aNode;//, *aaNode;
PCB_NET* net;
PCAD_NET* net;
PCAD_PCB_COMPONENT* comp;
PCAD_FOOTPRINT* footprint;
wxString compRef, pinRef, layerName, layerType;
@ -802,7 +800,7 @@ void PCAD_PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc,
while( aNode )
{
net = new PCB_NET( netCode++ );
net = new PCAD_NET( netCode++ );
net->Parse( aNode );
m_PcbNetlist.Add( net );
@ -856,7 +854,7 @@ void PCAD_PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc,
// POSTPROCESS -- FLIP COMPONENTS
for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ )
{
if( m_PcbComponents[i]->m_objType == wxT( 'M' ) )
if( m_PcbComponents[i]->m_ObjType == wxT( 'M' ) )
( (PCAD_FOOTPRINT*) m_PcbComponents[i] )->Flip();
}
@ -870,11 +868,11 @@ void PCAD_PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc,
{
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;
@ -891,11 +889,11 @@ void PCAD_PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc,
{
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
@ -943,7 +941,7 @@ void PCAD_PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc,
void PCAD_PCB::AddToBoard( FOOTPRINT* )
{
int i;
PCB_NET* net;
PCAD_NET* net;
m_board->SetCopperLayerCount( m_layersStackup.size() );

View File

@ -28,7 +28,7 @@
#include <pcad/pcad2kicad_common.h>
#include <pcad/pcad_item_types.h>
#include <pcad/pcb_callbacks.h>
#include <pcad/pcad_callbacks.h>
#include <pcad/pcad_footprint.h>
#include <map>
@ -43,7 +43,7 @@ class wxXmlDocument;
namespace PCAD2KICAD {
class PCAD_PCB : public PCAD_FOOTPRINT, public PCB_CALLBACKS
class PCAD_PCB : public PCAD_FOOTPRINT, public PCAD_CALLBACKS
{
public:
PCAD_PCB( BOARD* aBoard );
@ -59,13 +59,6 @@ public:
void AddToBoard( FOOTPRINT* aFootprint = nullptr ) override;
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;
private:
XNODE* FindCompDefName( XNODE* aNode, const wxString& aName ) const;
@ -83,6 +76,15 @@ private:
double GetDistance( const wxRealPoint* aPoint1, const wxRealPoint* aPoint2 ) const;
void GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConversion );
public:
PCAD_COMPONENTS_ARRAY m_PcbComponents; // PCB footprints,Lines,Routes,Texts, .... and so on
PCAD_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;
private:
std::vector<std::pair<wxString, long>> m_layersStackup;
};

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 AUTHORS.TXT for contributors.
* Copyright (C) 2012-2023 KiCad Developers, see AUTHORS.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,23 +34,22 @@
namespace PCAD2KICAD {
PCAD_PCB_COMPONENT::PCAD_PCB_COMPONENT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
m_uuid(),
PCAD_PCB_COMPONENT::PCAD_PCB_COMPONENT( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard ) :
m_Uuid(),
m_callbacks( aCallbacks ),
m_board( aBoard )
{
m_tag = 0;
m_objType = wxT( '?' );
m_ObjType = wxT( '?' );
m_PCadLayer = 0;
m_KiCadLayer = F_Cu; // It *has* to be somewhere...
m_positionX = 0;
m_positionY = 0;
m_rotation = ANGLE_0;
InitTTextValue( &m_name );
m_net = wxEmptyString;
m_netCode = 0;
m_compRef = wxEmptyString;
m_patGraphRefName = wxEmptyString;
m_PositionX = 0;
m_PositionY = 0;
m_Rotation = ANGLE_0;
InitTTextValue( &m_Name );
m_Net = wxEmptyString;
m_NetCode = 0;
m_CompRef = wxEmptyString;
m_PatGraphRefName = wxEmptyString;
}
@ -61,13 +60,13 @@ PCAD_PCB_COMPONENT::~PCAD_PCB_COMPONENT()
void PCAD_PCB_COMPONENT::SetPosOffset( int aX_offs, int aY_offs )
{
m_positionX += aX_offs;
m_positionY += aY_offs;
m_PositionX += aX_offs;
m_PositionY += aY_offs;
}
void PCAD_PCB_COMPONENT::Flip()
{
m_positionX = -m_positionX;
m_PositionX = -m_PositionX;
}
} // namespace PCAD2KICAD

View File

@ -28,7 +28,7 @@
#include <pcad/pcad2kicad_common.h>
#include <pcad/pcad_item_types.h>
#include <pcad/pcb_callbacks.h>
#include <pcad/pcad_callbacks.h>
#include <kiid.h>
#include <layer_ids.h>
@ -45,7 +45,7 @@ namespace PCAD2KICAD {
class PCAD_PCB_COMPONENT : public wxObject
{
public:
PCAD_PCB_COMPONENT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
PCAD_PCB_COMPONENT( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCAD_PCB_COMPONENT();
virtual void SetPosOffset( int aX_offs, int aY_offs );
@ -59,22 +59,22 @@ public:
return m_callbacks->GetNetCode( aNetName );
}
int m_tag;
char m_objType;
public:
char m_ObjType;
int m_PCadLayer;
PCB_LAYER_ID m_KiCadLayer;
KIID m_uuid;
int m_positionX;
int m_positionY;
EDA_ANGLE m_rotation;
TTEXTVALUE m_name; // name has also private positions, rotations and so on....
wxString m_net;
int m_netCode;
wxString m_compRef; // internal usage for XL parsing
wxString m_patGraphRefName; // internal usage for XL parsing
KIID m_Uuid;
int m_PositionX;
int m_PositionY;
EDA_ANGLE m_Rotation;
TTEXTVALUE m_Name; // name has also private positions, rotations and so on....
wxString m_Net;
int m_NetCode;
wxString m_CompRef; // internal usage for XL parsing
wxString m_PatGraphRefName; // internal usage for XL parsing
protected:
PCB_CALLBACKS* m_callbacks;
PCAD_CALLBACKS* m_callbacks;
BOARD* m_board;
};

View File

@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <pcad/pcb_plane.h>
#include <pcad/pcad_plane.h>
#include <common.h>
#include <xnode.h>
@ -31,22 +31,20 @@
namespace PCAD2KICAD {
PCB_PLANE::PCB_PLANE( PCB_CALLBACKS* aCallbacks,
BOARD* aBoard,
int aPCadLayer ) :
PCAD_PLANE::PCAD_PLANE( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer ) :
PCAD_POLYGON( aCallbacks, aBoard, aPCadLayer )
{
m_priority = 1;
m_Priority = 1;
}
PCB_PLANE::~PCB_PLANE()
PCAD_PLANE::~PCAD_PLANE()
{
}
bool PCB_PLANE::Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion )
bool PCAD_PLANE::Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion )
{
XNODE* lNode;
wxString pourType, str, propValue;
@ -58,13 +56,13 @@ bool PCB_PLANE::Parse( XNODE* aNode, const wxString& aDefaultUnits,
lNode->GetAttribute( wxT( "Name" ), &propValue );
propValue.Trim( false );
propValue.Trim( true );
m_net = propValue;
m_netCode = GetNetCode( m_net );
m_Net = propValue;
m_NetCode = GetNetCode( m_Net );
}
if( FindNode( aNode, wxT( "width" ) ) )
{
SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(), aDefaultUnits, &m_width,
SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(), aDefaultUnits, &m_Width,
aActualConversion );
}
@ -76,10 +74,10 @@ bool PCB_PLANE::Parse( XNODE* aNode, const wxString& aDefaultUnits,
if( lNode )
{
// retrieve plane outline
FormPolygon( lNode, &m_outline, aDefaultUnits, aActualConversion );
FormPolygon( lNode, &m_Outline, aDefaultUnits, aActualConversion );
m_positionX = m_outline[0]->x;
m_positionY = m_outline[0]->y;
m_PositionX = m_Outline[0]->x;
m_PositionY = m_Outline[0]->y;
}
else
{

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 KiCad Developers, see AUTHORS.TXT for contributors.
* Copyright (C) 2012-2023 KiCad Developers, see AUTHORS.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
@ -22,8 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PCB_PLANE_H_
#define PCB_PLANE_H_
#ifndef PCAD_PLANE_H
#define PCAD_PLANE_H
#include <pcad/pcad_polygon.h>
@ -33,11 +33,11 @@ class XNODE;
namespace PCAD2KICAD {
class PCB_PLANE : public PCAD_POLYGON
class PCAD_PLANE : public PCAD_POLYGON
{
public:
PCB_PLANE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCB_PLANE();
PCAD_PLANE( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCAD_PLANE();
virtual bool Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion ) override;

View File

@ -36,17 +36,17 @@
namespace PCAD2KICAD {
PCAD_POLYGON::PCAD_POLYGON( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer ) :
PCAD_POLYGON::PCAD_POLYGON( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer ) :
PCAD_PCB_COMPONENT( aCallbacks, aBoard )
{
m_width = 0;
m_Width = 0;
// P-CAD polygons are similar to zones (and we're going to convert them as such), except
// that they don't avoid other copper pours. So effectively they're very-high-priority
// zones.
m_priority = 100000;
m_Priority = 100000;
m_objType = wxT( 'Z' );
m_ObjType = wxT( 'Z' );
m_PCadLayer = aPCadLayer;
m_KiCadLayer = GetKiCadLayer();
m_filled = true;
@ -57,45 +57,45 @@ PCAD_POLYGON::~PCAD_POLYGON()
{
int i, island;
for( i = 0; i < (int) m_outline.GetCount(); i++ )
delete m_outline[i];
for( i = 0; i < (int) m_Outline.GetCount(); i++ )
delete m_Outline[i];
for( island = 0; island < (int) m_cutouts.GetCount(); island++ )
for( island = 0; island < (int) m_Cutouts.GetCount(); island++ )
{
for( i = 0; i < (int) m_cutouts[island]->GetCount(); i++ )
delete (*m_cutouts[island])[i];
for( i = 0; i < (int) m_Cutouts[island]->GetCount(); i++ )
delete (*m_Cutouts[island])[i];
delete m_cutouts[island];
delete m_Cutouts[island];
}
for( island = 0; island < (int) m_islands.GetCount(); island++ )
for( island = 0; island < (int) m_Islands.GetCount(); island++ )
{
for( i = 0; i < (int) m_islands[island]->GetCount(); i++ )
delete (*m_islands[island])[i];
for( i = 0; i < (int) m_Islands[island]->GetCount(); i++ )
delete (*m_Islands[island])[i];
delete m_islands[island];
delete m_Islands[island];
}
}
void PCAD_POLYGON::AssignNet( const wxString& aNetName )
{
m_net = aNetName;
m_netCode = GetNetCode( m_net );
m_Net = aNetName;
m_NetCode = GetNetCode( m_Net );
}
void PCAD_POLYGON::SetOutline( VERTICES_ARRAY* aOutline )
{
int i;
m_outline.Empty();
m_Outline.Empty();
for( i = 0; i < (int) aOutline->GetCount(); i++ )
m_outline.Add( new wxRealPoint( (*aOutline)[i]->x, (*aOutline)[i]->y ) );
m_Outline.Add( new wxRealPoint( (*aOutline)[i]->x, (*aOutline)[i]->y ) );
if( m_outline.Count() > 0 )
if( m_Outline.Count() > 0 )
{
m_positionX = m_outline[0]->x;
m_positionY = m_outline[0]->y;
m_PositionX = m_Outline[0]->x;
m_PositionY = m_Outline[0]->y;
}
}
@ -122,7 +122,7 @@ void PCAD_POLYGON::FormPolygon( XNODE* aNode, VERTICES_ARRAY* aPolygon,
bool PCAD_POLYGON::Parse( XNODE* aNode, const wxString& aDefaultUnits,
const wxString& aActualConversion )
const wxString& aActualConversion )
{
XNODE* lNode;
wxString propValue;
@ -134,19 +134,19 @@ bool PCAD_POLYGON::Parse( XNODE* aNode, const wxString& aDefaultUnits,
lNode->GetAttribute( wxT( "Name" ), &propValue );
propValue.Trim( false );
propValue.Trim( true );
m_net = propValue;
m_netCode = GetNetCode( m_net );
m_Net = propValue;
m_NetCode = GetNetCode( m_Net );
}
// retrieve polygon outline
FormPolygon( aNode, &m_outline, aDefaultUnits, aActualConversion );
FormPolygon( aNode, &m_Outline, aDefaultUnits, aActualConversion );
m_positionX = m_outline[0]->x;
m_positionY = m_outline[0]->y;
m_PositionX = m_Outline[0]->x;
m_PositionY = m_Outline[0]->y;
// fill the polygon with the same contour as its outline is
m_islands.Add( new VERTICES_ARRAY );
FormPolygon( aNode, m_islands[0], aDefaultUnits, aActualConversion );
m_Islands.Add( new VERTICES_ARRAY );
FormPolygon( aNode, m_Islands[0], aDefaultUnits, aActualConversion );
return true;
}
@ -154,7 +154,7 @@ bool PCAD_POLYGON::Parse( XNODE* aNode, const wxString& aDefaultUnits,
void PCAD_POLYGON::AddToBoard( FOOTPRINT* aFootprint )
{
if( m_outline.GetCount() > 0 )
if( m_Outline.GetCount() > 0 )
{
if( aFootprint )
{
@ -166,7 +166,7 @@ void PCAD_POLYGON::AddToBoard( FOOTPRINT* aFootprint )
auto outline = new std::vector<VECTOR2I>;
for( auto point : m_outline )
for( auto point : m_Outline )
outline->push_back( VECTOR2I( point->x, point->y ) );
dwg->SetPolyPoints( *outline );
@ -183,23 +183,23 @@ void PCAD_POLYGON::AddToBoard( FOOTPRINT* aFootprint )
m_board->Add( zone, ADD_MODE::APPEND );
zone->SetLayer( m_KiCadLayer );
zone->SetNetCode( m_netCode );
zone->SetNetCode( m_NetCode );
// add outline
for( int i = 0; i < (int) m_outline.GetCount(); i++ )
for( int i = 0; i < (int) m_Outline.GetCount(); i++ )
{
zone->AppendCorner( VECTOR2I( KiROUND( m_outline[i]->x ),
KiROUND( m_outline[i]->y ) ), -1 );
zone->AppendCorner( VECTOR2I( KiROUND( m_Outline[i]->x ),
KiROUND( m_Outline[i]->y ) ), -1 );
}
zone->SetLocalClearance( m_width );
zone->SetLocalClearance( m_Width );
zone->SetAssignedPriority( m_priority );
zone->SetAssignedPriority( m_Priority );
zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE,
zone->GetDefaultHatchPitch(), true );
if ( m_objType == wxT( 'K' ) )
if ( m_ObjType == wxT( 'K' ) )
{
zone->SetIsRuleArea( true );
zone->SetDoNotAllowTracks( true );
@ -208,7 +208,7 @@ void PCAD_POLYGON::AddToBoard( FOOTPRINT* aFootprint )
zone->SetDoNotAllowCopperPour( true );
zone->SetDoNotAllowFootprints( false );
}
else if( m_objType == wxT( 'C' ) )
else if( m_ObjType == wxT( 'C' ) )
{
// convert cutouts to keepouts because standalone cutouts are not supported in KiCad
zone->SetIsRuleArea( true );
@ -240,27 +240,27 @@ void PCAD_POLYGON::SetPosOffset( int aX_offs, int aY_offs )
PCAD_PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs );
for( i = 0; i < (int) m_outline.GetCount(); i++ )
for( i = 0; i < (int) m_Outline.GetCount(); i++ )
{
m_outline[i]->x += aX_offs;
m_outline[i]->y += aY_offs;
m_Outline[i]->x += aX_offs;
m_Outline[i]->y += aY_offs;
}
for( island = 0; island < (int) m_islands.GetCount(); island++ )
for( island = 0; island < (int) m_Islands.GetCount(); island++ )
{
for( i = 0; i < (int) m_islands[island]->GetCount(); i++ )
for( i = 0; i < (int) m_Islands[island]->GetCount(); i++ )
{
(*m_islands[island])[i]->x += aX_offs;
(*m_islands[island])[i]->y += aY_offs;
(*m_Islands[island])[i]->x += aX_offs;
(*m_Islands[island])[i]->y += aY_offs;
}
}
for( island = 0; island < (int) m_cutouts.GetCount(); island++ )
for( island = 0; island < (int) m_Cutouts.GetCount(); island++ )
{
for( i = 0; i < (int) m_cutouts[island]->GetCount(); i++ )
for( i = 0; i < (int) m_Cutouts[island]->GetCount(); i++ )
{
(*m_cutouts[island])[i]->x += aX_offs;
(*m_cutouts[island])[i]->y += aY_offs;
(*m_Cutouts[island])[i]->x += aX_offs;
(*m_Cutouts[island])[i]->y += aY_offs;
}
}
}

View File

@ -39,7 +39,7 @@ namespace PCAD2KICAD {
class PCAD_POLYGON : public PCAD_PCB_COMPONENT
{
public:
PCAD_POLYGON( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
PCAD_POLYGON( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCAD_POLYGON();
virtual bool Parse( XNODE* aNode, const wxString& aDefaultUnits,
@ -59,11 +59,12 @@ public:
void FormPolygon( XNODE* aNode, VERTICES_ARRAY* aPolygon,
const wxString& aDefaultUnits, const wxString& actualConversion );
int m_width;
int m_priority;
VERTICES_ARRAY m_outline; // collection of boundary/outline lines - objects
ISLANDS_ARRAY m_islands;
ISLANDS_ARRAY m_cutouts;
public:
int m_Width;
int m_Priority;
VERTICES_ARRAY m_Outline; // collection of boundary/outline lines - objects
ISLANDS_ARRAY m_Islands;
ISLANDS_ARRAY m_Cutouts;
protected:
bool m_filled;

View File

@ -34,10 +34,10 @@
namespace PCAD2KICAD {
PCAD_TEXT::PCAD_TEXT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCAD_TEXT::PCAD_TEXT( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCAD_PCB_COMPONENT( aCallbacks, aBoard )
{
m_objType = wxT( 'T' );
m_ObjType = wxT( 'T' );
}
@ -54,14 +54,14 @@ void PCAD_TEXT::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
m_PCadLayer = aLayer;
m_KiCadLayer = GetKiCadLayer();
m_positionX = 0;
m_positionY = 0;
m_name.mirror = 0; // Normal, not mirrored
m_PositionX = 0;
m_PositionY = 0;
m_Name.mirror = 0; // Normal, not mirrored
lNode = FindNode( aNode, wxT( "pt" ) );
if( lNode )
{
SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_positionX, &m_positionY,
SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_PositionX, &m_PositionY,
aActualConversion );
}
@ -71,55 +71,55 @@ void PCAD_TEXT::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
{
str = lNode->GetNodeContent();
str.Trim( false );
m_rotation = EDA_ANGLE( StrToInt1Units( str ), TENTHS_OF_A_DEGREE_T );
m_Rotation = EDA_ANGLE( StrToInt1Units( str ), TENTHS_OF_A_DEGREE_T );
}
aNode->GetAttribute( wxT( "Name" ), &m_name.text );
m_name.text.Replace( wxT( "\r" ), wxT( "" ) );
aNode->GetAttribute( wxT( "Name" ), &m_Name.text );
m_Name.text.Replace( wxT( "\r" ), wxT( "" ) );
str = FindNodeGetContent( aNode, wxT( "justify" ) );
m_name.justify = GetJustifyIdentificator( str );
m_Name.justify = GetJustifyIdentificator( str );
str = FindNodeGetContent( aNode, wxT( "isFlipped" ) );
if( str.IsSameAs( wxT( "True" ), false ) )
m_name.mirror = 1;
m_Name.mirror = 1;
lNode = FindNode( aNode, wxT( "textStyleRef" ) );
if( lNode )
SetFontProperty( lNode, &m_name, aDefaultUnits, aActualConversion );
SetFontProperty( lNode, &m_Name, aDefaultUnits, aActualConversion );
}
void PCAD_TEXT::AddToBoard( FOOTPRINT* aFootprint )
{
m_name.textPositionX = m_positionX;
m_name.textPositionY = m_positionY;
m_name.textRotation = m_rotation;
m_Name.textPositionX = m_PositionX;
m_Name.textPositionY = m_PositionY;
m_Name.textRotation = m_Rotation;
::PCB_TEXT* pcbtxt = new ::PCB_TEXT( m_board );
m_board->Add( pcbtxt, ADD_MODE::APPEND );
pcbtxt->SetText( m_name.text );
pcbtxt->SetText( m_Name.text );
if( m_name.isTrueType )
SetTextSizeFromTrueTypeFontHeight( pcbtxt, m_name.textHeight );
if( m_Name.isTrueType )
SetTextSizeFromTrueTypeFontHeight( pcbtxt, m_Name.textHeight );
else
SetTextSizeFromStrokeFontHeight( pcbtxt, m_name.textHeight );
SetTextSizeFromStrokeFontHeight( pcbtxt, m_Name.textHeight );
pcbtxt->SetItalic( m_name.isItalic );
pcbtxt->SetTextThickness( m_name.textstrokeWidth );
pcbtxt->SetItalic( m_Name.isItalic );
pcbtxt->SetTextThickness( m_Name.textstrokeWidth );
SetTextJustify( pcbtxt, m_name.justify );
pcbtxt->SetTextPos( VECTOR2I( m_name.textPositionX, m_name.textPositionY ) );
SetTextJustify( pcbtxt, m_Name.justify );
pcbtxt->SetTextPos( VECTOR2I( m_Name.textPositionX, m_Name.textPositionY ) );
pcbtxt->SetMirrored( m_name.mirror );
pcbtxt->SetMirrored( m_Name.mirror );
if( pcbtxt->IsMirrored() )
pcbtxt->SetTextAngle( ANGLE_360 - m_name.textRotation );
pcbtxt->SetTextAngle( ANGLE_360 - m_Name.textRotation );
else
pcbtxt->SetTextAngle( m_name.textRotation );
pcbtxt->SetTextAngle( m_Name.textRotation );
pcbtxt->SetLayer( m_KiCadLayer );
}
@ -129,8 +129,8 @@ void PCAD_TEXT::AddToBoard( FOOTPRINT* aFootprint )
// {
// PCAD_PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs );
// m_name.textPositionX += aX_offs;
// m_name.textPositionY += aY_offs;
// m_Name.textPositionX += aX_offs;
// m_Name.textPositionY += aY_offs;
// }
} // namespace PCAD2KICAD

View File

@ -39,7 +39,7 @@ namespace PCAD2KICAD {
class PCAD_TEXT : public PCAD_PCB_COMPONENT
{
public:
PCAD_TEXT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
PCAD_TEXT( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCAD_TEXT();
virtual void Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,

View File

@ -33,9 +33,9 @@
namespace PCAD2KICAD {
PCAD_VIA::PCAD_VIA( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCAD_PAD( aCallbacks, aBoard )
PCAD_VIA::PCAD_VIA( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCAD_PAD( aCallbacks, aBoard )
{
m_objType = wxT( 'V' );
m_ObjType = wxT( 'V' );
}
@ -51,7 +51,7 @@ void PCAD_VIA::Parse( XNODE* aNode, const wxString& aDefaultUnits,
wxString propValue;
PCAD_VIA_SHAPE* viaShape;
m_rotation = ANGLE_0;
m_Rotation = ANGLE_0;
lNode = FindNode( aNode, wxT( "viaStyleRef" ) );
if( lNode )
@ -59,14 +59,14 @@ void PCAD_VIA::Parse( XNODE* aNode, const wxString& aDefaultUnits,
lNode->GetAttribute( wxT( "Name" ), &propValue );
propValue.Trim( false );
propValue.Trim( true );
m_name.text = propValue;
m_Name.text = propValue;
}
lNode = FindNode( aNode, wxT( "pt" ) );
if( lNode )
{
SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_positionX, &m_positionY,
SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_PositionX, &m_PositionY,
aActualConversion );
}
@ -77,8 +77,8 @@ void PCAD_VIA::Parse( XNODE* aNode, const wxString& aDefaultUnits,
lNode->GetAttribute( wxT( "Name" ), &propValue );
propValue.Trim( false );
propValue.Trim( true );
m_net = propValue;
m_netCode = GetNetCode( m_net );
m_Net = propValue;
m_NetCode = GetNetCode( m_Net );
}
lNode = aNode;
@ -97,14 +97,14 @@ void PCAD_VIA::Parse( XNODE* aNode, const wxString& aDefaultUnits,
{
lNode->GetAttribute( wxT( "Name" ), &propValue );
if( propValue.IsSameAs( m_name.text, false ) )
if( propValue.IsSameAs( m_Name.text, false ) )
break;
lNode = lNode->GetNext();
}
if ( !lNode )
THROW_IO_ERROR( wxString::Format( _( "Unable to find viaStyleDef %s." ), m_name.text ) );
THROW_IO_ERROR( wxString::Format( _( "Unable to find viaStyleDef %s." ), m_Name.text ) );
if( lNode )
{

View File

@ -38,7 +38,7 @@ namespace PCAD2KICAD {
class PCAD_VIA : public PCAD_PAD
{
public:
PCAD_VIA( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
PCAD_VIA( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCAD_VIA();
virtual void Parse( XNODE* aNode, const wxString& aDefaultUnits,

View File

@ -32,7 +32,7 @@
namespace PCAD2KICAD {
PCAD_VIA_SHAPE::PCAD_VIA_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCAD_VIA_SHAPE::PCAD_VIA_SHAPE( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard ) :
PCAD_PAD_SHAPE( aCallbacks, aBoard )
{
}

View File

@ -37,7 +37,7 @@ namespace PCAD2KICAD {
class PCAD_VIA_SHAPE : public PCAD_PAD_SHAPE
{
public:
PCAD_VIA_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
PCAD_VIA_SHAPE( PCAD_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCAD_VIA_SHAPE();
virtual void Parse( XNODE* aNode, const wxString& aDefaultUnits,