Retire Local/Draw coords distinction from PAD (the last object to have it).
This commit is contained in:
parent
7ca057ea02
commit
28028c941e
|
@ -88,7 +88,7 @@ size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags )
|
|||
if( aFlags & HASH_POS )
|
||||
{
|
||||
if( aFlags & REL_COORD )
|
||||
hash_combine( ret, pad->GetPos0().x, pad->GetPos0().y );
|
||||
hash_combine( ret, pad->GetFPRelativePosition().x, pad->GetFPRelativePosition().y );
|
||||
else
|
||||
hash_combine( ret, pad->GetPosition().x, pad->GetPosition().y );
|
||||
}
|
||||
|
|
|
@ -1653,11 +1653,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
if( footprint )
|
||||
{
|
||||
// compute the pos 0 value, i.e. pad position for footprint with orientation = 0
|
||||
// i.e. relative to footprint origin (footprint position)
|
||||
VECTOR2I pt = m_currentPad->GetPosition() - footprint->GetPosition();
|
||||
RotatePoint( pt, -footprint->GetOrientation() );
|
||||
m_currentPad->SetPos0( pt );
|
||||
m_currentPad->SetFPRelativePosition( m_currentPad->GetPosition() );
|
||||
m_currentPad->SetOrientation( m_currentPad->GetOrientation() + footprint->GetOrientation() );
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ bool padNeedsUpdate( const PAD* a, const PAD* b )
|
|||
bool diff = false;
|
||||
|
||||
TEST( a->GetPadToDieLength(), b->GetPadToDieLength(), "" );
|
||||
TEST( a->GetPos0(), b->GetPos0(), "" );
|
||||
TEST( a->GetFPRelativePosition(), b->GetFPRelativePosition(), "" );
|
||||
|
||||
TEST( a->GetNumber(), b->GetNumber(), "" );
|
||||
|
||||
|
|
|
@ -830,13 +830,15 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
|
|||
EDA_ANGLE orient = pad->GetOrientation() - footprint->GetOrientation();
|
||||
orient.Normalize();
|
||||
|
||||
VECTOR2I padPos = pad->GetFPRelativePosition();
|
||||
|
||||
// Bottom side footprints use the flipped padstack
|
||||
fprintf( aFile, ( flipBottomPads && footprint->GetFlag() ) ?
|
||||
"PIN \"%s\" PAD%dF %g %g %s %g %s\n" :
|
||||
"PIN \"%s\" PAD%d %g %g %s %g %s\n",
|
||||
TO_UTF8( escapeString( pinname ) ), pad->GetSubRatsnest(),
|
||||
pad->GetPos0().x / SCALE_FACTOR,
|
||||
-pad->GetPos0().y / SCALE_FACTOR,
|
||||
padPos.x / SCALE_FACTOR,
|
||||
-padPos.y / SCALE_FACTOR,
|
||||
layer, orient.AsDegrees(), mirror );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -233,11 +233,11 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
|
||||
buffer += "\n";
|
||||
|
||||
snprintf(line, sizeof(line), "%-*s %-*s %-*s %9.9s %9.9s %8.8s %s\n",
|
||||
int(lenRefText), "# Ref",
|
||||
int(lenValText), "Val",
|
||||
int(lenPkgText), "Package",
|
||||
"PosX", "PosY", "Rot", "Side" );
|
||||
snprintf( line, sizeof(line), "%-*s %-*s %-*s %9.9s %9.9s %8.8s %s\n",
|
||||
int(lenRefText), "# Ref",
|
||||
int(lenValText), "Val",
|
||||
int(lenPkgText), "Package",
|
||||
"PosX", "PosY", "Rot", "Side" );
|
||||
buffer += line;
|
||||
|
||||
for( int ii = 0; ii < m_fpCount; ii++ )
|
||||
|
@ -258,16 +258,16 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
ref.Replace( wxT( " " ), wxT( "_" ) );
|
||||
val.Replace( wxT( " " ), wxT( "_" ) );
|
||||
pkg.Replace( wxT( " " ), wxT( "_" ) );
|
||||
snprintf(line, sizeof(line), "%-*s %-*s %-*s %9.4f %9.4f %8.4f %s\n",
|
||||
lenRefText, TO_UTF8( ref ),
|
||||
lenValText, TO_UTF8( val ),
|
||||
lenPkgText, TO_UTF8( pkg ),
|
||||
footprint_pos.x * conv_unit,
|
||||
// Keep the coordinates in the first quadrant,
|
||||
// (i.e. change y sign
|
||||
-footprint_pos.y * conv_unit,
|
||||
list[ii].m_Footprint->GetOrientation().AsDegrees(),
|
||||
(layer == F_Cu ) ? GetFrontSideName().c_str() : GetBackSideName().c_str() );
|
||||
snprintf( line, sizeof(line), "%-*s %-*s %-*s %9.4f %9.4f %8.4f %s\n",
|
||||
lenRefText, TO_UTF8( ref ),
|
||||
lenValText, TO_UTF8( val ),
|
||||
lenPkgText, TO_UTF8( pkg ),
|
||||
footprint_pos.x * conv_unit,
|
||||
// Keep the coordinates in the first quadrant,
|
||||
// (i.e. change y sign
|
||||
-footprint_pos.y * conv_unit,
|
||||
list[ii].m_Footprint->GetOrientation().AsDegrees(),
|
||||
(layer == F_Cu ) ? GetFrontSideName().c_str() : GetBackSideName().c_str() );
|
||||
buffer += line;
|
||||
}
|
||||
|
||||
|
@ -309,11 +309,11 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
|
|||
buffer += "\n$BOARD\n";
|
||||
|
||||
snprintf( line, sizeof(line), "upper_left_corner %9.6f %9.6f\n",
|
||||
bbbox.GetX() * conv_unit, bbbox.GetY() * conv_unit );
|
||||
bbbox.GetX() * conv_unit, bbbox.GetY() * conv_unit );
|
||||
buffer += line;
|
||||
|
||||
snprintf( line, sizeof(line), "lower_right_corner %9.6f %9.6f\n",
|
||||
bbbox.GetRight() * conv_unit, bbbox.GetBottom() * conv_unit );
|
||||
bbbox.GetRight() * conv_unit, bbbox.GetBottom() * conv_unit );
|
||||
buffer += line;
|
||||
|
||||
buffer += "$EndBOARD\n\n";
|
||||
|
@ -358,9 +358,9 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
|
|||
footprint_pos -= m_place_Offset;
|
||||
|
||||
snprintf( line, sizeof(line), "position %9.6f %9.6f orientation %.2f\n",
|
||||
footprint_pos.x * conv_unit,
|
||||
footprint_pos.y * conv_unit,
|
||||
footprint->GetOrientation().AsDegrees() );
|
||||
footprint_pos.x * conv_unit,
|
||||
footprint_pos.y * conv_unit,
|
||||
footprint->GetOrientation().AsDegrees() );
|
||||
buffer += line;
|
||||
|
||||
if( footprint->GetLayer() == F_Cu )
|
||||
|
@ -396,24 +396,26 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
|
|||
|
||||
static const char* layer_name[4] = { "nocopper", "back", "front", "both" };
|
||||
snprintf( line, sizeof(line), "Shape %s Layer %s\n",
|
||||
TO_UTF8( pad->ShowPadShape() ),
|
||||
layer_name[layer] );
|
||||
TO_UTF8( pad->ShowPadShape() ),
|
||||
layer_name[layer] );
|
||||
buffer += line;
|
||||
|
||||
VECTOR2I padPos = pad->GetFPRelativePosition();
|
||||
|
||||
snprintf( line, sizeof(line), "position %9.6f %9.6f size %9.6f %9.6f orientation %.2f\n",
|
||||
pad->GetPos0().x * conv_unit,
|
||||
pad->GetPos0().y * conv_unit,
|
||||
pad->GetSize().x * conv_unit,
|
||||
pad->GetSize().y * conv_unit,
|
||||
( pad->GetOrientation() - footprint->GetOrientation() ).AsDegrees() );
|
||||
padPos.x * conv_unit,
|
||||
padPos.y * conv_unit,
|
||||
pad->GetSize().x * conv_unit,
|
||||
pad->GetSize().y * conv_unit,
|
||||
( pad->GetOrientation() - footprint->GetOrientation() ).AsDegrees() );
|
||||
buffer += line;
|
||||
|
||||
snprintf( line, sizeof(line), "drill %9.6f\n", pad->GetDrillSize().x * conv_unit );
|
||||
buffer += line;
|
||||
|
||||
snprintf( line, sizeof(line), "shape_offset %9.6f %9.6f\n",
|
||||
pad->GetOffset().x * conv_unit,
|
||||
pad->GetOffset().y * conv_unit );
|
||||
pad->GetOffset().x * conv_unit,
|
||||
pad->GetOffset().y * conv_unit );
|
||||
buffer += line;
|
||||
|
||||
buffer += "$EndPAD\n";
|
||||
|
|
|
@ -1692,10 +1692,7 @@ void FOOTPRINT::MoveAnchorPosition( const VECTOR2I& aMoveVector )
|
|||
|
||||
// Update the pad local coordinates.
|
||||
for( PAD* pad : m_pads )
|
||||
{
|
||||
pad->SetPos0( pad->GetPos0() + moveVector );
|
||||
pad->SetDrawCoord();
|
||||
}
|
||||
pad->Move( moveVector );
|
||||
|
||||
// Update the draw element coordinates.
|
||||
for( BOARD_ITEM* item : GraphicalItems() )
|
||||
|
@ -1727,10 +1724,7 @@ void FOOTPRINT::SetOrientation( const EDA_ANGLE& aNewAngle )
|
|||
m_orient.Normalize180();
|
||||
|
||||
for( PAD* pad : m_pads )
|
||||
{
|
||||
pad->SetOrientation( pad->GetOrientation() + angleChange );
|
||||
pad->SetDrawCoord();
|
||||
}
|
||||
pad->Rotate( GetPosition(), angleChange );
|
||||
|
||||
for( ZONE* zone : m_zones )
|
||||
zone->Rotate( GetPosition(), angleChange );
|
||||
|
@ -2598,7 +2592,7 @@ bool FOOTPRINT::cmp_pads::operator()( const PAD* aFirst, const PAD* aSecond ) co
|
|||
if( aFirst->GetNumber() != aSecond->GetNumber() )
|
||||
return StrNumCmp( aFirst->GetNumber(), aSecond->GetNumber() ) < 0;
|
||||
|
||||
TEST_PT( aFirst->GetPos0(), aSecond->GetPos0() );
|
||||
TEST_PT( aFirst->GetFPRelativePosition(), aSecond->GetFPRelativePosition() );
|
||||
TEST_PT( aFirst->GetSize(), aSecond->GetSize() );
|
||||
TEST( aFirst->GetShape(), aSecond->GetShape() );
|
||||
TEST( aFirst->GetLayerSet().Seq(), aSecond->GetLayerSet().Seq() );
|
||||
|
|
|
@ -213,7 +213,6 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri
|
|||
PAD* pad = (PAD*) item->Clone();
|
||||
|
||||
footprint->SetPosition( pad->GetPosition() );
|
||||
pad->SetPos0( VECTOR2I() );
|
||||
footprint->Add( pad );
|
||||
copy = footprint;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
|
||||
FOOTPRINT* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprintShape )
|
||||
{
|
||||
int oX;
|
||||
int offsetX;
|
||||
int offsetY;
|
||||
PAD* pad;
|
||||
FOOTPRINT* footprint;
|
||||
wxString msg;
|
||||
|
@ -125,23 +126,22 @@ FOOTPRINT* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprint
|
|||
switch( aFootprintShape )
|
||||
{
|
||||
case MICROWAVE_FOOTPRINT_SHAPE::GAP: //Gap :
|
||||
oX = -( gap_size + pad->GetSize().x ) / 2;
|
||||
pad->SetX0( oX );
|
||||
offsetX = -( gap_size + pad->GetSize().x ) / 2;
|
||||
|
||||
pad->SetX( pad->GetPos0().x + pad->GetPosition().x );
|
||||
pad->SetX( pad->GetPosition().x + offsetX );
|
||||
|
||||
pad = *( it + 1 );
|
||||
|
||||
pad->SetX0( oX + gap_size + pad->GetSize().x );
|
||||
pad->SetX( pad->GetPos0().x + pad->GetPosition().x );
|
||||
pad->SetX( pad->GetPosition().x + offsetX + gap_size + pad->GetSize().x );
|
||||
break;
|
||||
|
||||
case MICROWAVE_FOOTPRINT_SHAPE::STUB: //Stub :
|
||||
pad->SetNumber( wxT( "1" ) );
|
||||
offsetY = -( gap_size + pad->GetSize().y ) / 2;
|
||||
|
||||
pad = *( it + 1 );
|
||||
pad->SetY0( -( gap_size + pad->GetSize().y ) / 2 );
|
||||
pad->SetSize( VECTOR2I( pad->GetSize().x, gap_size ) );
|
||||
pad->SetY( pad->GetPos0().y + pad->GetPosition().y );
|
||||
pad->SetY( pad->GetPosition().y + offsetY );
|
||||
break;
|
||||
|
||||
case MICROWAVE_FOOTPRINT_SHAPE::STUB_ARC: // Arc Stub created by a polygonal approach:
|
||||
|
|
|
@ -432,7 +432,6 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN&
|
|||
|
||||
pad->SetNumber( wxT( "1" ) );
|
||||
pad->SetPosition( aInductorPattern.m_End );
|
||||
pad->SetPos0( pad->GetPosition() - footprint->GetPosition() );
|
||||
|
||||
pad->SetSize( VECTOR2I( aInductorPattern.m_Width, aInductorPattern.m_Width ) );
|
||||
|
||||
|
@ -448,7 +447,6 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN&
|
|||
pad = newpad;
|
||||
pad->SetNumber( wxT( "2" ) );
|
||||
pad->SetPosition( aInductorPattern.m_Start );
|
||||
pad->SetPos0( pad->GetPosition() - footprint->GetPosition() );
|
||||
|
||||
// Modify text positions.
|
||||
VECTOR2I refPos( ( aInductorPattern.m_Start.x + aInductorPattern.m_End.x ) / 2,
|
||||
|
|
|
@ -333,12 +333,10 @@ FOOTPRINT* MICROWAVE_TOOL::createPolygonShape()
|
|||
auto it = footprint->Pads().begin();
|
||||
|
||||
pad1 = *it;
|
||||
pad1->SetX0( offset.x );
|
||||
pad1->SetX( pad1->GetPos0().x );
|
||||
pad1->SetX( offset.x );
|
||||
|
||||
pad2 = *( ++it );
|
||||
pad2->SetX0( offset.x + g_ShapeSize.x );
|
||||
pad2->SetX( pad2->GetPos0().x );
|
||||
pad2->SetX( offset.x + g_ShapeSize.x );
|
||||
|
||||
// Add a polygonal edge (corners will be added later) on copper layer
|
||||
shape = new PCB_SHAPE( footprint, SHAPE_T::POLY );
|
||||
|
@ -386,8 +384,6 @@ FOOTPRINT* MICROWAVE_TOOL::createPolygonShape()
|
|||
}
|
||||
|
||||
shape->SetPolyPoints( polyPoints );
|
||||
shape->Rotate( { 0, 0 }, footprint->GetOrientation() );
|
||||
shape->Move( footprint->GetPosition() );
|
||||
|
||||
// Set the polygon outline thickness to 0, only the polygonal shape is filled
|
||||
// without extra thickness.
|
||||
|
|
|
@ -126,7 +126,6 @@ PAD& PAD::operator=( const PAD &aOther )
|
|||
ImportSettingsFrom( aOther );
|
||||
SetPadToDieLength( aOther.GetPadToDieLength() );
|
||||
SetPosition( aOther.GetPosition() );
|
||||
SetPos0( aOther.GetPos0() );
|
||||
SetNumber( aOther.GetNumber() );
|
||||
SetPinType( aOther.GetPinType() );
|
||||
SetPinFunction( aOther.GetPinFunction() );
|
||||
|
@ -641,37 +640,6 @@ const BOX2I PAD::GetBoundingBox() const
|
|||
}
|
||||
|
||||
|
||||
void PAD::SetDrawCoord()
|
||||
{
|
||||
FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
|
||||
|
||||
m_pos = m_pos0;
|
||||
|
||||
if( parentFootprint == nullptr )
|
||||
return;
|
||||
|
||||
RotatePoint( &m_pos.x, &m_pos.y, parentFootprint->GetOrientation() );
|
||||
m_pos += parentFootprint->GetPosition();
|
||||
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
|
||||
void PAD::SetLocalCoord()
|
||||
{
|
||||
FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
|
||||
|
||||
if( parentFootprint == nullptr )
|
||||
{
|
||||
m_pos0 = m_pos;
|
||||
return;
|
||||
}
|
||||
|
||||
m_pos0 = m_pos - parentFootprint->GetPosition();
|
||||
RotatePoint( &m_pos0.x, &m_pos0.y, -parentFootprint->GetOrientation() );
|
||||
}
|
||||
|
||||
|
||||
void PAD::SetAttribute( PAD_ATTRIB aAttribute )
|
||||
{
|
||||
m_attribute = aAttribute;
|
||||
|
@ -705,14 +673,12 @@ void PAD::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
|||
if( aFlipLeftRight )
|
||||
{
|
||||
MIRROR( m_pos.x, aCentre.x );
|
||||
MIRROR( m_pos0.x, 0 );
|
||||
MIRROR( m_offset.x, 0 );
|
||||
MIRROR( m_deltaSize.x, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
MIRROR( m_pos.y, aCentre.y );
|
||||
MIRROR( m_pos0.y, 0 );
|
||||
MIRROR( m_offset.y, 0 );
|
||||
MIRROR( m_deltaSize.y, 0 );
|
||||
}
|
||||
|
@ -1204,8 +1170,6 @@ void PAD::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
|
|||
m_orient += aAngle;
|
||||
m_orient.Normalize();
|
||||
|
||||
SetLocalCoord();
|
||||
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
|
|
17
pcbnew/pad.h
17
pcbnew/pad.h
|
@ -247,12 +247,6 @@ public:
|
|||
void SetY( int y ) { m_pos.y = y; SetDirty(); }
|
||||
void SetX( int x ) { m_pos.x = x; SetDirty(); }
|
||||
|
||||
void SetPos0( const VECTOR2I& aPos ) { m_pos0 = aPos; }
|
||||
const VECTOR2I& GetPos0() const { return m_pos0; }
|
||||
|
||||
void SetY0( int y ) { m_pos0.y = y; }
|
||||
void SetX0( int x ) { m_pos0.x = x; }
|
||||
|
||||
void SetSize( const VECTOR2I& aSize ) { m_size = aSize; SetDirty(); }
|
||||
const VECTOR2I& GetSize() const { return m_size; }
|
||||
void SetSizeX( const int aX ) { m_size.x = aX; SetDirty(); }
|
||||
|
@ -676,13 +670,6 @@ public:
|
|||
*/
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
/// Set absolute coordinates.
|
||||
void SetDrawCoord();
|
||||
|
||||
//todo: Remove SetLocalCoord along with m_pos
|
||||
/// Set relative coordinates.
|
||||
void SetLocalCoord();
|
||||
|
||||
/**
|
||||
* Compare two pads and return 0 if they are equal.
|
||||
*
|
||||
|
@ -694,7 +681,6 @@ public:
|
|||
void Move( const VECTOR2I& aMoveVector ) override
|
||||
{
|
||||
m_pos += aMoveVector;
|
||||
SetLocalCoord();
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
|
@ -834,9 +820,6 @@ private:
|
|||
// one end and half expands the other. It is only valid
|
||||
// to have a single axis be non-0.
|
||||
|
||||
VECTOR2I m_pos0; // Initial Pad position (i.e. pad position relative to the
|
||||
// footprint anchor, orientation 0)
|
||||
|
||||
PAD_ATTRIB m_attribute; // PAD_ATTRIB_NORMAL, PAD_ATTRIB::SMD, PAD_ATTRIB::CONN,
|
||||
// PAD_ATTRIB::NPTH
|
||||
PAD_PROP m_property; // Property in fab files (BGA, FIDUCIAL, TESTPOINT, etc.)
|
||||
|
|
|
@ -2373,8 +2373,6 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
|
|||
|
||||
pad->SetPosition( aElem.position );
|
||||
pad->SetOrientationDegrees( aElem.direction );
|
||||
pad->SetLocalCoord();
|
||||
|
||||
pad->SetSize( aElem.topsize );
|
||||
|
||||
if( aElem.holesize == 0 )
|
||||
|
|
|
@ -898,7 +898,6 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponen
|
|||
pad->SetAnchorPadShape( PAD_SHAPE::CIRCLE );
|
||||
pad->SetSize( { anchorSize, anchorSize } );
|
||||
pad->SetPosition( anchorPos );
|
||||
pad->SetLocalCoord();
|
||||
|
||||
SHAPE_POLY_SET shapePolys = getPolySetFromCadstarShape( compCopper.Shape,
|
||||
lineThickness,
|
||||
|
@ -1243,7 +1242,6 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
|
|||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||
|
||||
pad->SetPosition( { 0, 0 } );
|
||||
pad->SetPos0( { 0, 0 } );
|
||||
pad->TransformShapeToPolygon( padOutline, layer, 0, maxError, ERROR_INSIDE );
|
||||
|
||||
PCB_SHAPE* padShape = new PCB_SHAPE;
|
||||
|
@ -1296,8 +1294,6 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
|
|||
|
||||
RotatePoint( padOffset, padOrientation );
|
||||
RotatePoint( drillOffset, padOrientation );
|
||||
pad->SetPos0( getKiCadPoint( aCadstarPad.Position ) - aParent->GetPosition() - padOffset
|
||||
- drillOffset );
|
||||
pad->SetPosition( getKiCadPoint( aCadstarPad.Position ) - padOffset - drillOffset );
|
||||
pad->SetOrientation( padOrientation + getAngle( csPadcode.SlotOrientation ) );
|
||||
|
||||
|
|
|
@ -2355,13 +2355,11 @@ void EAGLE_PLUGIN::packageHole( FOOTPRINT* aFootprint, wxXmlNode* aTree, bool aC
|
|||
|
||||
if( aCenter )
|
||||
{
|
||||
pad->SetPos0( VECTOR2I( 0, 0 ) );
|
||||
aFootprint->SetPosition( padpos );
|
||||
pad->SetPosition( padpos );
|
||||
}
|
||||
else
|
||||
{
|
||||
pad->SetPos0( padpos );
|
||||
pad->SetPosition( padpos + aFootprint->GetPosition() );
|
||||
}
|
||||
|
||||
|
@ -2453,10 +2451,7 @@ void EAGLE_PLUGIN::transferPad( const EPAD_COMMON& aEaglePad, PAD* aPad ) const
|
|||
{
|
||||
aPad->SetNumber( aEaglePad.name );
|
||||
|
||||
// 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( kicad_x( aEaglePad.x ), kicad_y( aEaglePad.y ) );
|
||||
aPad->SetPos0( padPos );
|
||||
|
||||
// Solder mask
|
||||
const VECTOR2I& padSize( aPad->GetSize() );
|
||||
|
|
|
@ -2409,8 +2409,6 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
}
|
||||
}
|
||||
|
||||
newpad->SetLocalCoord();
|
||||
|
||||
if( src->mirror )
|
||||
newpad->SetOrientation( EDA_ANGLE( -src->rotate + pin->rotation, DEGREES_T ) );
|
||||
else
|
||||
|
|
|
@ -596,8 +596,6 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
|||
|
||||
pad->SetSize( VECTOR2I( KiROUND( EuclideanNorm( delta ) ) + width, width ) );
|
||||
|
||||
// Set the relative position before adjusting the absolute position
|
||||
pad->SetPos0( padPos );
|
||||
padPos += footprint->GetPosition();
|
||||
pad->SetPosition( padPos );
|
||||
|
||||
|
@ -688,8 +686,6 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
|||
|
||||
pad->SetDrillSize( VECTOR2I( drillSize, drillSize ) );
|
||||
|
||||
// Set the relative position before adjusting the absolute position
|
||||
pad->SetPos0( padPos );
|
||||
padPos += footprint->GetPosition();
|
||||
pad->SetPosition( padPos );
|
||||
|
||||
|
|
|
@ -3931,14 +3931,8 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
|
|||
|
||||
case T_pad:
|
||||
{
|
||||
if( PAD* pad = parsePAD( footprint.get() ) )
|
||||
{
|
||||
pt = pad->GetPos0();
|
||||
RotatePoint( pt, footprint->GetOrientation() );
|
||||
pad->SetPosition( pt + footprint->GetPosition() );
|
||||
footprint->Add( pad, ADD_MODE::APPEND, true );
|
||||
}
|
||||
|
||||
PAD* pad = parsePAD( footprint.get() );
|
||||
footprint->Add( pad, ADD_MODE::APPEND, true );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4121,7 +4115,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
|
|||
case T_at:
|
||||
pt.x = parseBoardUnits( "X coordinate" );
|
||||
pt.y = parseBoardUnits( "Y coordinate" );
|
||||
pad->SetPos0( pt );
|
||||
pad->SetFPRelativePosition( pt );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_NUMBER )
|
||||
|
|
|
@ -1396,7 +1396,7 @@ void PCB_PLUGIN::format( const PAD* aPad, int aNestLevel ) const
|
|||
if( aPad->IsLocked() )
|
||||
m_out->Print( 0, " locked" );
|
||||
|
||||
m_out->Print( 0, " (at %s", formatInternalUnits( aPad->GetPos0() ).c_str() );
|
||||
m_out->Print( 0, " (at %s", formatInternalUnits( aPad->GetFPRelativePosition() ).c_str() );
|
||||
|
||||
if( !aPad->GetOrientation().IsZero() )
|
||||
m_out->Print( 0, " %s", EDA_UNIT_UTILS::FormatAngle( aPad->GetOrientation() ).c_str() );
|
||||
|
|
|
@ -1459,8 +1459,7 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint )
|
|||
pos.x = biuParse( line + SZ( "Po" ), &data );
|
||||
pos.y = biuParse( data );
|
||||
|
||||
pad->SetPos0( pos );
|
||||
// pad->SetPosition( pos ); set at function return
|
||||
pad->SetFPRelativePosition( pos );
|
||||
}
|
||||
else if( TESTLINE( "Le" ) )
|
||||
{
|
||||
|
@ -1504,15 +1503,6 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint )
|
|||
}
|
||||
else if( TESTLINE( "$EndPAD" ) )
|
||||
{
|
||||
// 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 = pad->GetPos0();
|
||||
|
||||
RotatePoint( padpos, aFootprint->GetOrientation() );
|
||||
|
||||
pad->SetPosition( padpos + aFootprint->GetPosition() );
|
||||
|
||||
if( pad->GetSizeX() > 0 && pad->GetSizeY() > 0 )
|
||||
{
|
||||
aFootprint->Add( pad.release() );
|
||||
|
|
|
@ -312,10 +312,7 @@ void PCAD_PAD::AddToFootprint( FOOTPRINT* aFootprint, const EDA_ANGLE& aRotation
|
|||
|
||||
if( !aEncapsulatedPad )
|
||||
{
|
||||
// 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 );
|
||||
pad->SetPos0( padpos );
|
||||
RotatePoint( padpos, aFootprint->GetOrientation() );
|
||||
pad->SetPosition( padpos + aFootprint->GetPosition() );
|
||||
}
|
||||
|
|
|
@ -627,7 +627,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
|
|||
if( isRoundKeepout( pad ) )
|
||||
{
|
||||
double diameter = scale( pad->GetDrillSize().x );
|
||||
POINT vertex = mapPt( pad->GetPos0() );
|
||||
POINT vertex = mapPt( pad->GetFPRelativePosition() );
|
||||
|
||||
diameter += scale( aBoard->GetDesignSettings().m_HoleClearance * 2 );
|
||||
|
||||
|
@ -699,7 +699,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
|
|||
EDA_ANGLE angle = pad->GetOrientation() - aFootprint->GetOrientation();
|
||||
pin->SetRotation( angle.Normalize().AsDegrees() );
|
||||
|
||||
VECTOR2I pos( pad->GetPos0() );
|
||||
VECTOR2I pos( pad->GetFPRelativePosition() );
|
||||
|
||||
pin->SetVertex( mapPt( pos ) );
|
||||
}
|
||||
|
|
|
@ -1537,8 +1537,6 @@ static void mirrorPadX( PAD& aPad, const VECTOR2I& aMirrorPoint )
|
|||
VECTOR2I tmpPt = mirrorPointX( aPad.GetPosition(), aMirrorPoint );
|
||||
aPad.SetPosition( tmpPt );
|
||||
|
||||
aPad.SetX0( aPad.GetPosition().x );
|
||||
|
||||
tmpPt = aPad.GetOffset();
|
||||
tmpPt.x = -tmpPt.x;
|
||||
aPad.SetOffset( tmpPt );
|
||||
|
@ -1562,8 +1560,6 @@ static void mirrorPadY( PAD& aPad, const VECTOR2I& aMirrorPoint )
|
|||
VECTOR2I tmpPt = mirrorPointY( aPad.GetPosition(), aMirrorPoint );
|
||||
aPad.SetPosition( tmpPt );
|
||||
|
||||
aPad.SetY0( aPad.GetPosition().y );
|
||||
|
||||
tmpPt = aPad.GetOffset();
|
||||
tmpPt.y = -tmpPt.y;
|
||||
aPad.SetOffset( tmpPt );
|
||||
|
|
|
@ -140,13 +140,6 @@ int EDIT_TOOL::Swap( const TOOL_EVENT& aEvent )
|
|||
a->SetPosition( aPos );
|
||||
b->SetPosition( bPos );
|
||||
|
||||
// Pads need special handling to keep their offset from their parent
|
||||
if( a->Type() == PCB_PAD_T )
|
||||
static_cast<PAD*>( a )->SetLocalCoord();
|
||||
|
||||
if( b->Type() == PCB_PAD_T )
|
||||
static_cast<PAD*>( b )->SetLocalCoord();
|
||||
|
||||
// Handle footprints specially. They can be flipped to the back of the board which
|
||||
// requires a special transformation.
|
||||
if( a->Type() == PCB_FOOTPRINT_T && b->Type() == PCB_FOOTPRINT_T )
|
||||
|
|
|
@ -555,7 +555,6 @@ int PAD_TOOL::PlacePad( const TOOL_EVENT& aEvent )
|
|||
if( pad )
|
||||
{
|
||||
m_frame->GetDesignSettings().m_Pad_Master->ImportSettingsFrom( *pad );
|
||||
pad->SetLocalCoord();
|
||||
aCommit.Add( aItem );
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1375,7 +1375,6 @@ void PCB_POINT_EDITOR::updateItem() const
|
|||
|
||||
pad->SetSize( padSize );
|
||||
pad->SetPosition( VECTOR2I( ( left + right ) / 2, ( top + bottom ) / 2 ) );
|
||||
pad->SetLocalCoord();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -192,15 +192,6 @@ void PCB_PROPERTIES_PANEL::valueChanging( wxPropertyGridEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void setLocalCoord( BOARD_ITEM* aItem )
|
||||
{
|
||||
// TODO: we really need to get rid of this local/draw coords stuff, but for now, it is what it is.
|
||||
|
||||
if( PAD* pad = dynamic_cast<PAD*>( aItem ) )
|
||||
pad->SetLocalCoord();
|
||||
}
|
||||
|
||||
|
||||
void PCB_PROPERTIES_PANEL::valueChanged( wxPropertyGridEvent& aEvent )
|
||||
{
|
||||
PCB_SELECTION_TOOL* selectionTool = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
|
||||
|
@ -217,7 +208,6 @@ void PCB_PROPERTIES_PANEL::valueChanged( wxPropertyGridEvent& aEvent )
|
|||
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( edaItem );
|
||||
changes.Modify( item );
|
||||
item->Set( property, newValue );
|
||||
setLocalCoord( item );
|
||||
}
|
||||
|
||||
changes.Push( _( "Change property" ) );
|
||||
|
|
Loading…
Reference in New Issue