Convert PCAD importer to EDA_ANGLE.
This commit is contained in:
parent
e37ca2f757
commit
180137baa4
|
@ -345,11 +345,11 @@ void SetTextParameters( XNODE* aNode, TTEXTVALUE* aTextValue,
|
||||||
{
|
{
|
||||||
str = tNode->GetNodeContent();
|
str = tNode->GetNodeContent();
|
||||||
str.Trim( false );
|
str.Trim( false );
|
||||||
aTextValue->textRotation = StrToInt1Units( str );
|
aTextValue->textRotation = EDA_ANGLE( StrToInt1Units( str ), TENTHS_OF_A_DEGREE_T );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aTextValue->textRotation = 0;
|
aTextValue->textRotation = ANGLE_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = FindNodeGetContent( aNode, wxT( "isVisible" ) );
|
str = FindNodeGetContent( aNode, wxT( "isVisible" ) );
|
||||||
|
@ -594,7 +594,7 @@ void InitTTextValue( TTEXTVALUE* aTextValue )
|
||||||
aTextValue->text = wxEmptyString;
|
aTextValue->text = wxEmptyString;
|
||||||
aTextValue->textPositionX = 0;
|
aTextValue->textPositionX = 0;
|
||||||
aTextValue->textPositionY = 0;
|
aTextValue->textPositionY = 0;
|
||||||
aTextValue->textRotation = 0;
|
aTextValue->textRotation = ANGLE_0;
|
||||||
aTextValue->textHeight = 0;
|
aTextValue->textHeight = 0;
|
||||||
aTextValue->textstrokeWidth = 0;
|
aTextValue->textstrokeWidth = 0;
|
||||||
aTextValue->textIsVisible = 0;
|
aTextValue->textIsVisible = 0;
|
||||||
|
|
|
@ -56,8 +56,9 @@ enum TTEXT_JUSTIFY
|
||||||
struct TTEXTVALUE
|
struct TTEXTVALUE
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
int textPositionX, textPositionY,
|
int textPositionX, textPositionY;
|
||||||
textRotation, textHeight, textstrokeWidth;
|
int textHeight, textstrokeWidth;
|
||||||
|
EDA_ANGLE textRotation;
|
||||||
int textIsVisible, mirror, textUnit;
|
int textIsVisible, mirror, textUnit;
|
||||||
int correctedPositionX, correctedPositionY;
|
int correctedPositionX, correctedPositionY;
|
||||||
TTEXT_JUSTIFY justify;
|
TTEXT_JUSTIFY justify;
|
||||||
|
|
|
@ -303,7 +303,7 @@ void PCB::DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxString&
|
||||||
{
|
{
|
||||||
str = tNode->GetNodeContent();
|
str = tNode->GetNodeContent();
|
||||||
str.Trim( false );
|
str.Trim( false );
|
||||||
fp->m_rotation = StrToInt1Units( str );
|
fp->m_rotation = EDA_ANGLE( StrToInt1Units( str ), TENTHS_OF_A_DEGREE_T );
|
||||||
}
|
}
|
||||||
|
|
||||||
str = FindNodeGetContent( lNode, wxT( "isFlipped" ) );
|
str = FindNodeGetContent( lNode, wxT( "isFlipped" ) );
|
||||||
|
|
|
@ -45,7 +45,7 @@ PCB_COMPONENT::PCB_COMPONENT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) :
|
||||||
m_KiCadLayer = F_Cu; // It *has* to be somewhere...
|
m_KiCadLayer = F_Cu; // It *has* to be somewhere...
|
||||||
m_positionX = 0;
|
m_positionX = 0;
|
||||||
m_positionY = 0;
|
m_positionY = 0;
|
||||||
m_rotation = 0;
|
m_rotation = ANGLE_0;
|
||||||
InitTTextValue( &m_name );
|
InitTTextValue( &m_name );
|
||||||
m_net = wxEmptyString;
|
m_net = wxEmptyString;
|
||||||
m_netCode = 0;
|
m_netCode = 0;
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
KIID m_uuid;
|
KIID m_uuid;
|
||||||
int m_positionX;
|
int m_positionX;
|
||||||
int m_positionY;
|
int m_positionY;
|
||||||
int m_rotation;
|
EDA_ANGLE m_rotation;
|
||||||
TTEXTVALUE m_name; // name has also private positions, rotations and so on....
|
TTEXTVALUE m_name; // name has also private positions, rotations and so on....
|
||||||
wxString m_net;
|
wxString m_net;
|
||||||
int m_netCode;
|
int m_netCode;
|
||||||
|
|
|
@ -495,21 +495,21 @@ wxString PCB_FOOTPRINT::ModuleLayer( int aMirror )
|
||||||
void PCB_FOOTPRINT::AddToBoard()
|
void PCB_FOOTPRINT::AddToBoard()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int r;
|
EDA_ANGLE r;
|
||||||
|
|
||||||
// transform text positions
|
// transform text positions
|
||||||
CorrectTextPosition( &m_name );
|
CorrectTextPosition( &m_name );
|
||||||
RotatePoint( &m_name.correctedPositionX, &m_name.correctedPositionY, (double) -m_rotation );
|
RotatePoint( &m_name.correctedPositionX, &m_name.correctedPositionY, -m_rotation );
|
||||||
|
|
||||||
CorrectTextPosition( &m_Value );
|
CorrectTextPosition( &m_Value );
|
||||||
RotatePoint( &m_Value.correctedPositionX, &m_Value.correctedPositionY, (double) -m_rotation );
|
RotatePoint( &m_Value.correctedPositionX, &m_Value.correctedPositionY, -m_rotation );
|
||||||
|
|
||||||
FOOTPRINT* footprint = new FOOTPRINT( m_board );
|
FOOTPRINT* footprint = new FOOTPRINT( m_board );
|
||||||
m_board->Add( footprint, ADD_MODE::APPEND );
|
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->SetLayer( m_Mirror ? B_Cu : F_Cu );
|
||||||
footprint->SetOrientation( EDA_ANGLE( m_rotation, TENTHS_OF_A_DEGREE_T ) );
|
footprint->SetOrientation( m_rotation );
|
||||||
footprint->SetLastEditTime( 0 );
|
footprint->SetLastEditTime( 0 );
|
||||||
|
|
||||||
LIB_ID fpID;
|
LIB_ID fpID;
|
||||||
|
@ -530,7 +530,7 @@ void PCB_FOOTPRINT::AddToBoard()
|
||||||
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( EDA_ANGLE( r, TENTHS_OF_A_DEGREE_T ) );
|
ref_text->SetTextAngle( r );
|
||||||
ref_text->SetKeepUpright( false );
|
ref_text->SetKeepUpright( false );
|
||||||
|
|
||||||
ref_text->SetItalic( m_name.isItalic );
|
ref_text->SetItalic( m_name.isItalic );
|
||||||
|
@ -558,7 +558,7 @@ void PCB_FOOTPRINT::AddToBoard()
|
||||||
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( EDA_ANGLE( r, TENTHS_OF_A_DEGREE_T ) );
|
val_text->SetTextAngle( r );
|
||||||
val_text->SetKeepUpright( false );
|
val_text->SetKeepUpright( false );
|
||||||
|
|
||||||
val_text->SetItalic( m_Value.isItalic );
|
val_text->SetItalic( m_Value.isItalic );
|
||||||
|
|
|
@ -67,7 +67,7 @@ void PCB_PAD::Parse( XNODE* aNode, const wxString& aDefaultUnits,
|
||||||
wxString propValue, str, emsg;
|
wxString propValue, str, emsg;
|
||||||
PCB_PAD_SHAPE* padShape;
|
PCB_PAD_SHAPE* padShape;
|
||||||
|
|
||||||
m_rotation = 0;
|
m_rotation = ANGLE_0;
|
||||||
lNode = FindNode( aNode, wxT( "padNum" ) );
|
lNode = FindNode( aNode, wxT( "padNum" ) );
|
||||||
|
|
||||||
if( lNode )
|
if( lNode )
|
||||||
|
@ -99,7 +99,7 @@ void PCB_PAD::Parse( XNODE* aNode, const wxString& aDefaultUnits,
|
||||||
{
|
{
|
||||||
str = lNode->GetNodeContent();
|
str = lNode->GetNodeContent();
|
||||||
str.Trim( false );
|
str.Trim( false );
|
||||||
m_rotation = StrToInt1Units( str );
|
m_rotation = EDA_ANGLE( StrToInt1Units( str ), TENTHS_OF_A_DEGREE_T );
|
||||||
}
|
}
|
||||||
|
|
||||||
lNode = FindNode( aNode, wxT( "netNameRef" ) );
|
lNode = FindNode( aNode, wxT( "netNameRef" ) );
|
||||||
|
@ -191,7 +191,8 @@ void PCB_PAD::Flip()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncapsulatedPad )
|
void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, const EDA_ANGLE& aRotation,
|
||||||
|
bool aEncapsulatedPad )
|
||||||
{
|
{
|
||||||
PCB_PAD_SHAPE* padShape;
|
PCB_PAD_SHAPE* padShape;
|
||||||
wxString padShapeName = wxT( "Ellipse" );
|
wxString padShapeName = wxT( "Ellipse" );
|
||||||
|
@ -288,7 +289,7 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps
|
||||||
|
|
||||||
pad->SetSize( VECTOR2I( width, height ) );
|
pad->SetSize( VECTOR2I( width, height ) );
|
||||||
pad->SetDelta( VECTOR2I( 0, 0 ) );
|
pad->SetDelta( VECTOR2I( 0, 0 ) );
|
||||||
pad->SetOrientation( EDA_ANGLE( m_rotation + aRotation, TENTHS_OF_A_DEGREE_T ) );
|
pad->SetOrientation( m_rotation + aRotation );
|
||||||
|
|
||||||
pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
|
pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
|
||||||
pad->SetOffset( VECTOR2I( 0, 0 ) );
|
pad->SetOffset( VECTOR2I( 0, 0 ) );
|
||||||
|
@ -378,7 +379,7 @@ void PCB_PAD::AddToBoard()
|
||||||
m_name.text = m_defaultPinDes;
|
m_name.text = m_defaultPinDes;
|
||||||
|
|
||||||
footprint->SetPosition( VECTOR2I( m_positionX, m_positionY ) );
|
footprint->SetPosition( VECTOR2I( m_positionX, m_positionY ) );
|
||||||
AddToFootprint( footprint, 0, true );
|
AddToFootprint( footprint, ANGLE_0, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,10 @@ public:
|
||||||
|
|
||||||
void AddToFootprint( FOOTPRINT* aFootprint ) override
|
void AddToFootprint( FOOTPRINT* aFootprint ) override
|
||||||
{
|
{
|
||||||
AddToFootprint( aFootprint, 0, true );
|
AddToFootprint( aFootprint, ANGLE_0, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncapsulatedPad );
|
void AddToFootprint( FOOTPRINT* aFootprint, const EDA_ANGLE& aRotation, bool aEncapsulatedPad );
|
||||||
|
|
||||||
void AddToBoard() override;
|
void AddToBoard() override;
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ void PCB_TEXT::Parse( XNODE* aNode, int aLayer, const wxString& aDefaultUnits,
|
||||||
{
|
{
|
||||||
str = lNode->GetNodeContent();
|
str = lNode->GetNodeContent();
|
||||||
str.Trim( false );
|
str.Trim( false );
|
||||||
m_rotation = StrToInt1Units( str );
|
m_rotation = EDA_ANGLE( StrToInt1Units( str ), TENTHS_OF_A_DEGREE_T );
|
||||||
}
|
}
|
||||||
|
|
||||||
aNode->GetAttribute( wxT( "Name" ), &m_name.text );
|
aNode->GetAttribute( wxT( "Name" ), &m_name.text );
|
||||||
|
@ -122,9 +122,9 @@ void PCB_TEXT::AddToBoard()
|
||||||
pcbtxt->SetMirrored( m_name.mirror );
|
pcbtxt->SetMirrored( m_name.mirror );
|
||||||
|
|
||||||
if( pcbtxt->IsMirrored() )
|
if( pcbtxt->IsMirrored() )
|
||||||
pcbtxt->SetTextAngle( ANGLE_360 - EDA_ANGLE( m_name.textRotation, TENTHS_OF_A_DEGREE_T ) );
|
pcbtxt->SetTextAngle( ANGLE_360 - m_name.textRotation );
|
||||||
else
|
else
|
||||||
pcbtxt->SetTextAngle( EDA_ANGLE( m_name.textRotation, TENTHS_OF_A_DEGREE_T ) );
|
pcbtxt->SetTextAngle( m_name.textRotation );
|
||||||
|
|
||||||
pcbtxt->SetLayer( m_KiCadLayer );
|
pcbtxt->SetLayer( m_KiCadLayer );
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ void PCB_VIA::Parse( XNODE* aNode, const wxString& aDefaultUnits,
|
||||||
wxString propValue;
|
wxString propValue;
|
||||||
PCB_VIA_SHAPE* viaShape;
|
PCB_VIA_SHAPE* viaShape;
|
||||||
|
|
||||||
m_rotation = 0;
|
m_rotation = ANGLE_0;
|
||||||
lNode = FindNode( aNode, wxT( "viaStyleRef" ) );
|
lNode = FindNode( aNode, wxT( "viaStyleRef" ) );
|
||||||
|
|
||||||
if( lNode )
|
if( lNode )
|
||||||
|
|
Loading…
Reference in New Issue