Coding standards.
This commit is contained in:
parent
09c9bc3037
commit
2a525cf986
|
@ -58,7 +58,7 @@ public:
|
|||
HYPERLYNX_PAD_STACK( BOARD* aBoard, const PCB_VIA* aVia );
|
||||
~HYPERLYNX_PAD_STACK(){};
|
||||
|
||||
bool isThrough() const
|
||||
bool IsThrough() const
|
||||
{
|
||||
return m_type == PAD_ATTRIB::NPTH || m_type == PAD_ATTRIB::PTH;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public:
|
|||
if( m_type != other.m_type )
|
||||
return false;
|
||||
|
||||
if( isThrough() && other.isThrough() && m_drill != other.m_drill )
|
||||
if( IsThrough() && other.IsThrough() && m_drill != other.m_drill )
|
||||
return false;
|
||||
|
||||
if( m_sx != other.m_sx )
|
||||
|
@ -89,18 +89,19 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool isSMD() const
|
||||
bool IsSMD() const
|
||||
{
|
||||
return m_type == PAD_ATTRIB::SMD;
|
||||
}
|
||||
|
||||
PCB_LAYER_ID getSMDLayer() const
|
||||
PCB_LAYER_ID GetSMDLayer() const
|
||||
{
|
||||
for( auto l : LSET::AllCuMask().Seq() )
|
||||
for( PCB_LAYER_ID l : LSET::AllCuMask().Seq() )
|
||||
{
|
||||
if( m_layers[l] )
|
||||
return l;
|
||||
}
|
||||
|
||||
return F_Cu;
|
||||
}
|
||||
|
||||
|
@ -121,12 +122,15 @@ public:
|
|||
case PAD_SHAPE::CIRCLE:
|
||||
case PAD_SHAPE::OVAL:
|
||||
case PAD_SHAPE::ROUNDRECT:
|
||||
case PAD_SHAPE::RECT: return true;
|
||||
default: return false;
|
||||
case PAD_SHAPE::RECT:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool isEmpty() const
|
||||
bool IsEmpty() const
|
||||
{
|
||||
LSET layerMask = LSET::AllCuMask() & m_board->GetEnabledLayers();
|
||||
LSET outLayers = m_layers & layerMask;
|
||||
|
@ -198,10 +202,11 @@ private:
|
|||
break;
|
||||
}
|
||||
|
||||
snprintf( buf, sizeof( buf ), "%d, %.9f, %.9f, %.1f, M", shapeId,
|
||||
iu2hyp( aStack.m_sx ),
|
||||
iu2hyp( aStack.m_sy ),
|
||||
aStack.m_angle );
|
||||
snprintf( buf, sizeof( buf ), "%d, %.9f, %.9f, %.1f, M",
|
||||
shapeId,
|
||||
iu2hyp( aStack.m_sx ),
|
||||
iu2hyp( aStack.m_sy ),
|
||||
aStack.m_angle );
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
@ -219,12 +224,12 @@ private:
|
|||
|
||||
const std::vector<BOARD_ITEM*> collectNetObjects( int netcode );
|
||||
|
||||
private:
|
||||
std::vector<HYPERLYNX_PAD_STACK*> m_padStacks;
|
||||
std::map<BOARD_ITEM*, HYPERLYNX_PAD_STACK*> m_padMap;
|
||||
|
||||
|
||||
std::shared_ptr<FILE_OUTPUTFORMATTER> m_out;
|
||||
int m_polyId;
|
||||
std::shared_ptr<FILE_OUTPUTFORMATTER> m_out;
|
||||
int m_polyId;
|
||||
};
|
||||
|
||||
|
||||
|
@ -236,9 +241,7 @@ HYPERLYNX_PAD_STACK::HYPERLYNX_PAD_STACK( BOARD* aBoard, const PAD* aPad )
|
|||
m_angle = 180.0 - aPad->GetOrientation().AsDegrees();
|
||||
|
||||
if( m_angle < 0.0 )
|
||||
{
|
||||
m_angle += 360.0;
|
||||
}
|
||||
|
||||
m_layers = aPad->GetLayerSet();
|
||||
m_drill = aPad->GetDrillSize().x;
|
||||
|
@ -282,14 +285,15 @@ void HYPERLYNX_EXPORTER::writeSinglePadStack( HYPERLYNX_PAD_STACK& aStack )
|
|||
|
||||
if( outLayers == layerMask )
|
||||
{
|
||||
m_out->Print( 1, "(\"%s\", %s)\n", "MDEF", formatPadShape( aStack ).c_str() );
|
||||
m_out->Print( 1, "(\"MDEF\", %s)\n", formatPadShape( aStack ).c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( PCB_LAYER_ID l : outLayers.Seq() )
|
||||
{
|
||||
m_out->Print( 1, "(\"%s\", %s)\n", (const char*) m_board->GetLayerName( l ).c_str(),
|
||||
formatPadShape( aStack ).c_str() );
|
||||
m_out->Print( 1, "(\"%s\", %s)\n",
|
||||
(const char*) m_board->GetLayerName( l ).c_str(),
|
||||
formatPadShape( aStack ).c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -315,9 +319,12 @@ bool HYPERLYNX_EXPORTER::writeBoardInfo()
|
|||
|
||||
for( int i = 0; i < outl.SegmentCount(); i++ )
|
||||
{
|
||||
const auto& s = outl.CSegment( i );
|
||||
const SEG& s = outl.CSegment( i );
|
||||
m_out->Print( 1, "(PERIMETER_SEGMENT X1=%.9f Y1=%.9f X2=%.9f Y2=%.9f)\n",
|
||||
iu2hyp( s.A.x ), iu2hyp( s.A.y ), iu2hyp( s.B.x ), iu2hyp( s.B.y ) );
|
||||
iu2hyp( s.A.x ),
|
||||
iu2hyp( s.A.y ),
|
||||
iu2hyp( s.B.x ),
|
||||
iu2hyp( s.B.y ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,7 +381,8 @@ bool HYPERLYNX_EXPORTER::writeStackupInfo()
|
|||
m_out->Print( 1, "(DIELECTRIC T=%g C=%g L=\"DE%d_%.16s\" M=\"%.20s\")\n",
|
||||
iu2hyp( item->GetThickness( idx ) ),
|
||||
item->GetEpsilonR( idx ),
|
||||
idx, TO_UTF8( layer_name ),
|
||||
idx,
|
||||
TO_UTF8( layer_name ),
|
||||
TO_UTF8( item->GetMaterial( idx ) ) );
|
||||
}
|
||||
}
|
||||
|
@ -398,8 +406,9 @@ bool HYPERLYNX_EXPORTER::writeDevices()
|
|||
if( ref.IsEmpty() )
|
||||
ref = wxT( "EMPTY" );
|
||||
|
||||
m_out->Print( 1, "(? REF=\"%s\" L=\"%s\")\n", (const char*) ref.c_str(),
|
||||
(const char*) layerName.c_str() );
|
||||
m_out->Print( 1, "(? REF=\"%s\" L=\"%s\")\n",
|
||||
(const char*) ref.c_str(),
|
||||
(const char*) layerName.c_str() );
|
||||
}
|
||||
m_out->Print( 0, "}\n\n" );
|
||||
|
||||
|
@ -456,9 +465,11 @@ bool HYPERLYNX_EXPORTER::writeNetObjects( const std::vector<BOARD_ITEM*>& aObjec
|
|||
|
||||
|
||||
m_out->Print( 1, "(PIN X=%.10f Y=%.10f R=\"%s.%s\" P=%d)\n",
|
||||
iu2hyp( pad->GetPosition().x ), iu2hyp( pad->GetPosition().y ),
|
||||
(const char*) ref.c_str(), (const char*) padName.c_str(),
|
||||
pstackIter->second->GetId() );
|
||||
iu2hyp( pad->GetPosition().x ),
|
||||
iu2hyp( pad->GetPosition().y ),
|
||||
(const char*) ref.c_str(),
|
||||
(const char*) padName.c_str(),
|
||||
pstackIter->second->GetId() );
|
||||
}
|
||||
}
|
||||
else if( PCB_VIA* via = dyn_cast<PCB_VIA*>( item ) )
|
||||
|
@ -467,8 +478,10 @@ bool HYPERLYNX_EXPORTER::writeNetObjects( const std::vector<BOARD_ITEM*>& aObjec
|
|||
|
||||
if( pstackIter != m_padMap.end() )
|
||||
{
|
||||
m_out->Print( 1, "(VIA X=%.10f Y=%.10f P=%d)\n", iu2hyp( via->GetPosition().x ),
|
||||
iu2hyp( via->GetPosition().y ), pstackIter->second->GetId() );
|
||||
m_out->Print( 1, "(VIA X=%.10f Y=%.10f P=%d)\n",
|
||||
iu2hyp( via->GetPosition().x ),
|
||||
iu2hyp( via->GetPosition().y ),
|
||||
pstackIter->second->GetId() );
|
||||
}
|
||||
}
|
||||
else if( PCB_TRACK* track = dyn_cast<PCB_TRACK*>( item ) )
|
||||
|
@ -476,9 +489,12 @@ bool HYPERLYNX_EXPORTER::writeNetObjects( const std::vector<BOARD_ITEM*>& aObjec
|
|||
const wxString layerName = m_board->GetLayerName( track->GetLayer() );
|
||||
|
||||
m_out->Print( 1, "(SEG X1=%.10f Y1=%.10f X2=%.10f Y2=%.10f W=%.10f L=\"%s\")\n",
|
||||
iu2hyp( track->GetStart().x ), iu2hyp( track->GetStart().y ),
|
||||
iu2hyp( track->GetEnd().x ), iu2hyp( track->GetEnd().y ),
|
||||
iu2hyp( track->GetWidth() ), (const char*) layerName.c_str() );
|
||||
iu2hyp( track->GetStart().x ),
|
||||
iu2hyp( track->GetStart().y ),
|
||||
iu2hyp( track->GetEnd().x ),
|
||||
iu2hyp( track->GetEnd().y ),
|
||||
iu2hyp( track->GetWidth() ),
|
||||
(const char*) layerName.c_str() );
|
||||
}
|
||||
else if( ZONE* zone = dyn_cast<ZONE*>( item ) )
|
||||
{
|
||||
|
@ -492,8 +508,8 @@ bool HYPERLYNX_EXPORTER::writeNetObjects( const std::vector<BOARD_ITEM*>& aObjec
|
|||
for( int i = 0; i < fill.OutlineCount(); i++ )
|
||||
{
|
||||
const SHAPE_LINE_CHAIN& outl = fill.COutline( i );
|
||||
const VECTOR2I p0 = outl.CPoint( 0 );
|
||||
|
||||
auto p0 = outl.CPoint( 0 );
|
||||
m_out->Print( 1, "{POLYGON T=POUR L=\"%s\" ID=%d X=%.10f Y=%.10f\n",
|
||||
(const char*) layerName.c_str(),
|
||||
m_polyId,
|
||||
|
@ -513,7 +529,7 @@ bool HYPERLYNX_EXPORTER::writeNetObjects( const std::vector<BOARD_ITEM*>& aObjec
|
|||
for( int h = 0; h < fill.HoleCount( i ); h++ )
|
||||
{
|
||||
const SHAPE_LINE_CHAIN& holeShape = fill.CHole( i, h );
|
||||
VECTOR2I ph0 = holeShape.CPoint( 0 );
|
||||
const VECTOR2I ph0 = holeShape.CPoint( 0 );
|
||||
|
||||
m_out->Print( 1, "{POLYVOID ID=%d X=%.10f Y=%.10f\n",
|
||||
m_polyId,
|
||||
|
@ -588,15 +604,15 @@ bool HYPERLYNX_EXPORTER::writeNets()
|
|||
{
|
||||
m_polyId = 1;
|
||||
|
||||
for( const auto netInfo : m_board->GetNetInfo() )
|
||||
for( const NETINFO_ITEM* netInfo : m_board->GetNetInfo() )
|
||||
{
|
||||
int netcode = netInfo->GetNetCode();
|
||||
int netcode = netInfo->GetNetCode();
|
||||
bool isNullNet = netInfo->GetNetCode() <= 0 || netInfo->GetNetname().IsEmpty();
|
||||
|
||||
if( isNullNet )
|
||||
continue;
|
||||
|
||||
auto netObjects = collectNetObjects( netcode );
|
||||
const std::vector<BOARD_ITEM*> netObjects = collectNetObjects( netcode );
|
||||
|
||||
if( netObjects.size() )
|
||||
{
|
||||
|
@ -606,11 +622,11 @@ bool HYPERLYNX_EXPORTER::writeNets()
|
|||
}
|
||||
}
|
||||
|
||||
auto nullNetObjects = collectNetObjects( -1 );
|
||||
const std::vector<BOARD_ITEM*> nullNetObjects = collectNetObjects( -1 );
|
||||
|
||||
int idx = 0;
|
||||
|
||||
for( auto item : nullNetObjects )
|
||||
for( BOARD_ITEM* item : nullNetObjects )
|
||||
{
|
||||
m_out->Print( 0, "{NET=\"EmptyNet%d\"\n", idx );
|
||||
writeNetObjects( { item } );
|
||||
|
|
Loading…
Reference in New Issue