SCH_SHEET_PIN: Rename GetEdge, SetEdge to GetSide, SetSide

This commit is contained in:
Mikolaj Wielgus 2021-11-28 20:06:08 +01:00
parent 80d6b9e76d
commit 9bb370e6b4
10 changed files with 43 additions and 43 deletions

View File

@ -1695,7 +1695,7 @@ void SCH_PAINTER::draw( const SCH_SHEET *aSheet, int aLayer )
wxPoint offset_pos = initial_pos; wxPoint offset_pos = initial_pos;
// For aesthetic reasons, the SHEET_PIN is drawn with a small offset of width / 2 // For aesthetic reasons, the SHEET_PIN is drawn with a small offset of width / 2
switch( sheetPin->GetEdge() ) switch( sheetPin->GetSide() )
{ {
case SHEET_SIDE::TOP: offset_pos.y += KiROUND( width / 2.0 ); break; case SHEET_SIDE::TOP: offset_pos.y += KiROUND( width / 2.0 ); break;
case SHEET_SIDE::BOTTOM: offset_pos.y -= KiROUND( width / 2.0 ); break; case SHEET_SIDE::BOTTOM: offset_pos.y -= KiROUND( width / 2.0 ); break;

View File

@ -1559,22 +1559,22 @@ void SCH_ALTIUM_PLUGIN::ParseSheetEntry( const std::map<wxString, wxString>& aPr
case ASCH_SHEET_ENTRY_SIDE::LEFT: case ASCH_SHEET_ENTRY_SIDE::LEFT:
sheetPin->SetPosition( { pos.x, pos.y + elem.distanceFromTop } ); sheetPin->SetPosition( { pos.x, pos.y + elem.distanceFromTop } );
sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT );
sheetPin->SetEdge( SHEET_SIDE::LEFT ); sheetPin->SetSide( SHEET_SIDE::LEFT );
break; break;
case ASCH_SHEET_ENTRY_SIDE::RIGHT: case ASCH_SHEET_ENTRY_SIDE::RIGHT:
sheetPin->SetPosition( { pos.x + size.x, pos.y + elem.distanceFromTop } ); sheetPin->SetPosition( { pos.x + size.x, pos.y + elem.distanceFromTop } );
sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT );
sheetPin->SetEdge( SHEET_SIDE::RIGHT ); sheetPin->SetSide( SHEET_SIDE::RIGHT );
break; break;
case ASCH_SHEET_ENTRY_SIDE::TOP: case ASCH_SHEET_ENTRY_SIDE::TOP:
sheetPin->SetPosition( { pos.x + elem.distanceFromTop, pos.y } ); sheetPin->SetPosition( { pos.x + elem.distanceFromTop, pos.y } );
sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::UP ); sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::UP );
sheetPin->SetEdge( SHEET_SIDE::TOP ); sheetPin->SetSide( SHEET_SIDE::TOP );
break; break;
case ASCH_SHEET_ENTRY_SIDE::BOTTOM: case ASCH_SHEET_ENTRY_SIDE::BOTTOM:
sheetPin->SetPosition( { pos.x + elem.distanceFromTop, pos.y + size.y } ); sheetPin->SetPosition( { pos.x + elem.distanceFromTop, pos.y + size.y } );
sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::BOTTOM ); sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::BOTTOM );
sheetPin->SetEdge( SHEET_SIDE::BOTTOM ); sheetPin->SetSide( SHEET_SIDE::BOTTOM );
break; break;
} }

View File

@ -1826,13 +1826,13 @@ SCH_SHEET_PIN* SCH_SEXPR_PARSER::parseSchSheetPin( SCH_SHEET* aSheet )
double angle = parseDouble( "sheet pin angle (side)" ); double angle = parseDouble( "sheet pin angle (side)" );
if( angle == 0.0 ) if( angle == 0.0 )
sheetPin->SetEdge( SHEET_SIDE::RIGHT ); sheetPin->SetSide( SHEET_SIDE::RIGHT );
else if( angle == 90.0 ) else if( angle == 90.0 )
sheetPin->SetEdge( SHEET_SIDE::TOP ); sheetPin->SetSide( SHEET_SIDE::TOP );
else if( angle == 180.0 ) else if( angle == 180.0 )
sheetPin->SetEdge( SHEET_SIDE::LEFT ); sheetPin->SetSide( SHEET_SIDE::LEFT );
else if( angle == 270.0 ) else if( angle == 270.0 )
sheetPin->SetEdge( SHEET_SIDE::BOTTOM ); sheetPin->SetSide( SHEET_SIDE::BOTTOM );
else else
Expecting( "0, 90, 180, or 270" ); Expecting( "0, 90, 180, or 270" );

