Move footprints to EDA_ANGLE.
This commit is contained in:
parent
70ad554343
commit
abd3f5bc2b
|
@ -1223,8 +1223,8 @@ void RENDER_3D_OPENGL::renderFootprint( const FOOTPRINT* aFootprint, bool aRende
|
|||
glTranslatef( pos.x * m_boardAdapter.BiuTo3dUnits(), -pos.y * m_boardAdapter.BiuTo3dUnits(),
|
||||
zpos );
|
||||
|
||||
if( aFootprint->GetOrientation() )
|
||||
glRotated( (double) aFootprint->GetOrientation() / 10.0, 0.0, 0.0, 1.0 );
|
||||
if( !aFootprint->GetOrientation().IsZero() )
|
||||
glRotated( aFootprint->GetOrientation().AsDegrees(), 0.0, 0.0, 1.0 );
|
||||
|
||||
if( aFootprint->IsFlipped() )
|
||||
{
|
||||
|
|
|
@ -1219,10 +1219,9 @@ void RENDER_3D_RAYTRACE::load3DModels( CONTAINER_3D& aDstContainer, bool aSkipMa
|
|||
-pos.y * m_boardAdapter.BiuTo3dUnits(),
|
||||
zpos ) );
|
||||
|
||||
if( fp->GetOrientation() )
|
||||
if( !fp->GetOrientation().IsZero() )
|
||||
{
|
||||
fpMatrix = glm::rotate( fpMatrix,
|
||||
( (float) ( fp->GetOrientation() / 10.0f ) / 180.0f ) * glm::pi<float>(),
|
||||
fpMatrix = glm::rotate( fpMatrix, (float) fp->GetOrientation().AsRadians(),
|
||||
SFVEC3F( 0.0f, 0.0f, 1.0f ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags )
|
|||
hash_combine( ret, footprint->GetPosition().x, footprint->GetPosition().y );
|
||||
|
||||
if( aFlags & HASH_ROT )
|
||||
hash_combine( ret, footprint->GetOrientation() );
|
||||
hash_combine( ret, footprint->GetOrientation().AsTenthsOfADegree() );
|
||||
|
||||
for( BOARD_ITEM* item : footprint->GraphicalItems() )
|
||||
hash_combine( ret, hash_fp_item( item, aFlags ) );
|
||||
|
|
|
@ -137,7 +137,6 @@ private:
|
|||
FT_Face m_subscriptFace;
|
||||
|
||||
int m_faceScaler;
|
||||
int m_subscriptFaceScaler;
|
||||
|
||||
// cache for glyphs converted to straight segments
|
||||
// key is glyph index (FT_GlyphSlot field glyph_index)
|
||||
|
|
|
@ -101,6 +101,11 @@ inline void RotatePoint( VECTOR2I& point, const VECTOR2I& centre, EDA_ANGLE angl
|
|||
|
||||
void RotatePoint( double* pX, double* pY, double angle );
|
||||
|
||||
inline void RotatePoint( double* pX, double* pY, EDA_ANGLE angle )
|
||||
{
|
||||
RotatePoint( pX, pY, angle.AsTenthsOfADegree() );
|
||||
}
|
||||
|
||||
inline void RotatePoint( VECTOR2D& point, EDA_ANGLE angle )
|
||||
{
|
||||
RotatePoint( &point.x, &point.y, angle.AsTenthsOfADegree() );
|
||||
|
@ -108,6 +113,11 @@ inline void RotatePoint( VECTOR2D& point, EDA_ANGLE angle )
|
|||
|
||||
void RotatePoint( double* pX, double* pY, double cx, double cy, double angle );
|
||||
|
||||
inline void RotatePoint( double* pX, double* pY, double cx, double cy, EDA_ANGLE angle )
|
||||
{
|
||||
RotatePoint( pX, pY, cx, cy, angle.AsTenthsOfADegree() );
|
||||
}
|
||||
|
||||
inline void RotatePoint( VECTOR2D& point, const VECTOR2D& aCenter, EDA_ANGLE angle )
|
||||
{
|
||||
RotatePoint( &point.x, &point.y, aCenter.x, aCenter.y, angle.AsTenthsOfADegree() );
|
||||
|
|
|
@ -251,11 +251,13 @@ bool AR_AUTOPLACER::fillMatrix()
|
|||
}
|
||||
|
||||
|
||||
void AR_AUTOPLACER::rotateFootprint( FOOTPRINT* aFootprint, double angle, bool incremental )
|
||||
void AR_AUTOPLACER::rotateFootprint( FOOTPRINT* aFootprint, double aAngle, bool incremental )
|
||||
{
|
||||
if( aFootprint == nullptr )
|
||||
return;
|
||||
|
||||
EDA_ANGLE angle( aAngle, TENTHS_OF_A_DEGREE_T );
|
||||
|
||||
if( incremental )
|
||||
aFootprint->SetOrientation( aFootprint->GetOrientation() + angle );
|
||||
else
|
||||
|
|
|
@ -247,7 +247,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
case SHAPE_T::POLY:
|
||||
{
|
||||
const SHAPE_POLY_SET poly = graphic->GetPolyShape();
|
||||
double orientation = 0.0;
|
||||
EDA_ANGLE orientation = ANGLE_0;
|
||||
VECTOR2I offset = VECTOR2I( 0, 0 );
|
||||
|
||||
if( graphic->GetParentFootprint() )
|
||||
|
@ -323,7 +323,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
}
|
||||
else if( graphic->GetShape() == SHAPE_T::POLY )
|
||||
{
|
||||
double orientation = 0.0;
|
||||
EDA_ANGLE orientation = ANGLE_0;
|
||||
VECTOR2I offset = VECTOR2I( 0, 0 );
|
||||
|
||||
if( graphic->GetParentFootprint() )
|
||||
|
@ -561,7 +561,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
// connect to other elements, so we process them independently
|
||||
if( graphic->GetShape() == SHAPE_T::POLY )
|
||||
{
|
||||
double orientation = 0.0;
|
||||
EDA_ANGLE orientation = ANGLE_0;
|
||||
VECTOR2I offset = VECTOR2I( 0, 0 );
|
||||
|
||||
if( graphic->GetParentFootprint() )
|
||||
|
@ -602,7 +602,7 @@ bool ConvertOutlineToPolygon( std::vector<PCB_SHAPE*>& aSegList, SHAPE_POLY_SET&
|
|||
{
|
||||
double rotation = ( angle * step ) / steps;
|
||||
nextPt = start;
|
||||
RotatePoint( &nextPt.x, &nextPt.y, center.x, center.y, rotation );
|
||||
RotatePoint( nextPt, center, rotation );
|
||||
aPolygons.Append( nextPt, -1, hole );
|
||||
|
||||
if( firstPt )
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com
|
||||
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2022 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
|
||||
|
@ -246,7 +246,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
|
|||
|
||||
m_BoardSideCtrl->SetSelection( (m_footprint->GetLayer() == B_Cu) ? 1 : 0 );
|
||||
|
||||
m_orientation.SetDoubleValue( m_footprint->GetOrientation() );
|
||||
m_orientation.SetDoubleValue( m_footprint->GetOrientation().AsTenthsOfADegree() );
|
||||
|
||||
m_cbLocked->SetValue( m_footprint->IsLocked() );
|
||||
m_cbLocked->SetToolTip( _( "Locked footprints cannot be freely moved and oriented on the "
|
||||
|
@ -441,10 +441,13 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
m_footprint->SetAttributes( attributes );
|
||||
|
||||
double orient = m_orientation.GetDoubleValue();
|
||||
EDA_ANGLE orient( m_orientation.GetDoubleValue(), TENTHS_OF_A_DEGREE_T );
|
||||
|
||||
if( m_footprint->GetOrientation() != orient )
|
||||
m_footprint->Rotate( m_footprint->GetPosition(), orient - m_footprint->GetOrientation() );
|
||||
{
|
||||
m_footprint->Rotate( m_footprint->GetPosition(),
|
||||
( orient - m_footprint->GetOrientation() ).AsTenthsOfADegree() );
|
||||
}
|
||||
|
||||
// Set component side, that also have effect on the fields positions on board
|
||||
bool change_layer = false;
|
||||
|
|
|
@ -486,8 +486,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
|||
|
||||
if( footprint )
|
||||
{
|
||||
EDA_ANGLE angle = m_dummyPad->GetOrientation();
|
||||
angle -= EDA_ANGLE( footprint->GetOrientation(), TENTHS_OF_A_DEGREE_T );
|
||||
EDA_ANGLE angle = m_dummyPad->GetOrientation() - footprint->GetOrientation();
|
||||
m_dummyPad->SetOrientation( angle );
|
||||
|
||||
// Display parent footprint info
|
||||
|
@ -495,7 +494,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
|||
footprint->Reference().GetShownText(),
|
||||
footprint->Value().GetShownText(),
|
||||
footprint->IsFlipped() ? _( "back side (mirrored)" ) : _( "front side" ),
|
||||
footprint->GetOrientationDegrees() );
|
||||
footprint->GetOrientation().AsDegrees() );
|
||||
}
|
||||
|
||||
m_parentInfo->SetLabel( msg );
|
||||
|
@ -1655,8 +1654,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
|
|||
VECTOR2I pt = m_currentPad->GetPosition() - footprint->GetPosition();
|
||||
RotatePoint( pt, -footprint->GetOrientation() );
|
||||
m_currentPad->SetPos0( pt );
|
||||
m_currentPad->SetOrientation( m_currentPad->GetOrientation()
|
||||
+ EDA_ANGLE( footprint->GetOrientation(), TENTHS_OF_A_DEGREE_T ) );
|
||||
m_currentPad->SetOrientation( m_currentPad->GetOrientation() + footprint->GetOrientation() );
|
||||
}
|
||||
|
||||
m_parent->SetMsgPanel( m_currentPad );
|
||||
|
|
|
@ -246,7 +246,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
|
|||
footprint->GetReference(),
|
||||
footprint->GetValue(),
|
||||
footprint->IsFlipped() ? _( "back side (mirrored)" ) : _( "front side" ),
|
||||
footprint->GetOrientation() / 10.0 );
|
||||
footprint->GetOrientation().AsDegrees() );
|
||||
}
|
||||
|
||||
m_statusLine->SetLabel( msg );
|
||||
|
|
|
@ -147,8 +147,8 @@ bool padsNeedUpdate( const PAD* a, const PAD* b )
|
|||
TEST( a->GetProperty(), b->GetProperty() );
|
||||
|
||||
// The pad orientation, for historical reasons is the pad rotation + parent rotation.
|
||||
TEST( ( a->GetOrientation() - EDA_ANGLE( a->GetParent()->GetOrientation(), TENTHS_OF_A_DEGREE_T ) ).Normalize().AsTenthsOfADegree(),
|
||||
( b->GetOrientation() - EDA_ANGLE( b->GetParent()->GetOrientation(), TENTHS_OF_A_DEGREE_T ) ).Normalize().AsTenthsOfADegree() );
|
||||
TEST( ( a->GetOrientation() - a->GetParent()->GetOrientation() ).Normalize().AsTenthsOfADegree(),
|
||||
( b->GetOrientation() - b->GetParent()->GetOrientation() ).Normalize().AsTenthsOfADegree() );
|
||||
|
||||
TEST( a->GetSize(), b->GetSize() );
|
||||
TEST( a->GetDelta(), b->GetDelta() );
|
||||
|
|
|
@ -191,11 +191,13 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
tmp << "\"" << csv_sep;
|
||||
|
||||
tmp << wxString::Format( "%f%c%f%c%f",
|
||||
footprint_pos.x * conv_unit, csv_sep,
|
||||
footprint_pos.x * conv_unit,
|
||||
csv_sep,
|
||||
// Keep the Y axis oriented from bottom to top,
|
||||
// ( change y coordinate sign )
|
||||
-footprint_pos.y * conv_unit, csv_sep,
|
||||
list[ii].m_Footprint->GetOrientation() / 10.0 );
|
||||
-footprint_pos.y * conv_unit,
|
||||
csv_sep,
|
||||
list[ii].m_Footprint->GetOrientation().AsDegrees() );
|
||||
tmp << csv_sep;
|
||||
|
||||
tmp << ( (layer == F_Cu ) ? PLACE_FILE_EXPORTER::GetFrontSideName()
|
||||
|
@ -263,7 +265,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
// Keep the coordinates in the first quadrant,
|
||||
// (i.e. change y sign
|
||||
-footprint_pos.y * conv_unit,
|
||||
list[ii].m_Footprint->GetOrientation() / 10.0,
|
||||
list[ii].m_Footprint->GetOrientation().AsDegrees(),
|
||||
(layer == F_Cu ) ? GetFrontSideName().c_str() : GetBackSideName().c_str() );
|
||||
buffer += line;
|
||||
}
|
||||
|
@ -357,7 +359,7 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
|
|||
sprintf( line, "position %9.6f %9.6f orientation %.2f\n",
|
||||
footprint_pos.x * conv_unit,
|
||||
footprint_pos.y * conv_unit,
|
||||
footprint->GetOrientation() / 10.0 );
|
||||
footprint->GetOrientation().AsDegrees() );
|
||||
buffer += line;
|
||||
|
||||
if( footprint->GetLayer() == F_Cu )
|
||||
|
@ -402,7 +404,7 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
|
|||
pad->GetPos0().y * conv_unit,
|
||||
pad->GetSize().x * conv_unit,
|
||||
pad->GetSize().y * conv_unit,
|
||||
pad->GetOrientation().AsDegrees() - ( footprint->GetOrientation() / 10.0 ) );
|
||||
( pad->GetOrientation() - footprint->GetOrientation() ).AsDegrees() );
|
||||
buffer += line;
|
||||
|
||||
sprintf( line, "drill %9.6f\n", pad->GetDrillSize().x * conv_unit );
|
||||
|
|
|
@ -828,8 +828,8 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
|
|||
pins.insert( pinname );
|
||||
}
|
||||
|
||||
double orient = pad->GetOrientation().AsTenthsOfADegree() - footprint->GetOrientation();
|
||||
NORMALIZE_ANGLE_POS( orient );
|
||||
EDA_ANGLE orient = pad->GetOrientation() - footprint->GetOrientation();
|
||||
orient.Normalize();
|
||||
|
||||
// Bottom side footprints use the flipped padstack
|
||||
fprintf( aFile, ( flipBottomPads && footprint->GetFlag() ) ?
|
||||
|
@ -838,7 +838,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
|
|||
TO_UTF8( escapeString( pinname ) ), pad->GetSubRatsnest(),
|
||||
pad->GetPos0().x / SCALE_FACTOR,
|
||||
-pad->GetPos0().y / SCALE_FACTOR,
|
||||
layer, orient / 10.0, mirror );
|
||||
layer, orient.AsDegrees(), mirror );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -861,7 +861,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
|
|||
{
|
||||
const char* mirror;
|
||||
const char* flip;
|
||||
double fp_orient = footprint->GetOrientation();
|
||||
double fp_orient = footprint->GetOrientation().AsTenthsOfADegree();
|
||||
|
||||
if( footprint->GetFlag() )
|
||||
{
|
||||
|
|
|
@ -441,7 +441,7 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD
|
|||
if( !outline )
|
||||
throw( std::runtime_error( aIDFBoard.GetError() ) );
|
||||
|
||||
double rotz = aFootprint->GetOrientation() / 10.0;
|
||||
double rotz = aFootprint->GetOrientation().AsDegrees();
|
||||
double locx = sM->m_Offset.x * 25.4; // part offsets are in inches
|
||||
double locy = sM->m_Offset.y * 25.4;
|
||||
double locz = sM->m_Offset.z * 25.4;
|
||||
|
|
|
@ -836,7 +836,7 @@ void EXPORTER_PCB_VRML::ExportVrmlFootprint( FOOTPRINT* aFootprint, std::ostream
|
|||
|
||||
// Note here aFootprint->GetOrientation() is in 0.1 degrees, so footprint rotation
|
||||
// has to be converted to radians
|
||||
build_quat( 0, 0, 1, DECIDEG2RAD( aFootprint->GetOrientation() ), q2 );
|
||||
build_quat( 0, 0, 1, aFootprint->GetOrientation().AsRadians(), q2 );
|
||||
compose_quat( q1, q2, q1 );
|
||||
from_quat( q1, rot );
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
|
|||
poly.Append( bbox.GetRight(), y_sign*bbox.GetTop() );
|
||||
poly.SetClosed( true );
|
||||
|
||||
poly.Rotate( -footprint->GetOrientationRadians(), VECTOR2I( 0, 0 ) );
|
||||
poly.Rotate( -footprint->GetOrientation().AsRadians(), VECTOR2I( 0, 0 ) );
|
||||
poly.Move( footprint->GetPosition() );
|
||||
plotter.PLOTTER::PlotPoly( poly, FILL_T::NO_FILL, line_thickness, &gbr_metadata );
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ FOOTPRINT::FOOTPRINT( BOARD* parent ) :
|
|||
{
|
||||
m_attributes = 0;
|
||||
m_layer = F_Cu;
|
||||
m_orient = 0;
|
||||
m_orient = ANGLE_0;
|
||||
m_fpStatus = FP_PADS_are_LOCKED;
|
||||
m_arflag = 0;
|
||||
m_link = 0;
|
||||
|
@ -714,13 +714,11 @@ EDA_RECT FOOTPRINT::GetFpPadsLocalBbox() const
|
|||
FOOTPRINT dummy( *this );
|
||||
|
||||
dummy.SetPosition( VECTOR2I( 0, 0 ) );
|
||||
dummy.SetOrientation( ANGLE_0 );
|
||||
|
||||
if( dummy.IsFlipped() )
|
||||
dummy.Flip( VECTOR2I( 0, 0 ), false );
|
||||
|
||||
if( dummy.GetOrientation() )
|
||||
dummy.SetOrientation( 0 );
|
||||
|
||||
for( PAD* pad : dummy.Pads() )
|
||||
area.Merge( pad->GetBoundingBox() );
|
||||
|
||||
|
@ -988,7 +986,7 @@ void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
|
||||
aList.emplace_back( _( "Status: " ) + status, _( "Attributes:" ) + wxS( " " ) + attrs );
|
||||
|
||||
aList.emplace_back( _( "Rotation" ), wxString::Format( "%.4g", GetOrientationDegrees() ) );
|
||||
aList.emplace_back( _( "Rotation" ), wxString::Format( "%.4g", GetOrientation().AsDegrees() ) );
|
||||
|
||||
msg.Printf( _( "Footprint: %s" ), m_fpid.GetUniStringLibId() );
|
||||
msg2.Printf( _( "3D-Shape: %s" ), m_3D_Drawings.empty() ? _( "<none>" )
|
||||
|
@ -1486,12 +1484,12 @@ void FOOTPRINT::Move( const VECTOR2I& aMoveVector )
|
|||
|
||||
void FOOTPRINT::Rotate( const VECTOR2I& aRotCentre, double aAngle )
|
||||
{
|
||||
double orientation = GetOrientation();
|
||||
double orientation = GetOrientation().AsTenthsOfADegree();
|
||||
double newOrientation = orientation + aAngle;
|
||||
VECTOR2I newpos = m_pos;
|
||||
RotatePoint( newpos, aRotCentre, aAngle );
|
||||
SetPosition( newpos );
|
||||
SetOrientation( newOrientation );
|
||||
SetOrientation( EDA_ANGLE( newOrientation, TENTHS_OF_A_DEGREE_T ) );
|
||||
|
||||
m_reference->KeepUpright( orientation, newOrientation );
|
||||
m_value->KeepUpright( orientation, newOrientation );
|
||||
|
@ -1532,8 +1530,7 @@ void FOOTPRINT::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
|||
|
||||
// Reverse mirror orientation.
|
||||
m_orient = -m_orient;
|
||||
|
||||
NORMALIZE_ANGLE_180( m_orient );
|
||||
m_orient.Normalize180();
|
||||
|
||||
// Mirror pads to other side of board.
|
||||
for( PAD* pad : m_pads )
|
||||
|
@ -1707,24 +1704,21 @@ void FOOTPRINT::MoveAnchorPosition( const VECTOR2I& aMoveVector )
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT::SetOrientation( double aNewAngle )
|
||||
void FOOTPRINT::SetOrientation( const EDA_ANGLE& aNewAngle )
|
||||
{
|
||||
double angleChange = aNewAngle - m_orient; // change in rotation
|
||||
|
||||
NORMALIZE_ANGLE_180( aNewAngle );
|
||||
EDA_ANGLE angleChange = aNewAngle - m_orient; // change in rotation
|
||||
|
||||
m_orient = aNewAngle;
|
||||
m_orient.Normalize180();
|
||||
|
||||
for( PAD* pad : m_pads )
|
||||
{
|
||||
pad->SetOrientation( pad->GetOrientation() + EDA_ANGLE( angleChange, TENTHS_OF_A_DEGREE_T ) );
|
||||
pad->SetOrientation( pad->GetOrientation() + angleChange );
|
||||
pad->SetDrawCoord();
|
||||
}
|
||||
|
||||
for( ZONE* zone : m_fp_zones )
|
||||
{
|
||||
zone->Rotate( GetPosition(), angleChange );
|
||||
}
|
||||
zone->Rotate( GetPosition(), angleChange.AsTenthsOfADegree() );
|
||||
|
||||
// Update of the reference and value.
|
||||
m_reference->SetDrawCoord();
|
||||
|
@ -1734,20 +1728,16 @@ void FOOTPRINT::SetOrientation( double aNewAngle )
|
|||
for( BOARD_ITEM* item : m_drawings )
|
||||
{
|
||||
if( item->Type() == PCB_FP_SHAPE_T )
|
||||
{
|
||||
static_cast<FP_SHAPE*>( item )->SetDrawCoord();
|
||||
}
|
||||
else if( item->Type() == PCB_FP_TEXT_T )
|
||||
{
|
||||
static_cast<FP_TEXT*>( item )->SetDrawCoord();
|
||||
}
|
||||
}
|
||||
|
||||
m_boundingBoxCacheTimeStamp = 0;
|
||||
m_visibleBBoxCacheTimeStamp = 0;
|
||||
m_textExcludedBBoxCacheTimeStamp = 0;
|
||||
|
||||
m_cachedHull.Rotate( -DECIDEG2RAD( angleChange ), GetPosition() );
|
||||
m_cachedHull.Rotate( - angleChange.AsRadians(), GetPosition() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -191,11 +191,18 @@ public:
|
|||
void SetPosition( const VECTOR2I& aPos ) override;
|
||||
VECTOR2I GetPosition() const override { return m_pos; }
|
||||
|
||||
void SetOrientation( double aNewAngle );
|
||||
void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation * 10.0 ); }
|
||||
double GetOrientation() const { return m_orient; }
|
||||
double GetOrientationDegrees() const { return m_orient / 10.0; }
|
||||
double GetOrientationRadians() const { return m_orient * M_PI / 1800; }
|
||||
void SetOrientation( const EDA_ANGLE& aNewAngle );
|
||||
EDA_ANGLE GetOrientation() const { return m_orient; }
|
||||
|
||||
// For property system:
|
||||
void SetOrientationDegrees( double aOrientation )
|
||||
{
|
||||
SetOrientation( EDA_ANGLE( aOrientation, DEGREES_T ) );
|
||||
}
|
||||
double GetOrientationDegrees() const
|
||||
{
|
||||
return m_orient.AsDegrees();
|
||||
}
|
||||
|
||||
const LIB_ID& GetFPID() const { return m_fpid; }
|
||||
void SetFPID( const LIB_ID& aFPID ) { m_fpid = aFPID; }
|
||||
|
@ -736,12 +743,12 @@ private:
|
|||
FP_ZONES m_fp_zones; // FP_ZONE items, owned by pointer
|
||||
FP_GROUPS m_fp_groups; // PCB_GROUP items, owned by pointer
|
||||
|
||||
double m_orient; // Orientation in tenths of a degree, 900=90.0 degrees.
|
||||
EDA_ANGLE m_orient; // Orientation
|
||||
VECTOR2I m_pos; // Position of footprint on the board in internal units.
|
||||
FP_TEXT* m_reference; // Component reference designator value (U34, R18..)
|
||||
FP_TEXT* m_value; // Component value (74LS00, 22K..)
|
||||
LIB_ID m_fpid; // The #LIB_ID of the FOOTPRINT.
|
||||
int m_attributes; // Flag bits ( see FOOTPRINT_ATTR_T )
|
||||
int m_attributes; // Flag bits (see FOOTPRINT_ATTR_T)
|
||||
int m_fpStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)
|
||||
|
||||
// Bounding box caching strategy:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2022 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
|
||||
|
@ -69,12 +69,11 @@ void FP_SHAPE::SetLocalCoord()
|
|||
m_bezierC1_0 = m_bezierC1 - fp->GetPosition();
|
||||
m_bezierC2_0 = m_bezierC2 - fp->GetPosition();
|
||||
|
||||
double angle = fp->GetOrientation();
|
||||
RotatePoint( &m_start0.x, &m_start0.y, -angle );
|
||||
RotatePoint( &m_end0.x, &m_end0.y, -angle );
|
||||
RotatePoint( &m_arcCenter0.x, &m_arcCenter0.y, -angle );
|
||||
RotatePoint( &m_bezierC1_0.x, &m_bezierC1_0.y, -angle );
|
||||
RotatePoint( &m_bezierC2_0.x, &m_bezierC2_0.y, -angle );
|
||||
RotatePoint( &m_start0.x, &m_start0.y, - fp->GetOrientation() );
|
||||
RotatePoint( &m_end0.x, &m_end0.y, - fp->GetOrientation() );
|
||||
RotatePoint( &m_arcCenter0.x, &m_arcCenter0.y, - fp->GetOrientation() );
|
||||
RotatePoint( &m_bezierC1_0.x, &m_bezierC1_0.y, - fp->GetOrientation() );
|
||||
RotatePoint( &m_bezierC2_0.x, &m_bezierC2_0.y, - fp->GetOrientation() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -203,10 +203,8 @@ void FP_TEXT::SetDrawCoord()
|
|||
|
||||
if( parentFootprint )
|
||||
{
|
||||
double angle = parentFootprint->GetOrientation();
|
||||
|
||||
VECTOR2I pt = GetTextPos();
|
||||
RotatePoint( pt, angle );
|
||||
RotatePoint( pt, parentFootprint->GetOrientation() );
|
||||
SetTextPos( pt );
|
||||
|
||||
Offset( parentFootprint->GetPosition() );
|
||||
|
@ -221,10 +219,7 @@ void FP_TEXT::SetLocalCoord()
|
|||
if( parentFootprint )
|
||||
{
|
||||
m_Pos0 = GetTextPos() - parentFootprint->GetPosition();
|
||||
|
||||
double angle = parentFootprint->GetOrientation();
|
||||
|
||||
RotatePoint( &m_Pos0.x, &m_Pos0.y, -angle );
|
||||
RotatePoint( &m_Pos0.x, &m_Pos0.y, - parentFootprint->GetOrientation() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -247,7 +242,7 @@ const EDA_RECT FP_TEXT::GetBoundingBox() const
|
|||
EDA_ANGLE FP_TEXT::GetDrawRotation() const
|
||||
{
|
||||
FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
|
||||
double rotation = GetTextAngle().AsTenthsOfADegree();
|
||||
EDA_ANGLE rotation = GetTextAngle();
|
||||
|
||||
if( parentFootprint )
|
||||
rotation += parentFootprint->GetOrientation();
|
||||
|
@ -255,18 +250,18 @@ EDA_ANGLE FP_TEXT::GetDrawRotation() const
|
|||
if( m_keepUpright )
|
||||
{
|
||||
// Keep angle between 0 .. 90 deg. Otherwise the text is not easy to read
|
||||
while( rotation > 900 )
|
||||
rotation -= 1800;
|
||||
while( rotation > ANGLE_90 )
|
||||
rotation -= ANGLE_180;
|
||||
|
||||
while( rotation < 0 )
|
||||
rotation += 1800;
|
||||
while( rotation < ANGLE_0 )
|
||||
rotation += ANGLE_180;
|
||||
}
|
||||
else
|
||||
{
|
||||
NORMALIZE_ANGLE_POS( rotation );
|
||||
rotation.Normalize();
|
||||
}
|
||||
|
||||
return EDA_ANGLE( rotation, TENTHS_OF_A_DEGREE_T );
|
||||
return rotation;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ bool FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( FOOTPRINT* aFootprint )
|
|||
|
||||
// Put it in orientation 0,
|
||||
// because this is the default orientation in Footprint Editor, and in libs
|
||||
newFootprint->SetOrientation( 0 );
|
||||
newFootprint->SetOrientation( ANGLE_0 );
|
||||
|
||||
Zoom_Automatique( false );
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ PAD::PAD( FOOTPRINT* parent ) :
|
|||
{
|
||||
m_size.x = m_size.y = Mils2iu( 60 ); // Default pad size 60 mils.
|
||||
m_drill.x = m_drill.y = Mils2iu( 30 ); // Default drill size 30 mils.
|
||||
m_orient = ANGLE_0; // Pad rotation.
|
||||
m_orient = ANGLE_0;
|
||||
m_lengthPadToDie = 0;
|
||||
|
||||
if( m_parent && m_parent->Type() == PCB_FOOTPRINT_T )
|
||||
|
@ -567,9 +567,7 @@ void PAD::SetDrawCoord()
|
|||
if( parentFootprint == nullptr )
|
||||
return;
|
||||
|
||||
double angle = parentFootprint->GetOrientation();
|
||||
|
||||
RotatePoint( &m_pos.x, &m_pos.y, angle );
|
||||
RotatePoint( &m_pos.x, &m_pos.y, parentFootprint->GetOrientation() );
|
||||
m_pos += parentFootprint->GetPosition();
|
||||
|
||||
SetDirty();
|
||||
|
@ -1404,10 +1402,10 @@ void PAD::ImportSettingsFrom( const PAD& aMasterPad )
|
|||
EDA_ANGLE pad_rot = aMasterPad.GetOrientation();
|
||||
|
||||
if( aMasterPad.GetParent() )
|
||||
pad_rot -= EDA_ANGLE( aMasterPad.GetParent()->GetOrientation(), TENTHS_OF_A_DEGREE_T );
|
||||
pad_rot -= aMasterPad.GetParent()->GetOrientation();
|
||||
|
||||
if( GetParent() )
|
||||
pad_rot += EDA_ANGLE( GetParent()->GetOrientation(), TENTHS_OF_A_DEGREE_T );
|
||||
pad_rot += GetParent()->GetOrientation();
|
||||
|
||||
SetOrientation( pad_rot );
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ void PCB_BASE_FRAME::AddFootprintToBoard( FOOTPRINT* aFootprint )
|
|||
|
||||
// Place it in orientation 0 even if it is not saved with orientation 0 in lib (note that
|
||||
// it might be stored in another orientation if the lib is an archive built from a board)
|
||||
aFootprint->SetOrientation( 0 );
|
||||
aFootprint->SetOrientation( ANGLE_0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1449,7 +1449,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
{
|
||||
m_gal->Save();
|
||||
m_gal->Translate( parentFootprint->GetPosition() );
|
||||
m_gal->Rotate( -parentFootprint->GetOrientationRadians() );
|
||||
m_gal->Rotate( -parentFootprint->GetOrientation().AsRadians() );
|
||||
}
|
||||
|
||||
if( outline_mode )
|
||||
|
|
|
@ -132,7 +132,7 @@ FOOTPRINT* PCB_SHAPE::GetParentFootprint() const
|
|||
double PCB_SHAPE::getParentOrientation() const
|
||||
{
|
||||
if( GetParentFootprint() )
|
||||
return GetParentFootprint()->GetOrientation();
|
||||
return GetParentFootprint()->GetOrientation().AsTenthsOfADegree();
|
||||
else
|
||||
return 0.0;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019-2020 Thomas Pointhuber <thomas.pointhuber@gmx.at>
|
||||
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2021-2022 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
|
||||
|
@ -162,7 +162,7 @@ void ALTIUM_PCB::HelperShapeSetLocalCoord( PCB_SHAPE* aShape, uint16_t aComponen
|
|||
FOOTPRINT* fp = m_components.at( aComponent );
|
||||
|
||||
polyShape.Move( -fp->GetPosition() );
|
||||
polyShape.Rotate( -fp->GetOrientationRadians() );
|
||||
polyShape.Rotate( -fp->GetOrientation().AsRadians() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1012,7 +1012,7 @@ void ALTIUM_PCB::ParseComponentsBodies6Data( const CFB::CompoundFileReader& aRea
|
|||
modelSettings.m_Offset.y = -Iu2Millimeter((int) elem.modelPosition.y - fpPosition.y );
|
||||
modelSettings.m_Offset.z = Iu2Millimeter( (int) elem.modelPosition.z );
|
||||
|
||||
double orientation = footprint->GetOrientation();
|
||||
EDA_ANGLE orientation = footprint->GetOrientation();
|
||||
|
||||
if( footprint->IsFlipped() )
|
||||
{
|
||||
|
@ -1026,7 +1026,7 @@ void ALTIUM_PCB::ParseComponentsBodies6Data( const CFB::CompoundFileReader& aRea
|
|||
modelSettings.m_Rotation.y = NormalizeAngleDegrees( -elem.modelRotation.y, -180, 180 );
|
||||
modelSettings.m_Rotation.z = NormalizeAngleDegrees( -elem.modelRotation.z
|
||||
+ elem.rotation
|
||||
+ orientation / 10, -180, 180 );
|
||||
+ orientation.AsDegrees(), -180, 180 );
|
||||
modelSettings.m_Opacity = elem.bodyOpacity;
|
||||
|
||||
footprint->Models().push_back( modelSettings );
|
||||
|
@ -2722,9 +2722,9 @@ void ALTIUM_PCB::ParseTexts6Data( const CFB::CompoundFileReader& aReader,
|
|||
if( fpText )
|
||||
{
|
||||
FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( fpText->GetParent() );
|
||||
double orientation = parentFootprint->GetOrientation();
|
||||
EDA_ANGLE orientation = parentFootprint->GetOrientation();
|
||||
|
||||
fpText->SetTextAngle( fpText->GetTextAngle().AsTenthsOfADegree() - orientation );
|
||||
fpText->SetTextAngle( fpText->GetTextAngle() - orientation );
|
||||
fpText->SetLocalCoord();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1537,11 +1537,11 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions()
|
|||
}
|
||||
}
|
||||
|
||||
wxPoint endOffset( csDim.Line.LeaderLineLength * cos( angRad ) * orientX,
|
||||
VECTOR2I endOffset( csDim.Line.LeaderLineLength * cos( angRad ) * orientX,
|
||||
csDim.Line.LeaderLineLength * sin( angRad ) * orientY );
|
||||
|
||||
wxPoint endPoint = csDim.Line.End + endOffset;
|
||||
wxPoint txtPoint( endPoint.x + ( csDim.Line.LeaderLineExtensionLength * orientX ),
|
||||
VECTOR2I endPoint = VECTOR2I( csDim.Line.End ) + endOffset;
|
||||
VECTOR2I txtPoint( endPoint.x + ( csDim.Line.LeaderLineExtensionLength * orientX ),
|
||||
endPoint.y );
|
||||
|
||||
leaderDim->SetEnd( getKiCadPoint( endPoint ) );
|
||||
|
@ -1721,13 +1721,13 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponents()
|
|||
footprint->SetValue( wxEmptyString );
|
||||
|
||||
footprint->SetPosition( getKiCadPoint( comp.Origin ) );
|
||||
footprint->SetOrientation( getAngleTenthDegree( comp.OrientAngle ) );
|
||||
footprint->SetOrientation( getAngle( comp.OrientAngle ) );
|
||||
footprint->SetReference( comp.Name );
|
||||
|
||||
if( comp.Mirror )
|
||||
{
|
||||
double mirroredAngle = - getAngleTenthDegree( comp.OrientAngle );
|
||||
NORMALIZE_ANGLE_180( mirroredAngle );
|
||||
EDA_ANGLE mirroredAngle = - getAngle( comp.OrientAngle );
|
||||
mirroredAngle.Normalize180();
|
||||
footprint->SetOrientation( mirroredAngle );
|
||||
footprint->Flip( getKiCadPoint( comp.Origin ), true );
|
||||
}
|
||||
|
@ -2879,7 +2879,7 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getShapeFromVertex( const POINT& aCadstar
|
|||
if( aRotationAngle != 0.0 )
|
||||
shape->Rotate( aTransformCentre, aRotationAngle );
|
||||
|
||||
if( aMoveVector != wxPoint{ 0, 0 } )
|
||||
if( aMoveVector != VECTOR2I{ 0, 0 } )
|
||||
shape->Move( aMoveVector );
|
||||
|
||||
if( isFootprint( aContainer ) && shape != nullptr )
|
||||
|
@ -3242,8 +3242,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::addAttribute( const ATTRIBUTE_LOCATION& aCadsta
|
|||
txt->SetPos0( rotatedTextPos );
|
||||
txt->SetLayer( getKiCadLayer( aCadstarAttrLoc.LayerID ) );
|
||||
txt->SetMirrored( aCadstarAttrLoc.Mirror );
|
||||
txt->SetTextAngle(
|
||||
getAngleTenthDegree( aCadstarAttrLoc.OrientAngle ) - aFootprint->GetOrientation() );
|
||||
txt->SetTextAngle( getAngle( aCadstarAttrLoc.OrientAngle ) - aFootprint->GetOrientation() );
|
||||
|
||||
if( aCadstarAttrLoc.Mirror ) // If mirroring, invert angle to match CADSTAR
|
||||
txt->SetTextAngle( -txt->GetTextAngle() );
|
||||
|
@ -3480,7 +3479,7 @@ double CADSTAR_PCB_ARCHIVE_LOADER::getHatchCodeAngleDegrees(
|
|||
if( hcode.Hatches.size() < 1 )
|
||||
return m_board->GetDesignSettings().GetDefaultZoneSettings().m_HatchOrientation;
|
||||
else
|
||||
return getAngleDegrees( hcode.Hatches.at( 0 ).OrientAngle );
|
||||
return getAngle( hcode.Hatches.at( 0 ).OrientAngle ).AsDegrees();
|
||||
}
|
||||
|
||||
|
||||
|
@ -3570,9 +3569,9 @@ void CADSTAR_PCB_ARCHIVE_LOADER::checkAndLogHatchCode( const HATCHCODE_ID& aCads
|
|||
"degrees apart. The imported hatching has two hatches 90 "
|
||||
"degrees apart, oriented %.1f degrees from horizontal." ),
|
||||
hcode.Name,
|
||||
getAngleDegrees( abs( hcode.Hatches.at( 0 ).OrientAngle
|
||||
- hcode.Hatches.at( 1 ).OrientAngle ) ),
|
||||
getAngleDegrees( hcode.Hatches.at( 0 ).OrientAngle ) ) );
|
||||
getAngle( abs( hcode.Hatches.at( 0 ).OrientAngle
|
||||
- hcode.Hatches.at( 1 ).OrientAngle ) ).AsDegrees(),
|
||||
getAngle( hcode.Hatches.at( 0 ).OrientAngle ).AsDegrees() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1530,13 +1530,12 @@ void EAGLE_PLUGIN::orientFootprintAndText( FOOTPRINT* aFootprint, const EELEMENT
|
|||
{
|
||||
if( e.rot->mirror )
|
||||
{
|
||||
double orientation = e.rot->degrees + 180.0;
|
||||
aFootprint->SetOrientation( orientation * 10 );
|
||||
aFootprint->SetOrientation( EDA_ANGLE( e.rot->degrees + 180.0, DEGREES_T ) );
|
||||
aFootprint->Flip( aFootprint->GetPosition(), false );
|
||||
}
|
||||
else
|
||||
{
|
||||
aFootprint->SetOrientation( e.rot->degrees * 10 );
|
||||
aFootprint->SetOrientation( EDA_ANGLE( e.rot->degrees, DEGREES_T ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1592,7 +1591,7 @@ void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TE
|
|||
// present, and this zero rotation becomes an override to the
|
||||
// package's text field. If they did not want zero, they specify
|
||||
// what they want explicitly.
|
||||
double degrees = a.rot ? a.rot->degrees : 0;
|
||||
double degrees = a.rot ? a.rot->degrees : 0.0;
|
||||
double orient; // relative to parent
|
||||
|
||||
int sign = 1;
|
||||
|
@ -1607,24 +1606,24 @@ void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TE
|
|||
|
||||
if( degrees == 90 || degrees == 0 || spin )
|
||||
{
|
||||
orient = degrees - aFootprint->GetOrientation() / 10;
|
||||
orient = degrees - aFootprint->GetOrientation().AsDegrees();
|
||||
aFPText->SetTextAngle( sign * orient * 10 );
|
||||
}
|
||||
else if( degrees == 180 )
|
||||
{
|
||||
orient = 0 - aFootprint->GetOrientation() / 10;
|
||||
orient = 0 - aFootprint->GetOrientation().AsDegrees();
|
||||
aFPText->SetTextAngle( sign * orient * 10 );
|
||||
align = -align;
|
||||
}
|
||||
else if( degrees == 270 )
|
||||
{
|
||||
orient = 90 - aFootprint->GetOrientation() / 10;
|
||||
orient = 90 - aFootprint->GetOrientation().AsDegrees();
|
||||
align = -align;
|
||||
aFPText->SetTextAngle( sign * orient * 10 );
|
||||
}
|
||||
else
|
||||
{
|
||||
orient = 90 - degrees - aFootprint->GetOrientation() / 10;
|
||||
orient = 90 - degrees - aFootprint->GetOrientation().AsDegrees();
|
||||
aFPText->SetTextAngle( sign * orient * 10 );
|
||||
}
|
||||
|
||||
|
@ -1681,9 +1680,10 @@ void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TE
|
|||
}
|
||||
else
|
||||
{
|
||||
// Part is not smash so use Lib default for NAME/VALUE // the text is per the original
|
||||
// package, sans <attribute>.
|
||||
double degrees = aFPText->GetTextAngle().AsDegrees() + aFootprint->GetOrientation() / 10.0;
|
||||
// Part is not smash so use Lib default for NAME/VALUE
|
||||
// the text is per the original package, sans <attribute>.
|
||||
double degrees = aFPText->GetTextAngle().AsDegrees()
|
||||
+ aFootprint->GetOrientation().AsDegrees();
|
||||
|
||||
// @todo there are a few more cases than these to contend with:
|
||||
if( ( !aFPText->IsMirrored() && ( abs( degrees ) == 180 || abs( degrees ) == 270 ) )
|
||||
|
|
|
@ -3425,7 +3425,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
|
|||
|
||||
if( token == T_NUMBER )
|
||||
{
|
||||
footprint->SetOrientation( parseAngle() );
|
||||
footprint->SetOrientation( EDA_ANGLE( parseAngle(), TENTHS_OF_A_DEGREE_T ) );
|
||||
NeedRIGHT();
|
||||
}
|
||||
else if( token != T_RIGHT )
|
||||
|
@ -3565,7 +3565,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments
|
|||
{
|
||||
FP_TEXT* text = parseFP_TEXT();
|
||||
text->SetParent( footprint.get() );
|
||||
double orientation = text->GetTextAngle().AsTenthsOfADegree();
|
||||
EDA_ANGLE orientation = text->GetTextAngle();
|
||||
orientation -= footprint->GetOrientation();
|
||||
text->SetTextAngle( orientation );
|
||||
text->SetDrawCoord();
|
||||
|
|
|
@ -1139,8 +1139,11 @@ void PCB_PLUGIN::format( const FOOTPRINT* aFootprint, int aNestLevel ) const
|
|||
m_out->Print( aNestLevel+1, "(at %s",
|
||||
FormatInternalUnits( aFootprint->GetPosition() ).c_str() );
|
||||
|
||||
if( aFootprint->GetOrientation() != 0.0 )
|
||||
m_out->Print( 0, " %s", FormatAngle( aFootprint->GetOrientation() ).c_str() );
|
||||
if( !aFootprint->GetOrientation().IsZero() )
|
||||
{
|
||||
m_out->Print( 0, " %s",
|
||||
FormatAngle( aFootprint->GetOrientation().AsTenthsOfADegree() ).c_str() );
|
||||
}
|
||||
|
||||
m_out->Print( 0, ")\n" );
|
||||
}
|
||||
|
@ -1789,7 +1792,7 @@ void PCB_PLUGIN::format( const FP_TEXT* aText, int aNestLevel ) const
|
|||
// Due to Pcbnew history, fp_text angle is saved as an absolute on screen angle,
|
||||
// but internally the angle is held relative to its parent footprint. parent
|
||||
// may be NULL when saving a footprint outside a BOARD.
|
||||
double orient = aText->GetTextAngle().AsTenthsOfADegree();
|
||||
EDA_ANGLE orient = aText->GetTextAngle();
|
||||
FOOTPRINT* parent = static_cast<FOOTPRINT*>( aText->GetParent() );
|
||||
|
||||
if( parent )
|
||||
|
@ -1806,12 +1809,12 @@ void PCB_PLUGIN::format( const FP_TEXT* aText, int aNestLevel ) const
|
|||
#else
|
||||
// Choose compatibility for now, even though this is only a 720 degree clamp
|
||||
// with two possible values for every angle.
|
||||
orient = NormalizeAngle360Min( orient + parent->GetOrientation() );
|
||||
orient = ( orient + parent->GetOrientation() ).Normalize720();
|
||||
#endif
|
||||
}
|
||||
|
||||
if( orient != 0.0 )
|
||||
m_out->Print( 0, " %s", FormatAngle( orient ).c_str() );
|
||||
if( !orient.IsZero() )
|
||||
m_out->Print( 0, " %s", FormatAngle( orient.AsTenthsOfADegree() ).c_str() );
|
||||
|
||||
if( !aText->IsKeepUpright() )
|
||||
m_out->Print( 0, " unlocked" );
|
||||
|
@ -2431,7 +2434,7 @@ void PCB_PLUGIN::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* a
|
|||
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aFootprint->Clone() );
|
||||
|
||||
// It's orientation should be zero and it should be on the front layer.
|
||||
footprint->SetOrientation( 0 );
|
||||
footprint->SetOrientation( ANGLE_0 );
|
||||
|
||||
if( footprint->GetLayer() != F_Cu )
|
||||
{
|
||||
|
|
|
@ -1194,7 +1194,7 @@ void LEGACY_PLUGIN::loadFOOTPRINT( FOOTPRINT* aFootprint )
|
|||
|
||||
aFootprint->SetPosition( VECTOR2I( pos_x, pos_y ) );
|
||||
aFootprint->SetLayer( layer_id );
|
||||
aFootprint->SetOrientation( orient );
|
||||
aFootprint->SetOrientation( EDA_ANGLE( orient, TENTHS_OF_A_DEGREE_T ) );
|
||||
const_cast<KIID&>( aFootprint->m_Uuid ) = KIID( uuid );
|
||||
aFootprint->SetLastEditTime( edittime );
|
||||
}
|
||||
|
@ -1658,10 +1658,6 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( FP_TEXT* aText )
|
|||
const char* txt_end;
|
||||
const char* line = m_reader->Line(); // current (old) line
|
||||
|
||||
// sscanf( line + 1, "%d %d %d %d %d %d %d %s %s %d %s",
|
||||
// &type, &m_Pos0.x, &m_Pos0.y, &m_Size.y, &m_Size.x,
|
||||
// &m_Orient, &m_Thickness, BufCar1, BufCar2, &layer, BufCar3 ) >= 10 )
|
||||
|
||||
// e.g. "T1 6940 -16220 350 300 900 60 M I 20 N "CFCARD"\r\n"
|
||||
// or T1 0 500 600 400 900 80 M V 20 N"74LS245"
|
||||
// ouch, the last example has no space between N and "74LS245" !
|
||||
|
@ -1672,7 +1668,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( FP_TEXT* aText )
|
|||
BIU pos0_y = biuParse( data, &data );
|
||||
BIU size0_y = biuParse( data, &data );
|
||||
BIU size0_x = biuParse( data, &data );
|
||||
double orient = degParse( data, &data );
|
||||
EDA_ANGLE orient = EDA_ANGLE( degParse( data, &data ), TENTHS_OF_A_DEGREE_T );
|
||||
BIU thickn = biuParse( data, &data );
|
||||
|
||||
// read the quoted text before the first call to strtok() which introduces
|
||||
|
@ -1709,7 +1705,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( FP_TEXT* aText )
|
|||
aText->SetPos0( VECTOR2I( pos0_x, pos0_y ) );
|
||||
aText->SetTextSize( wxSize( size0_x, size0_y ) );
|
||||
|
||||
orient -= ( static_cast<FOOTPRINT*>( aText->GetParent() ) )->GetOrientation();
|
||||
orient -= ( static_cast<FOOTPRINT*>( aText->GetParentFootprint() ) )->GetOrientation();
|
||||
|
||||
aText->SetTextAngle( orient );
|
||||
|
||||
|
|
|
@ -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-2022 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
|
||||
|
@ -509,7 +509,7 @@ void PCB_FOOTPRINT::AddToBoard()
|
|||
|
||||
footprint->SetPosition( VECTOR2I( m_positionX, m_positionY ) );
|
||||
footprint->SetLayer( m_Mirror ? B_Cu : F_Cu );
|
||||
footprint->SetOrientation( m_rotation );
|
||||
footprint->SetOrientation( EDA_ANGLE( m_rotation, TENTHS_OF_A_DEGREE_T ) );
|
||||
footprint->SetLastEditTime( 0 );
|
||||
|
||||
LIB_ID fpID;
|
||||
|
|
|
@ -1846,7 +1846,7 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
VECTOR2I offset = m_endSnapPoint - p;
|
||||
BOARD_ITEM* previewItem;
|
||||
wxPoint fp_offset = wxPoint( offset.Rotate( footprint->GetOrientationRadians() ) );
|
||||
wxPoint fp_offset = wxPoint( offset.Rotate( footprint->GetOrientation().AsRadians() ) );
|
||||
|
||||
view()->ClearPreview();
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2015-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2015-2022 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
|
||||
|
@ -878,9 +878,9 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
|
|||
// IMAGE object coordinates are relative to the IMAGE not absolute board coordinates.
|
||||
ZONE untransformedZone( *zone );
|
||||
|
||||
double angle = -aFootprint->GetOrientation();
|
||||
NORMALIZE_ANGLE_POS( angle );
|
||||
untransformedZone.Rotate( aFootprint->GetPosition(), angle );
|
||||
EDA_ANGLE angle = -aFootprint->GetOrientation();
|
||||
angle.Normalize();
|
||||
untransformedZone.Rotate( aFootprint->GetPosition(), angle.AsTenthsOfADegree() );
|
||||
|
||||
// keepout areas have a type. types are
|
||||
// T_place_keepout, T_via_keepout, T_wire_keepout,
|
||||
|
|
|
@ -372,7 +372,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard )
|
|||
if( place->side == T_front )
|
||||
{
|
||||
// convert from degrees to tenths of degrees used in KiCad.
|
||||
int orientation = KiROUND( place->rotation * 10.0 );
|
||||
EDA_ANGLE orientation( place->rotation, DEGREES_T );
|
||||
|
||||
if( footprint->GetLayer() != F_Cu )
|
||||
{
|
||||
|
@ -384,7 +384,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard )
|
|||
}
|
||||
else if( place->side == T_back )
|
||||
{
|
||||
int orientation = KiROUND( (place->rotation + 180.0) * 10.0 );
|
||||
EDA_ANGLE orientation( place->rotation + 180.0, DEGREES_T );
|
||||
|
||||
if( footprint->GetLayer() != B_Cu )
|
||||
{
|
||||
|
|
|
@ -1096,7 +1096,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
|
|||
if( fp->IsFlipped() )
|
||||
fp->Flip( fp->GetPosition(), m_frame->Settings().m_FlipLeftRight );
|
||||
|
||||
fp->SetOrientation( 0 );
|
||||
fp->SetOrientation( ANGLE_0 );
|
||||
fp->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
|
||||
|
||||
commit.Add( fp );
|
||||
|
|
|
@ -178,8 +178,7 @@ static void doPushPadProperties( BOARD& board, const PAD& aSrcPad, BOARD_COMMIT&
|
|||
{
|
||||
const FOOTPRINT* refFootprint = aSrcPad.GetParent();
|
||||
|
||||
EDA_ANGLE srcPadAngle = aSrcPad.GetOrientation()
|
||||
- EDA_ANGLE( refFootprint->GetOrientation(), TENTHS_OF_A_DEGREE_T );
|
||||
EDA_ANGLE srcPadAngle = aSrcPad.GetOrientation() - refFootprint->GetOrientation();
|
||||
|
||||
for( FOOTPRINT* footprint : board.Footprints() )
|
||||
{
|
||||
|
@ -194,8 +193,7 @@ static void doPushPadProperties( BOARD& board, const PAD& aSrcPad, BOARD_COMMIT&
|
|||
if( aPadShapeFilter && ( pad->GetShape() != aSrcPad.GetShape() ) )
|
||||
continue;
|
||||
|
||||
EDA_ANGLE padAngle = pad->GetOrientation()
|
||||
- EDA_ANGLE( footprint->GetOrientation(), TENTHS_OF_A_DEGREE_T );
|
||||
EDA_ANGLE padAngle = pad->GetOrientation() - footprint->GetOrientation();
|
||||
|
||||
if( aPadOrientFilter && ( padAngle != srcPadAngle ) )
|
||||
continue;
|
||||
|
|
|
@ -675,8 +675,7 @@ static void pasteFootprintItemsToFootprintEditor( FOOTPRINT* aClipFootprint, BOA
|
|||
if( text->GetType() != FP_TEXT::TEXT_is_DIVERS )
|
||||
continue;
|
||||
|
||||
text->SetTextAngle( text->GetTextAngle().AsTenthsOfADegree()
|
||||
+ aClipFootprint->GetOrientation() );
|
||||
text->SetTextAngle( text->GetTextAngle() + aClipFootprint->GetOrientation() );
|
||||
|
||||
text->SetParent( nullptr );
|
||||
text->SetLocalCoord();
|
||||
|
|
Loading…
Reference in New Issue