View File

@ -1279,7 +1279,7 @@ void SCH_SEXPR_PLUGIN::saveSheet( SCH_SHEET* aSheet, int aNestLevel )
getSheetPinShapeToken( pin->GetShape() ), getSheetPinShapeToken( pin->GetShape() ),
FormatInternalUnits( pin->GetPosition().x ).c_str(), FormatInternalUnits( pin->GetPosition().x ).c_str(),
FormatInternalUnits( pin->GetPosition().y ).c_str(), FormatInternalUnits( pin->GetPosition().y ).c_str(),
FormatAngle( getSheetPinAngle( pin->GetEdge() ) * 10.0 ).c_str() ); FormatAngle( getSheetPinAngle( pin->GetSide() ) * 10.0 ).c_str() );
pin->Format( m_out, aNestLevel + 1, 0 ); pin->Format( m_out, aNestLevel + 1, 0 );

View File

@ -1091,10 +1091,10 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
switch( parseChar( aReader, line, &line ) ) switch( parseChar( aReader, line, &line ) )
{ {
case 'R': sheetPin->SetEdge( SHEET_SIDE::RIGHT ); break; case 'R': sheetPin->SetSide( SHEET_SIDE::RIGHT ); break;
case 'T': sheetPin->SetEdge( SHEET_SIDE::TOP ); break; case 'T': sheetPin->SetSide( SHEET_SIDE::TOP ); break;
case 'B': sheetPin->SetEdge( SHEET_SIDE::BOTTOM ); break; case 'B': sheetPin->SetSide( SHEET_SIDE::BOTTOM ); break;
case 'L': sheetPin->SetEdge( SHEET_SIDE::LEFT ); break; case 'L': sheetPin->SetSide( SHEET_SIDE::LEFT ); break;
default: default:
SCH_PARSE_ERROR( "invalid sheet pin side", aReader, line ); SCH_PARSE_ERROR( "invalid sheet pin side", aReader, line );
} }
@ -2255,7 +2255,7 @@ void SCH_LEGACY_PLUGIN::saveSheet( SCH_SHEET* aSheet )
if( pin->GetText().IsEmpty() ) if( pin->GetText().IsEmpty() )
break; break;
switch( pin->GetEdge() ) switch( pin->GetSide() )
{ {
default: default:
case SHEET_SIDE::LEFT: side = 'L'; break; case SHEET_SIDE::LEFT: side = 'L'; break;

View File

@ -371,7 +371,7 @@ bool SCH_SHEET::IsVerticalOrientation() const
for( SCH_SHEET_PIN* pin : m_pins ) for( SCH_SHEET_PIN* pin : m_pins )
{ {
switch( pin->GetEdge() ) switch( pin->GetSide() )
{ {
case SHEET_SIDE::LEFT: leftRight++; break; case SHEET_SIDE::LEFT: leftRight++; break;
case SHEET_SIDE::RIGHT: leftRight++; break; case SHEET_SIDE::RIGHT: leftRight++; break;
@ -424,7 +424,7 @@ int SCH_SHEET::GetMinWidth( bool aFromLeft ) const
for( size_t i = 0; i < m_pins.size(); i++ ) for( size_t i = 0; i < m_pins.size(); i++ )
{ {
SHEET_SIDE edge = m_pins[i]->GetEdge(); SHEET_SIDE edge = m_pins[i]->GetSide();
if( edge == SHEET_SIDE::TOP || edge == SHEET_SIDE::BOTTOM ) if( edge == SHEET_SIDE::TOP || edge == SHEET_SIDE::BOTTOM )
{ {
@ -458,7 +458,7 @@ int SCH_SHEET::GetMinHeight( bool aFromTop ) const
for( size_t i = 0; i < m_pins.size(); i++ ) for( size_t i = 0; i < m_pins.size(); i++ )
{ {
SHEET_SIDE edge = m_pins[i]->GetEdge(); SHEET_SIDE edge = m_pins[i]->GetSide();
if( edge == SHEET_SIDE::RIGHT || edge == SHEET_SIDE::LEFT ) if( edge == SHEET_SIDE::RIGHT || edge == SHEET_SIDE::LEFT )
{ {

View File

@ -49,9 +49,9 @@ SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxStr
SetTextPos( pos ); SetTextPos( pos );
if( parent->IsVerticalOrientation() ) if( parent->IsVerticalOrientation() )
SetEdge( SHEET_SIDE::TOP ); SetSide( SHEET_SIDE::TOP );
else else
SetEdge( SHEET_SIDE::LEFT ); SetSide( SHEET_SIDE::LEFT );
m_shape = PINSHEETLABEL_SHAPE::PS_INPUT; m_shape = PINSHEETLABEL_SHAPE::PS_INPUT;
m_isDangling = true; m_isDangling = true;
@ -83,9 +83,9 @@ void SCH_SHEET_PIN::SwapData( SCH_ITEM* aItem )
int tmp = pin->GetNumber(); int tmp = pin->GetNumber();
pin->SetNumber( GetNumber() ); pin->SetNumber( GetNumber() );
SetNumber( tmp ); SetNumber( tmp );
SHEET_SIDE stmp = pin->GetEdge(); SHEET_SIDE stmp = pin->GetSide();
pin->SetEdge( GetEdge() ); pin->SetSide( GetSide() );
SetEdge( stmp ); SetSide( stmp );
} }
@ -112,7 +112,7 @@ void SCH_SHEET_PIN::SetNumber( int aNumber )
} }
void SCH_SHEET_PIN::SetEdge( SHEET_SIDE aEdge ) void SCH_SHEET_PIN::SetSide( SHEET_SIDE aEdge )
{ {
SCH_SHEET* Sheet = GetParent(); SCH_SHEET* Sheet = GetParent();
@ -150,7 +150,7 @@ void SCH_SHEET_PIN::SetEdge( SHEET_SIDE aEdge )
} }
enum SHEET_SIDE SCH_SHEET_PIN::GetEdge() const enum SHEET_SIDE SCH_SHEET_PIN::GetSide() const
{ {
return m_edge; return m_edge;
} }
@ -178,14 +178,14 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
switch( sheetEdge.NearestSegment( Pos ) ) switch( sheetEdge.NearestSegment( Pos ) )
{ {
case 0: SetEdge( SHEET_SIDE::TOP ); break; case 0: SetSide( SHEET_SIDE::TOP ); break;
case 1: SetEdge( SHEET_SIDE::RIGHT ); break; case 1: SetSide( SHEET_SIDE::RIGHT ); break;
case 2: SetEdge( SHEET_SIDE::BOTTOM ); break; case 2: SetSide( SHEET_SIDE::BOTTOM ); break;
case 3: SetEdge( SHEET_SIDE::LEFT ); break; case 3: SetSide( SHEET_SIDE::LEFT ); break;
default: wxASSERT( "Invalid segment number" ); default: wxASSERT( "Invalid segment number" );
} }
switch( GetEdge() ) switch( GetSide() )
{ {
case SHEET_SIDE::RIGHT: case SHEET_SIDE::RIGHT:
case SHEET_SIDE::LEFT: case SHEET_SIDE::LEFT:
@ -225,8 +225,8 @@ void SCH_SHEET_PIN::MirrorVertically( int aCenter )
switch( m_edge ) switch( m_edge )
{ {
case SHEET_SIDE::TOP: SetEdge( SHEET_SIDE::BOTTOM ); break; case SHEET_SIDE::TOP: SetSide( SHEET_SIDE::BOTTOM ); break;
case SHEET_SIDE::BOTTOM: SetEdge( SHEET_SIDE::TOP ); break; case SHEET_SIDE::BOTTOM: SetSide( SHEET_SIDE::TOP ); break;
default: break; default: break;
} }
} }
@ -240,8 +240,8 @@ void SCH_SHEET_PIN::MirrorHorizontally( int aCenter )
switch( m_edge ) switch( m_edge )
{ {
case SHEET_SIDE::LEFT: SetEdge( SHEET_SIDE::RIGHT ); break; case SHEET_SIDE::LEFT: SetSide( SHEET_SIDE::RIGHT ); break;
case SHEET_SIDE::RIGHT: SetEdge( SHEET_SIDE::LEFT ); break; case SHEET_SIDE::RIGHT: SetSide( SHEET_SIDE::LEFT ); break;
default: break; default: break;
} }
} }
@ -254,13 +254,13 @@ void SCH_SHEET_PIN::Rotate( const wxPoint& aCenter )
RotatePoint( &pt, aCenter, 900 ); RotatePoint( &pt, aCenter, 900 );
SHEET_SIDE oldSide = GetEdge(); SHEET_SIDE oldSide = GetSide();
ConstrainOnEdge( pt ); ConstrainOnEdge( pt );
// If the new side is the same as the old side, instead mirror across the center of that side. // If the new side is the same as the old side, instead mirror across the center of that side.
if( GetEdge() == oldSide ) if( GetSide() == oldSide )
{ {
switch( GetEdge() ) switch( GetSide() )
{ {
case SHEET_SIDE::TOP: case SHEET_SIDE::TOP:
case SHEET_SIDE::BOTTOM: case SHEET_SIDE::BOTTOM:
@ -278,9 +278,9 @@ void SCH_SHEET_PIN::Rotate( const wxPoint& aCenter )
} }
// If the new side is opposite to the old side, instead mirror across the center of an adjacent // If the new side is opposite to the old side, instead mirror across the center of an adjacent
// side. // side.
else if( GetEdge() == GetOppositeSide( oldSide ) ) else if( GetSide() == GetOppositeSide( oldSide ) )
{ {
switch( GetEdge() ) switch( GetSide() )
{ {
case SHEET_SIDE::TOP: case SHEET_SIDE::TOP:
case SHEET_SIDE::BOTTOM: case SHEET_SIDE::BOTTOM:

View File

@ -133,9 +133,9 @@ public:
*/ */
void SetNumber( int aNumber ); void SetNumber( int aNumber );
void SetEdge( SHEET_SIDE aEdge ); void SetSide( SHEET_SIDE aEdge );
SHEET_SIDE GetEdge() const; SHEET_SIDE GetSide() const;
/** /**
* Adjust label position to edge based on proximity to vertical or horizontal edge * Adjust label position to edge based on proximity to vertical or horizontal edge

View File

@ -603,7 +603,7 @@ void EE_POINT_EDITOR::updateParentItem() const
pos += originDelta; pos += originDelta;
switch( pin->GetEdge() ) switch( pin->GetSide() )
{ {
case SHEET_SIDE::LEFT: pos.x = topLeft.x; break; case SHEET_SIDE::LEFT: pos.x = topLeft.x; break;
case SHEET_SIDE::RIGHT: pos.x = topRight.x; break; case SHEET_SIDE::RIGHT: pos.x = topRight.x; break;

View File

@ -422,7 +422,7 @@ void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint( const std::pair<SCH_LINE*, SCH_L
int iDy = segment->GetEndPoint().y - segment->GetStartPoint().y; int iDy = segment->GetEndPoint().y - segment->GetStartPoint().y;
const SCH_SHEET_PIN* connectedPin = getSheetPin( segment->GetStartPoint() ); const SCH_SHEET_PIN* connectedPin = getSheetPin( segment->GetStartPoint() );
SHEET_SIDE force = connectedPin ? connectedPin->GetEdge() : SHEET_SIDE::UNDEFINED; SHEET_SIDE force = connectedPin ? connectedPin->GetSide() : SHEET_SIDE::UNDEFINED;
if( force == SHEET_SIDE::LEFT || force == SHEET_SIDE::RIGHT ) if( force == SHEET_SIDE::LEFT || force == SHEET_SIDE::RIGHT )
{ {