Another batch of point changes
This commit is contained in:
parent
d1552c3fec
commit
ea613cf448
|
@ -233,9 +233,9 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
||||||
|
|
||||||
/* Test A : Any corners exist in rotated rect? */
|
/* Test A : Any corners exist in rotated rect? */
|
||||||
corners[0] = m_pos;
|
corners[0] = m_pos;
|
||||||
corners[1] = m_pos + wxPoint( m_size.x, 0 );
|
corners[1] = m_pos + VECTOR2I( m_size.x, 0 );
|
||||||
corners[2] = m_pos + wxPoint( m_size.x, m_size.y );
|
corners[2] = m_pos + VECTOR2I( m_size.x, m_size.y );
|
||||||
corners[3] = m_pos + wxPoint( 0, m_size.y );
|
corners[3] = m_pos + VECTOR2I( 0, m_size.y );
|
||||||
|
|
||||||
VECTOR2I rCentre = aRect.Centre();
|
VECTOR2I rCentre = aRect.Centre();
|
||||||
|
|
||||||
|
@ -256,10 +256,10 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
||||||
int h = aRect.GetHeight() / 2;
|
int h = aRect.GetHeight() / 2;
|
||||||
|
|
||||||
// Construct corners around center of shape
|
// Construct corners around center of shape
|
||||||
corners[0] = wxPoint( -w, -h );
|
corners[0] = VECTOR2I( -w, -h );
|
||||||
corners[1] = wxPoint( w, -h );
|
corners[1] = VECTOR2I( w, -h );
|
||||||
corners[2] = wxPoint( w, h );
|
corners[2] = VECTOR2I( w, h );
|
||||||
corners[3] = wxPoint( -w, h );
|
corners[3] = VECTOR2I( -w, h );
|
||||||
|
|
||||||
// Rotate and test each corner
|
// Rotate and test each corner
|
||||||
for( int j = 0; j < 4; j++ )
|
for( int j = 0; j < 4; j++ )
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <wx/gdicmn.h>
|
#include <wx/gdicmn.h>
|
||||||
|
#include <math/vector2d.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,7 +145,7 @@ public:
|
||||||
return -ReadKicadUnit();
|
return -ReadKicadUnit();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint ReadWxPoint()
|
VECTOR2I ReadVector2I()
|
||||||
{
|
{
|
||||||
int32_t x = ReadKicadUnitX();
|
int32_t x = ReadKicadUnitX();
|
||||||
int32_t y = ReadKicadUnitY();
|
int32_t y = ReadKicadUnitY();
|
||||||
|
|
|
@ -34,7 +34,7 @@ using namespace STROKEPARAMS_T;
|
||||||
|
|
||||||
void STROKE_PARAMS::Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int aWidth,
|
void STROKE_PARAMS::Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int aWidth,
|
||||||
const KIGFX::RENDER_SETTINGS* aRenderSettings,
|
const KIGFX::RENDER_SETTINGS* aRenderSettings,
|
||||||
std::function<void( const wxPoint& a, const wxPoint& b )> aStroker )
|
std::function<void( const VECTOR2I& a, const VECTOR2I& b )> aStroker )
|
||||||
{
|
{
|
||||||
double strokes[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
double strokes[6] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
||||||
int wrapAround = 0;
|
int wrapAround = 0;
|
||||||
|
@ -93,7 +93,7 @@ void STROKE_PARAMS::Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int
|
||||||
VECTOR2D start = line->GetSeg().A;
|
VECTOR2D start = line->GetSeg().A;
|
||||||
VECTOR2D end = line->GetSeg().B;
|
VECTOR2D end = line->GetSeg().B;
|
||||||
|
|
||||||
EDA_RECT clip( (wxPoint)start, wxSize( end.x - start.x, end.y - start.y ) );
|
EDA_RECT clip( (VECTOR2I) start, wxSize( end.x - start.x, end.y - start.y ) );
|
||||||
clip.Normalize();
|
clip.Normalize();
|
||||||
|
|
||||||
double theta = atan2( end.y - start.y, end.x - start.x );
|
double theta = atan2( end.y - start.y, end.x - start.x );
|
||||||
|
@ -106,8 +106,8 @@ void STROKE_PARAMS::Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int
|
||||||
start.y + strokes[ i % wrapAround ] * sin( theta ) );
|
start.y + strokes[ i % wrapAround ] * sin( theta ) );
|
||||||
|
|
||||||
// Drawing each segment can be done rounded to ints.
|
// Drawing each segment can be done rounded to ints.
|
||||||
wxPoint a( KiROUND( start.x ), KiROUND( start.y ) );
|
VECTOR2I a( KiROUND( start.x ), KiROUND( start.y ) );
|
||||||
wxPoint b( KiROUND( next.x ), KiROUND( next.y ) );
|
VECTOR2I b( KiROUND( next.x ), KiROUND( next.y ) );
|
||||||
|
|
||||||
if( ClipLine( &clip, a.x, a.y, b.x, b.y ) )
|
if( ClipLine( &clip, a.x, a.y, b.x, b.y ) )
|
||||||
break;
|
break;
|
||||||
|
@ -151,9 +151,9 @@ void STROKE_PARAMS::Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int
|
||||||
|
|
||||||
if( i % 2 == 0 )
|
if( i % 2 == 0 )
|
||||||
{
|
{
|
||||||
wxPoint a( center.x + r * cos( startAngle * M_PI / 180.0 ),
|
VECTOR2I a( center.x + r * cos( startAngle * M_PI / 180.0 ),
|
||||||
center.y + r * sin( startAngle * M_PI / 180.0 ) );
|
center.y + r * sin( startAngle * M_PI / 180.0 ) );
|
||||||
wxPoint b( center.x + r * cos( endAngle * M_PI / 180.0 ),
|
VECTOR2I b( center.x + r * cos( endAngle * M_PI / 180.0 ),
|
||||||
center.y + r * sin( endAngle * M_PI / 180.0 ) );
|
center.y + r * sin( endAngle * M_PI / 180.0 ) );
|
||||||
|
|
||||||
aStroker( a, b );
|
aStroker( a, b );
|
||||||
|
|
|
@ -85,7 +85,7 @@ template<typename T> T round_n( const T& value, const T& n, bool aRoundUp )
|
||||||
class AUTOPLACER
|
class AUTOPLACER
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef wxPoint SIDE;
|
typedef VECTOR2I SIDE;
|
||||||
static const SIDE SIDE_TOP, SIDE_BOTTOM, SIDE_LEFT, SIDE_RIGHT;
|
static const SIDE SIDE_TOP, SIDE_BOTTOM, SIDE_LEFT, SIDE_RIGHT;
|
||||||
enum COLLISION { COLLIDE_NONE, COLLIDE_OBJECTS, COLLIDE_H_WIRES };
|
enum COLLISION { COLLIDE_NONE, COLLIDE_OBJECTS, COLLIDE_H_WIRES };
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ public:
|
||||||
bool force_wire_spacing = false;
|
bool force_wire_spacing = false;
|
||||||
SIDE_AND_NPINS sideandpins = chooseSideForFields( aManual );
|
SIDE_AND_NPINS sideandpins = chooseSideForFields( aManual );
|
||||||
SIDE field_side = sideandpins.side;
|
SIDE field_side = sideandpins.side;
|
||||||
wxPoint fbox_pos = fieldBoxPlacement( sideandpins );
|
VECTOR2I fbox_pos = fieldBoxPlacement( sideandpins );
|
||||||
EDA_RECT field_box( fbox_pos, m_fbox_size );
|
EDA_RECT field_box( fbox_pos, m_fbox_size );
|
||||||
|
|
||||||
if( aManual )
|
if( aManual )
|
||||||
|
@ -166,7 +166,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint pos( fieldHorizPlacement( field, field_box ),
|
VECTOR2I pos(
|
||||||
|
fieldHorizPlacement( field, field_box ),
|
||||||
fieldVertPlacement( field, field_box, &last_y_coord, !force_wire_spacing ) );
|
fieldVertPlacement( field, field_box, &last_y_coord, !force_wire_spacing ) );
|
||||||
|
|
||||||
if( m_align_to_grid )
|
if( m_align_to_grid )
|
||||||
|
@ -482,7 +483,7 @@ protected:
|
||||||
std::vector<SIDE_AND_NPINS> sides = getPreferredSides();
|
std::vector<SIDE_AND_NPINS> sides = getPreferredSides();
|
||||||
|
|
||||||
std::reverse( sides.begin(), sides.end() );
|
std::reverse( sides.begin(), sides.end() );
|
||||||
SIDE_AND_NPINS side = { wxPoint( 1, 0 ), UINT_MAX };
|
SIDE_AND_NPINS side = { VECTOR2I( 1, 0 ), UINT_MAX };
|
||||||
|
|
||||||
if( aAvoidCollisions )
|
if( aAvoidCollisions )
|
||||||
{
|
{
|
||||||
|
@ -525,7 +526,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
* Return the position of the field bounding box.
|
* Return the position of the field bounding box.
|
||||||
*/
|
*/
|
||||||
wxPoint fieldBoxPlacement( SIDE_AND_NPINS aFieldSideAndPins )
|
VECTOR2I fieldBoxPlacement( SIDE_AND_NPINS aFieldSideAndPins )
|
||||||
{
|
{
|
||||||
VECTOR2I fbox_center = m_symbol_bbox.Centre();
|
VECTOR2I fbox_center = m_symbol_bbox.Centre();
|
||||||
int offs_x = ( m_symbol_bbox.GetWidth() + m_fbox_size.GetWidth() ) / 2;
|
int offs_x = ( m_symbol_bbox.GetWidth() + m_fbox_size.GetWidth() ) / 2;
|
||||||
|
@ -543,7 +544,7 @@ protected:
|
||||||
int y = fbox_center.y - ( m_fbox_size.GetHeight() / 2 );
|
int y = fbox_center.y - ( m_fbox_size.GetHeight() / 2 );
|
||||||
|
|
||||||
auto getPinsBox =
|
auto getPinsBox =
|
||||||
[&]( const wxPoint& aSide )
|
[&]( const VECTOR2I& aSide )
|
||||||
{
|
{
|
||||||
EDA_RECT pinsBox;
|
EDA_RECT pinsBox;
|
||||||
|
|
||||||
|
@ -573,7 +574,7 @@ protected:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxPoint( x, y );
|
return VECTOR2I( x, y );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -283,7 +283,7 @@ void SCH_BUS_ENTRY_BASE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I
|
||||||
SHAPE_SEGMENT segment( start, end );
|
SHAPE_SEGMENT segment( start, end );
|
||||||
|
|
||||||
STROKE_PARAMS::Stroke( &segment, GetLineStyle(), penWidth, aSettings,
|
STROKE_PARAMS::Stroke( &segment, GetLineStyle(), penWidth, aSettings,
|
||||||
[&]( const wxPoint& a, const wxPoint& b )
|
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||||
{
|
{
|
||||||
GRLine( nullptr, DC, a.x, a.y, b.x, b.y, penWidth, color );
|
GRLine( nullptr, DC, a.x, a.y, b.x, b.y, penWidth, color );
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -387,7 +387,7 @@ void SCH_LINE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset )
|
||||||
SHAPE_SEGMENT segment( start, end );
|
SHAPE_SEGMENT segment( start, end );
|
||||||
|
|
||||||
STROKE_PARAMS::Stroke( &segment, lineStyle, penWidth, aSettings,
|
STROKE_PARAMS::Stroke( &segment, lineStyle, penWidth, aSettings,
|
||||||
[&]( const wxPoint& a, const wxPoint& b )
|
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||||
{
|
{
|
||||||
GRLine( nullptr, DC, a.x, a.y, b.x, b.y, penWidth, color );
|
GRLine( nullptr, DC, a.x, a.y, b.x, b.y, penWidth, color );
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -180,10 +180,10 @@ void SCH_NO_CONNECT::Plot( PLOTTER* aPlotter ) const
|
||||||
|
|
||||||
aPlotter->SetCurrentLineWidth( penWidth );
|
aPlotter->SetCurrentLineWidth( penWidth );
|
||||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_NOCONNECT ) );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_NOCONNECT ) );
|
||||||
aPlotter->MoveTo( wxPoint( pX - delta, pY - delta ) );
|
aPlotter->MoveTo( VECTOR2I( pX - delta, pY - delta ) );
|
||||||
aPlotter->FinishTo( wxPoint( pX + delta, pY + delta ) );
|
aPlotter->FinishTo( VECTOR2I( pX + delta, pY + delta ) );
|
||||||
aPlotter->MoveTo( wxPoint( pX + delta, pY - delta ) );
|
aPlotter->MoveTo( VECTOR2I( pX + delta, pY - delta ) );
|
||||||
aPlotter->FinishTo( wxPoint( pX - delta, pY + delta ) );
|
aPlotter->FinishTo( VECTOR2I( pX - delta, pY + delta ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -870,15 +870,15 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseArc()
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as an arc." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as an arc." ) );
|
||||||
|
|
||||||
T token;
|
T token;
|
||||||
wxPoint startPoint( 1, 0 ); // Initialize to a non-degenerate arc just for safety
|
VECTOR2I startPoint( 1, 0 ); // Initialize to a non-degenerate arc just for safety
|
||||||
wxPoint midPoint( 1, 1 );
|
VECTOR2I midPoint( 1, 1 );
|
||||||
wxPoint endPoint( 0, 1 );
|
VECTOR2I endPoint( 0, 1 );
|
||||||
bool hasMidPoint = false;
|
bool hasMidPoint = false;
|
||||||
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
|
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
|
||||||
FILL_PARAMS fill;
|
FILL_PARAMS fill;
|
||||||
|
|
||||||
// Parameters for legacy format
|
// Parameters for legacy format
|
||||||
wxPoint center( 0, 0 );
|
VECTOR2I center( 0, 0 );
|
||||||
int startAngle = 0;
|
int startAngle = 0;
|
||||||
int endAngle = 900;
|
int endAngle = 900;
|
||||||
bool hasAngles = false;
|
bool hasAngles = false;
|
||||||
|
@ -972,7 +972,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseArc()
|
||||||
|
|
||||||
if( hasMidPoint )
|
if( hasMidPoint )
|
||||||
{
|
{
|
||||||
arc->SetCenter( (wxPoint) CalcArcCenter( arc->GetStart(), midPoint, arc->GetEnd() ) );
|
arc->SetCenter( CalcArcCenter( arc->GetStart(), midPoint, arc->GetEnd() ) );
|
||||||
}
|
}
|
||||||
else if( hasAngles )
|
else if( hasAngles )
|
||||||
{
|
{
|
||||||
|
@ -1079,7 +1079,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseCircle()
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a circle." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a circle." ) );
|
||||||
|
|
||||||
T token;
|
T token;
|
||||||
wxPoint center( 0, 0 );
|
VECTOR2I center( 0, 0 );
|
||||||
int radius = 1; // defaulting to 0 could result in troublesome math....
|
int radius = 1; // defaulting to 0 could result in troublesome math....
|
||||||
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
|
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
|
||||||
FILL_PARAMS fill;
|
FILL_PARAMS fill;
|
||||||
|
@ -1125,7 +1125,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseCircle()
|
||||||
}
|
}
|
||||||
|
|
||||||
circle->SetCenter( center );
|
circle->SetCenter( center );
|
||||||
circle->SetEnd( wxPoint( center.x + radius, center.y ) );
|
circle->SetEnd( VECTOR2I( center.x + radius, center.y ) );
|
||||||
|
|
||||||
return circle.release();
|
return circle.release();
|
||||||
}
|
}
|
||||||
|
@ -1751,7 +1751,7 @@ SCH_SHEET_PIN* SCH_SEXPR_PARSER::parseSchSheetPin( SCH_SHEET* aSheet )
|
||||||
CurOffset() );
|
CurOffset() );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto sheetPin = std::make_unique<SCH_SHEET_PIN>( aSheet, wxPoint( 0, 0 ), name );
|
auto sheetPin = std::make_unique<SCH_SHEET_PIN>( aSheet, VECTOR2I( 0, 0 ), name );
|
||||||
|
|
||||||
token = NextTok();
|
token = NextTok();
|
||||||
|
|
||||||
|
@ -2753,7 +2753,7 @@ SCH_LINE* SCH_SEXPR_PARSER::parseLine()
|
||||||
wxCHECK_MSG( false, nullptr, "Cannot parse " + GetTokenString( CurTok() ) + " as a line." );
|
wxCHECK_MSG( false, nullptr, "Cannot parse " + GetTokenString( CurTok() ) + " as a line." );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SCH_LINE> line = std::make_unique<SCH_LINE>( wxPoint(), layer );
|
std::unique_ptr<SCH_LINE> line = std::make_unique<SCH_LINE>( VECTOR2I(), layer );
|
||||||
|
|
||||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||||
{
|
{
|
||||||
|
@ -2810,10 +2810,10 @@ SCH_SHAPE* SCH_SEXPR_PARSER::parseSchArc()
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as an arc." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as an arc." ) );
|
||||||
|
|
||||||
T token;
|
T token;
|
||||||
wxPoint startPoint;
|
VECTOR2I startPoint;
|
||||||
wxPoint midPoint;
|
VECTOR2I midPoint;
|
||||||
wxPoint endPoint;
|
VECTOR2I endPoint;
|
||||||
wxPoint pos;
|
VECTOR2I pos;
|
||||||
int startAngle;
|
int startAngle;
|
||||||
int endAngle;
|
int endAngle;
|
||||||
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
|
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
|
||||||
|
@ -2914,7 +2914,7 @@ SCH_SHAPE* SCH_SEXPR_PARSER::parseSchArc()
|
||||||
{
|
{
|
||||||
VECTOR2I center = CalcArcCenter( arc->GetStart(), midPoint, arc->GetEnd() );
|
VECTOR2I center = CalcArcCenter( arc->GetStart(), midPoint, arc->GetEnd() );
|
||||||
|
|
||||||
arc->SetCenter( (wxPoint) center );
|
arc->SetCenter( center );
|
||||||
}
|
}
|
||||||
else if( hasAngles )
|
else if( hasAngles )
|
||||||
{
|
{
|
||||||
|
@ -2946,7 +2946,7 @@ SCH_SHAPE* SCH_SEXPR_PARSER::parseSchCircle()
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a circle." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a circle." ) );
|
||||||
|
|
||||||
T token;
|
T token;
|
||||||
wxPoint center;
|
VECTOR2I center;
|
||||||
int radius = 0;
|
int radius = 0;
|
||||||
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
|
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
|
||||||
FILL_PARAMS fill;
|
FILL_PARAMS fill;
|
||||||
|
@ -2994,7 +2994,7 @@ SCH_SHAPE* SCH_SEXPR_PARSER::parseSchCircle()
|
||||||
}
|
}
|
||||||
|
|
||||||
circle->SetCenter( center );
|
circle->SetCenter( center );
|
||||||
circle->SetEnd( wxPoint( center.x + radius, center.y ) );
|
circle->SetEnd( VECTOR2I( center.x + radius, center.y ) );
|
||||||
|
|
||||||
return circle.release();
|
return circle.release();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1028,7 +1028,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
|
||||||
{
|
{
|
||||||
if( strCompare( "S", line, &line ) ) // Sheet dimensions.
|
if( strCompare( "S", line, &line ) ) // Sheet dimensions.
|
||||||
{
|
{
|
||||||
wxPoint position;
|
VECTOR2I position;
|
||||||
|
|
||||||
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
@ -1100,7 +1100,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
|
||||||
SCH_PARSE_ERROR( "invalid sheet pin side", aReader, line );
|
SCH_PARSE_ERROR( "invalid sheet pin side", aReader, line );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint position;
|
VECTOR2I position;
|
||||||
|
|
||||||
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
@ -1142,7 +1142,7 @@ SCH_BITMAP* SCH_LEGACY_PLUGIN::loadBitmap( LINE_READER& aReader )
|
||||||
{
|
{
|
||||||
if( strCompare( "Pos", line, &line ) )
|
if( strCompare( "Pos", line, &line ) )
|
||||||
{
|
{
|
||||||
wxPoint position;
|
VECTOR2I position;
|
||||||
|
|
||||||
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
@ -1229,7 +1229,7 @@ SCH_JUNCTION* SCH_LEGACY_PLUGIN::loadJunction( LINE_READER& aReader )
|
||||||
|
|
||||||
parseUnquotedString( name, aReader, line, &line );
|
parseUnquotedString( name, aReader, line, &line );
|
||||||
|
|
||||||
wxPoint position;
|
VECTOR2I position;
|
||||||
|
|
||||||
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
@ -1251,7 +1251,7 @@ SCH_NO_CONNECT* SCH_LEGACY_PLUGIN::loadNoConnect( LINE_READER& aReader )
|
||||||
|
|
||||||
parseUnquotedString( name, aReader, line, &line );
|
parseUnquotedString( name, aReader, line, &line );
|
||||||
|
|
||||||
wxPoint position;
|
VECTOR2I position;
|
||||||
|
|
||||||
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
@ -1345,7 +1345,7 @@ SCH_LINE* SCH_LEGACY_PLUGIN::loadWire( LINE_READER& aReader )
|
||||||
// Read the segment en points coordinates:
|
// Read the segment en points coordinates:
|
||||||
line = aReader.ReadLine();
|
line = aReader.ReadLine();
|
||||||
|
|
||||||
wxPoint begin, end;
|
VECTOR2I begin, end;
|
||||||
|
|
||||||
begin.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
begin.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
begin.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
begin.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
@ -1386,7 +1386,7 @@ SCH_BUS_ENTRY_BASE* SCH_LEGACY_PLUGIN::loadBusEntry( LINE_READER& aReader )
|
||||||
|
|
||||||
line = aReader.ReadLine();
|
line = aReader.ReadLine();
|
||||||
|
|
||||||
wxPoint pos;
|
VECTOR2I pos;
|
||||||
wxSize size;
|
wxSize size;
|
||||||
|
|
||||||
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
@ -1441,7 +1441,7 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader )
|
||||||
SCH_PARSE_ERROR( "unknown Text type", aReader, line );
|
SCH_PARSE_ERROR( "unknown Text type", aReader, line );
|
||||||
|
|
||||||
// Parse the parameters common to all text objects.
|
// Parse the parameters common to all text objects.
|
||||||
wxPoint position;
|
VECTOR2I position;
|
||||||
|
|
||||||
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
position.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
position.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
@ -1632,7 +1632,7 @@ SCH_SYMBOL* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
|
||||||
}
|
}
|
||||||
else if( strCompare( "P", line, &line ) )
|
else if( strCompare( "P", line, &line ) )
|
||||||
{
|
{
|
||||||
wxPoint pos;
|
VECTOR2I pos;
|
||||||
|
|
||||||
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
@ -1704,7 +1704,7 @@ SCH_SYMBOL* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
|
||||||
parseQuotedString( text, aReader, line, &line, true );
|
parseQuotedString( text, aReader, line, &line, true );
|
||||||
|
|
||||||
char orientation = parseChar( aReader, line, &line );
|
char orientation = parseChar( aReader, line, &line );
|
||||||
wxPoint pos;
|
VECTOR2I pos;
|
||||||
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
int size = Mils2Iu( parseInt( aReader, line, &line ) );
|
int size = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
@ -1722,7 +1722,7 @@ SCH_SYMBOL* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
|
||||||
// We freely renumber the index to fit the next available field slot.
|
// We freely renumber the index to fit the next available field slot.
|
||||||
index = symbol->GetFieldCount(); // new has this index after insertion
|
index = symbol->GetFieldCount(); // new has this index after insertion
|
||||||
|
|
||||||
SCH_FIELD field( wxPoint( 0, 0 ), index, symbol.get(), name );
|
SCH_FIELD field( VECTOR2I( 0, 0 ), index, symbol.get(), name );
|
||||||
symbol->AddField( field );
|
symbol->AddField( field );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3079,7 +3079,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
else
|
else
|
||||||
field->SetText( ConvertToNewOverbarNotation( text ) );
|
field->SetText( ConvertToNewOverbarNotation( text ) );
|
||||||
|
|
||||||
wxPoint pos;
|
VECTOR2I pos;
|
||||||
|
|
||||||
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
@ -3350,7 +3350,7 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadCircle( std::unique_ptr<LIB_SYMBOL>& aSy
|
||||||
|
|
||||||
LIB_SHAPE* circle = new LIB_SHAPE( aSymbol.get(), SHAPE_T::CIRCLE );
|
LIB_SHAPE* circle = new LIB_SHAPE( aSymbol.get(), SHAPE_T::CIRCLE );
|
||||||
|
|
||||||
wxPoint center;
|
VECTOR2I center;
|
||||||
|
|
||||||
center.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
center.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
center.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
center.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
@ -3358,7 +3358,7 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadCircle( std::unique_ptr<LIB_SYMBOL>& aSy
|
||||||
int radius = Mils2Iu( parseInt( aReader, line, &line ) );
|
int radius = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
|
||||||
circle->SetStart( center );
|
circle->SetStart( center );
|
||||||
circle->SetEnd( wxPoint( center.x + radius, center.y ) );
|
circle->SetEnd( VECTOR2I( center.x + radius, center.y ) );
|
||||||
circle->SetUnit( parseInt( aReader, line, &line ) );
|
circle->SetUnit( parseInt( aReader, line, &line ) );
|
||||||
circle->SetConvert( parseInt( aReader, line, &line ) );
|
circle->SetConvert( parseInt( aReader, line, &line ) );
|
||||||
circle->SetStroke( STROKE_PARAMS( Mils2Iu( parseInt( aReader, line, &line ) ),
|
circle->SetStroke( STROKE_PARAMS( Mils2Iu( parseInt( aReader, line, &line ) ),
|
||||||
|
@ -3384,7 +3384,7 @@ LIB_TEXT* SCH_LEGACY_PLUGIN_CACHE::loadText( std::unique_ptr<LIB_SYMBOL>& aSymbo
|
||||||
|
|
||||||
text->SetTextAngle( (double) parseInt( aReader, line, &line ) );
|
text->SetTextAngle( (double) parseInt( aReader, line, &line ) );
|
||||||
|
|
||||||
wxPoint center;
|
VECTOR2I center;
|
||||||
|
|
||||||
center.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
center.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
center.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
center.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
@ -3477,13 +3477,13 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadRect( std::unique_ptr<LIB_SYMBOL>& aSymb
|
||||||
|
|
||||||
LIB_SHAPE* rectangle = new LIB_SHAPE( aSymbol.get(), SHAPE_T::RECT );
|
LIB_SHAPE* rectangle = new LIB_SHAPE( aSymbol.get(), SHAPE_T::RECT );
|
||||||
|
|
||||||
wxPoint pos;
|
VECTOR2I pos;
|
||||||
|
|
||||||
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
rectangle->SetPosition( pos );
|
rectangle->SetPosition( pos );
|
||||||
|
|
||||||
wxPoint end;
|
VECTOR2I end;
|
||||||
|
|
||||||
end.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
end.x = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
end.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
end.y = Mils2Iu( parseInt( aReader, line, &line ) );
|
||||||
|
@ -3528,7 +3528,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
pos += tmp.size() + 1;
|
pos += tmp.size() + 1;
|
||||||
|
|
||||||
long num;
|
long num;
|
||||||
wxPoint position;
|
VECTOR2I position;
|
||||||
|
|
||||||
tmp = tokens.GetNextToken();
|
tmp = tokens.GetNextToken();
|
||||||
|
|
||||||
|
@ -3715,7 +3715,7 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadPolyLine( std::unique_ptr<LIB_SYMBOL>& a
|
||||||
polyLine->SetStroke( STROKE_PARAMS( Mils2Iu( parseInt( aReader, line, &line ) ),
|
polyLine->SetStroke( STROKE_PARAMS( Mils2Iu( parseInt( aReader, line, &line ) ),
|
||||||
PLOT_DASH_TYPE::SOLID ) );
|
PLOT_DASH_TYPE::SOLID ) );
|
||||||
|
|
||||||
wxPoint pt;
|
VECTOR2I pt;
|
||||||
|
|
||||||
for( int i = 0; i < points; i++ )
|
for( int i = 0; i < points; i++ )
|
||||||
{
|
{
|
||||||
|
@ -3749,16 +3749,16 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadBezier( std::unique_ptr<LIB_SYMBOL>& aSy
|
||||||
bezier->SetStroke( STROKE_PARAMS( Mils2Iu( parseInt( aReader, line, &line ) ),
|
bezier->SetStroke( STROKE_PARAMS( Mils2Iu( parseInt( aReader, line, &line ) ),
|
||||||
PLOT_DASH_TYPE::SOLID ) );
|
PLOT_DASH_TYPE::SOLID ) );
|
||||||
|
|
||||||
bezier->SetStart( wxPoint( Mils2Iu( parseInt( aReader, line, &line ) ),
|
bezier->SetStart( VECTOR2I( Mils2Iu( parseInt( aReader, line, &line ) ),
|
||||||
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
|
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
|
||||||
|
|
||||||
bezier->SetBezierC1( wxPoint( Mils2Iu( parseInt( aReader, line, &line ) ),
|
bezier->SetBezierC1( VECTOR2I( Mils2Iu( parseInt( aReader, line, &line ) ),
|
||||||
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
|
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
|
||||||
|
|
||||||
bezier->SetBezierC2( wxPoint( Mils2Iu( parseInt( aReader, line, &line ) ),
|
bezier->SetBezierC2( VECTOR2I( Mils2Iu( parseInt( aReader, line, &line ) ),
|
||||||
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
|
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
|
||||||
|
|
||||||
bezier->SetEnd( wxPoint( Mils2Iu( parseInt( aReader, line, &line ) ),
|
bezier->SetEnd( VECTOR2I( Mils2Iu( parseInt( aReader, line, &line ) ),
|
||||||
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
|
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
|
||||||
|
|
||||||
bezier->RebuildBezierToSegmentsPointsList( bezier->GetWidth() );
|
bezier->RebuildBezierToSegmentsPointsList( bezier->GetWidth() );
|
||||||
|
|
|
@ -61,13 +61,13 @@ void SCH_SHAPE::Move( const VECTOR2I& aOffset )
|
||||||
|
|
||||||
void SCH_SHAPE::MirrorHorizontally( int aCenter )
|
void SCH_SHAPE::MirrorHorizontally( int aCenter )
|
||||||
{
|
{
|
||||||
flip( wxPoint( aCenter, 0 ), true );
|
flip( VECTOR2I( aCenter, 0 ), true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SHAPE::MirrorVertically( int aCenter )
|
void SCH_SHAPE::MirrorVertically( int aCenter )
|
||||||
{
|
{
|
||||||
flip( wxPoint( 0, aCenter ), false );
|
flip( VECTOR2I( 0, aCenter ), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,14 +85,14 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const
|
||||||
int startAngle = 0;
|
int startAngle = 0;
|
||||||
int endAngle = 0;
|
int endAngle = 0;
|
||||||
|
|
||||||
static std::vector<wxPoint> cornerList;
|
static std::vector<VECTOR2I> cornerList;
|
||||||
|
|
||||||
if( GetShape() == SHAPE_T::POLY )
|
if( GetShape() == SHAPE_T::POLY )
|
||||||
{
|
{
|
||||||
cornerList.clear();
|
cornerList.clear();
|
||||||
|
|
||||||
for( const VECTOR2I& pt : m_poly.Outline( 0 ).CPoints() )
|
for( const VECTOR2I& pt : m_poly.Outline( 0 ).CPoints() )
|
||||||
cornerList.push_back( (wxPoint) pt );
|
cornerList.push_back( pt );
|
||||||
}
|
}
|
||||||
else if( GetShape() == SHAPE_T::ARC )
|
else if( GetShape() == SHAPE_T::ARC )
|
||||||
{
|
{
|
||||||
|
@ -220,7 +220,7 @@ void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
||||||
buffer = new VECTOR2I[ptCount];
|
buffer = new VECTOR2I[ptCount];
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < ptCount; ++ii )
|
for( unsigned ii = 0; ii < ptCount; ++ii )
|
||||||
buffer[ii] = (wxPoint) poly.CPoint( ii );
|
buffer[ii] = poly.CPoint( ii );
|
||||||
}
|
}
|
||||||
else if( GetShape() == SHAPE_T::BEZIER )
|
else if( GetShape() == SHAPE_T::BEZIER )
|
||||||
{
|
{
|
||||||
|
@ -312,7 +312,7 @@ void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
||||||
for( SHAPE* shape : shapes )
|
for( SHAPE* shape : shapes )
|
||||||
{
|
{
|
||||||
STROKE_PARAMS::Stroke( shape, GetStroke().GetPlotStyle(), penWidth, aSettings,
|
STROKE_PARAMS::Stroke( shape, GetStroke().GetPlotStyle(), penWidth, aSettings,
|
||||||
[&]( const wxPoint& a, const wxPoint& b )
|
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||||
{
|
{
|
||||||
GRLine( nullptr, DC, a.x, a.y, b.x, b.y, penWidth, color );
|
GRLine( nullptr, DC, a.x, a.y, b.x, b.y, penWidth, color );
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -84,9 +84,9 @@
|
||||||
// A helper function to calculate the arc center of an arc
|
// A helper function to calculate the arc center of an arc
|
||||||
// known by 2 end points, the radius, and the angle direction (CW or CCW)
|
// known by 2 end points, the radius, and the angle direction (CW or CCW)
|
||||||
// Arc angles are <= 180 degrees in circular interpol.
|
// Arc angles are <= 180 degrees in circular interpol.
|
||||||
static wxPoint computeCenter(wxPoint aStart, wxPoint aEnd, int& aRadius, bool aRotCCW )
|
static VECTOR2I computeCenter( VECTOR2I aStart, VECTOR2I aEnd, int& aRadius, bool aRotCCW )
|
||||||
{
|
{
|
||||||
wxPoint center;
|
VECTOR2I center;
|
||||||
VECTOR2D end;
|
VECTOR2D end;
|
||||||
end.x = double(aEnd.x - aStart.x);
|
end.x = double(aEnd.x - aStart.x);
|
||||||
end.y = double(aEnd.y - aStart.y);
|
end.y = double(aEnd.y - aStart.y);
|
||||||
|
@ -161,21 +161,25 @@ extern double ReadDouble( char*& text, bool aSkipSeparator = true );
|
||||||
extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
APERTURE_T aAperture,
|
APERTURE_T aAperture,
|
||||||
int Dcode_index,
|
int Dcode_index,
|
||||||
const wxPoint& aPos,
|
const VECTOR2I& aPos,
|
||||||
wxSize aSize,
|
wxSize aSize,
|
||||||
bool aLayerNegative );
|
bool aLayerNegative );
|
||||||
|
|
||||||
extern void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
extern void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
int Dcode_index,
|
int Dcode_index,
|
||||||
const wxPoint& aStart,
|
const VECTOR2I& aStart,
|
||||||
const wxPoint& aEnd,
|
const VECTOR2I& aEnd,
|
||||||
wxSize aPenSize,
|
wxSize aPenSize,
|
||||||
bool aLayerNegative );
|
bool aLayerNegative );
|
||||||
|
|
||||||
extern void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index,
|
extern void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
const wxPoint& aStart, const wxPoint& aEnd,
|
int Dcode_index,
|
||||||
const wxPoint& aRelCenter, wxSize aPenSize,
|
const VECTOR2I& aStart,
|
||||||
bool aClockwise, bool aMultiquadrant,
|
const VECTOR2I& aEnd,
|
||||||
|
const VECTOR2I& aRelCenter,
|
||||||
|
wxSize aPenSize,
|
||||||
|
bool aClockwise,
|
||||||
|
bool aMultiquadrant,
|
||||||
bool aLayerNegative );
|
bool aLayerNegative );
|
||||||
|
|
||||||
// Gerber X2 files have a file attribute which specify the type of image
|
// Gerber X2 files have a file attribute which specify the type of image
|
||||||
|
@ -1011,10 +1015,10 @@ void EXCELLON_IMAGE::FinishRouteCommand()
|
||||||
{
|
{
|
||||||
bool rot_ccw = m_RoutePositions[ii].m_rmode == ROUTE_CW;
|
bool rot_ccw = m_RoutePositions[ii].m_rmode == ROUTE_CW;
|
||||||
int radius = m_RoutePositions[ii].m_radius; // Can be adjusted by computeCenter.
|
int radius = m_RoutePositions[ii].m_radius; // Can be adjusted by computeCenter.
|
||||||
wxPoint center;
|
VECTOR2I center;
|
||||||
|
|
||||||
if( m_RoutePositions[ii].m_arc_type_info == ARC_INFO_TYPE_CENTER )
|
if( m_RoutePositions[ii].m_arc_type_info == ARC_INFO_TYPE_CENTER )
|
||||||
center = wxPoint( m_RoutePositions[ii].m_cx, m_RoutePositions[ii].m_cy );
|
center = VECTOR2I( m_RoutePositions[ii].m_cx, m_RoutePositions[ii].m_cy );
|
||||||
else
|
else
|
||||||
center = computeCenter( m_RoutePositions[ii-1].GetPos(),
|
center = computeCenter( m_RoutePositions[ii-1].GetPos(),
|
||||||
m_RoutePositions[ii].GetPos(), radius, rot_ccw );
|
m_RoutePositions[ii].GetPos(), radius, rot_ccw );
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
APERTURE_T aAperture,
|
APERTURE_T aAperture,
|
||||||
int Dcode_index,
|
int Dcode_index,
|
||||||
const wxPoint& aPos,
|
const VECTOR2I& aPos,
|
||||||
wxSize aSize,
|
wxSize aSize,
|
||||||
bool aLayerNegative )
|
bool aLayerNegative )
|
||||||
{
|
{
|
||||||
|
@ -152,8 +152,8 @@ void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
*/
|
*/
|
||||||
void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
int Dcode_index,
|
int Dcode_index,
|
||||||
const wxPoint& aStart,
|
const VECTOR2I& aStart,
|
||||||
const wxPoint& aEnd,
|
const VECTOR2I& aEnd,
|
||||||
wxSize aPenSize,
|
wxSize aPenSize,
|
||||||
bool aLayerNegative )
|
bool aLayerNegative )
|
||||||
{
|
{
|
||||||
|
@ -199,11 +199,11 @@ void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
|
||||||
* false when arc is inside one quadrant
|
* false when arc is inside one quadrant
|
||||||
* @param aLayerNegative set to true if the current layer is negative.
|
* @param aLayerNegative set to true if the current layer is negative.
|
||||||
*/
|
*/
|
||||||
void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, const wxPoint& aStart,
|
void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, const VECTOR2I& aStart,
|
||||||
const wxPoint& aEnd, const wxPoint& aRelCenter, wxSize aPenSize,
|
const VECTOR2I& aEnd, const VECTOR2I& aRelCenter, wxSize aPenSize,
|
||||||
bool aClockwise, bool aMultiquadrant, bool aLayerNegative )
|
bool aClockwise, bool aMultiquadrant, bool aLayerNegative )
|
||||||
{
|
{
|
||||||
wxPoint center, delta;
|
VECTOR2I center, delta;
|
||||||
|
|
||||||
aGbrItem->m_Shape = GBR_ARC;
|
aGbrItem->m_Shape = GBR_ARC;
|
||||||
aGbrItem->m_Size = aPenSize;
|
aGbrItem->m_Size = aPenSize;
|
||||||
|
@ -325,8 +325,8 @@ void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, const wxPoint&
|
||||||
* false when arc is inside one quadrant
|
* false when arc is inside one quadrant
|
||||||
* @param aLayerNegative set to true if the current layer is negative
|
* @param aLayerNegative set to true if the current layer is negative
|
||||||
*/
|
*/
|
||||||
static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem, const wxPoint& aStart, const wxPoint& aEnd,
|
static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem, const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||||
const wxPoint& rel_center, bool aClockwise, bool aMultiquadrant,
|
const VECTOR2I& rel_center, bool aClockwise, bool aMultiquadrant,
|
||||||
bool aLayerNegative )
|
bool aLayerNegative )
|
||||||
{
|
{
|
||||||
/* in order to calculate arc parameters, we use fillArcGBRITEM
|
/* in order to calculate arc parameters, we use fillArcGBRITEM
|
||||||
|
|
|
@ -252,7 +252,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Convert the text shape to a list of segment.
|
* Convert the text shape to a list of segment.
|
||||||
*
|
*
|
||||||
* Each segment is stored as 2 wxPoints: the starting point and the ending point
|
* Each segment is stored as 2 VECTOR2Is: the starting point and the ending point
|
||||||
* there are therefore 2*n points.
|
* there are therefore 2*n points.
|
||||||
*/
|
*/
|
||||||
std::vector<VECTOR2I> TransformToSegmentList() const;
|
std::vector<VECTOR2I> TransformToSegmentList() const;
|
||||||
|
@ -276,7 +276,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Test if \a aPoint is within the bounds of this object.
|
* Test if \a aPoint is within the bounds of this object.
|
||||||
*
|
*
|
||||||
* @param aPoint A wxPoint to test.
|
* @param aPoint A VECTOR2I to test.
|
||||||
* @param aAccuracy Amount to inflate the bounding box.
|
* @param aAccuracy Amount to inflate the bounding box.
|
||||||
* @return true if a hit, else false.
|
* @return true if a hit, else false.
|
||||||
*/
|
*/
|
||||||
|
@ -330,7 +330,7 @@ public:
|
||||||
* Populate \a aPositions with the position of each line of a multiline text, according
|
* Populate \a aPositions with the position of each line of a multiline text, according
|
||||||
* to the vertical justification and the rotation of the whole text.
|
* to the vertical justification and the rotation of the whole text.
|
||||||
*
|
*
|
||||||
* @param aPositions is the list to populate by the wxPoint positions.
|
* @param aPositions is the list to populate by the VECTOR2I positions.
|
||||||
* @param aLineCount is the number of lines (not recalculated here for efficiency reasons.
|
* @param aLineCount is the number of lines (not recalculated here for efficiency reasons.
|
||||||
*/
|
*/
|
||||||
void GetLinePositions( std::vector<VECTOR2I>& aPositions, int aLineCount ) const;
|
void GetLinePositions( std::vector<VECTOR2I>& aPositions, int aLineCount ) const;
|
||||||
|
|
|
@ -77,7 +77,7 @@ public:
|
||||||
void ShapeToPolygon( SHAPE_LINE_CHAIN& aPolygon, int aScale = -1 ) const;
|
void ShapeToPolygon( SHAPE_LINE_CHAIN& aPolygon, int aScale = -1 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print the shape is the polygon defined in m_Corners (array of wxPoints).
|
* Print the shape is the polygon defined in m_Corners (array of VECTOR2Is).
|
||||||
*/
|
*/
|
||||||
void PrintMarker( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset );
|
void PrintMarker( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset );
|
||||||
|
|
||||||
|
@ -105,9 +105,9 @@ public:
|
||||||
std::shared_ptr<RC_ITEM> GetRCItem() const { return m_rcItem; }
|
std::shared_ptr<RC_ITEM> GetRCItem() const { return m_rcItem; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if the given wxPoint is within the bounds of this object.
|
* Test if the given VECTOR2I is within the bounds of this object.
|
||||||
*
|
*
|
||||||
* @param aHitPosition is the wxPoint to test (in internal units).
|
* @param aHitPosition is the VECTOR2I to test (in internal units).
|
||||||
* @return true if a hit, else false.
|
* @return true if a hit, else false.
|
||||||
*/
|
*/
|
||||||
bool HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) const;
|
bool HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) const;
|
||||||
|
|
|
@ -115,7 +115,7 @@ public:
|
||||||
|
|
||||||
static void Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int aWidth,
|
static void Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int aWidth,
|
||||||
const KIGFX::RENDER_SETTINGS* aRenderSettings,
|
const KIGFX::RENDER_SETTINGS* aRenderSettings,
|
||||||
std::function<void( const wxPoint& a, const wxPoint& b )> aStroker );
|
std::function<void( const VECTOR2I& a, const VECTOR2I& b )> aStroker );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_width;
|
int m_width;
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <math/vector2d.h>
|
||||||
|
|
||||||
class wxPoint; // Defined in wxWidgets
|
|
||||||
class SHAPE_POLY_SET;
|
class SHAPE_POLY_SET;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,7 +38,7 @@ class SHAPE_POLY_SET;
|
||||||
* @param aPoly is the list of points.
|
* @param aPoly is the list of points.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void BuildConvexHull( std::vector<wxPoint>& aResult, const std::vector<wxPoint>& aPoly );
|
void BuildConvexHull( std::vector<VECTOR2I>& aResult, const std::vector<VECTOR2I>& aPoly );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the convex hull of a #SHAPE_POLY_SET.
|
* Calculate the convex hull of a #SHAPE_POLY_SET.
|
||||||
|
@ -46,7 +46,7 @@ void BuildConvexHull( std::vector<wxPoint>& aResult, const std::vector<wxPoint>&
|
||||||
* @param aResult is a vector to store the convex polygon.
|
* @param aResult is a vector to store the convex polygon.
|
||||||
* @param aPolygons is the #SHAPE_POLY_SET.
|
* @param aPolygons is the #SHAPE_POLY_SET.
|
||||||
*/
|
*/
|
||||||
void BuildConvexHull( std::vector<wxPoint>& aResult, const SHAPE_POLY_SET& aPolygons );
|
void BuildConvexHull( std::vector<VECTOR2I>& aResult, const SHAPE_POLY_SET& aPolygons );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the convex hull (rotated and moved) of a #SHAPE_POLY_SET.
|
* Calculate the convex hull (rotated and moved) of a #SHAPE_POLY_SET.
|
||||||
|
@ -56,7 +56,7 @@ void BuildConvexHull( std::vector<wxPoint>& aResult, const SHAPE_POLY_SET& aPoly
|
||||||
* @param aPosition is the final position of the convex hull.
|
* @param aPosition is the final position of the convex hull.
|
||||||
* @param aRotation is the rotation of the convex hull.
|
* @param aRotation is the rotation of the convex hull.
|
||||||
*/
|
*/
|
||||||
void BuildConvexHull( std::vector<wxPoint>& aResult, const SHAPE_POLY_SET& aPolygons,
|
void BuildConvexHull( std::vector<VECTOR2I>& aResult, const SHAPE_POLY_SET& aPolygons,
|
||||||
const wxPoint& aPosition, double aRotation );
|
const VECTOR2I& aPosition, double aRotation );
|
||||||
|
|
||||||
#endif // __CONVEX_HULL_H
|
#endif // __CONVEX_HULL_H
|
||||||
|
|
|
@ -67,7 +67,7 @@ typedef long long coord2_t; // must be big enough to hold 2*max(|coordinate|
|
||||||
|
|
||||||
// this function is used to sort points.
|
// this function is used to sort points.
|
||||||
// Andrew's monotone chain 2D convex hull algorithm needs a sorted set of points
|
// Andrew's monotone chain 2D convex hull algorithm needs a sorted set of points
|
||||||
static bool compare_point( const wxPoint& ref, const wxPoint& p )
|
static bool compare_point( const VECTOR2I& ref, const VECTOR2I& p )
|
||||||
{
|
{
|
||||||
return ref.x < p.x || (ref.x == p.x && ref.y < p.y);
|
return ref.x < p.x || (ref.x == p.x && ref.y < p.y);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ static bool compare_point( const wxPoint& ref, const wxPoint& p )
|
||||||
// 2D cross product of OA and OB vectors, i.e. z-component of their 3D cross product.
|
// 2D cross product of OA and OB vectors, i.e. z-component of their 3D cross product.
|
||||||
// Returns a positive value, if OAB makes a counter-clockwise turn,
|
// Returns a positive value, if OAB makes a counter-clockwise turn,
|
||||||
// negative for clockwise turn, and zero if the points are collinear.
|
// negative for clockwise turn, and zero if the points are collinear.
|
||||||
static coord2_t cross_product( const wxPoint& O, const wxPoint& A, const wxPoint& B )
|
static coord2_t cross_product( const VECTOR2I& O, const VECTOR2I& A, const VECTOR2I& B )
|
||||||
{
|
{
|
||||||
return (coord2_t) (A.x - O.x) * (coord2_t) (B.y - O.y)
|
return (coord2_t) (A.x - O.x) * (coord2_t) (B.y - O.y)
|
||||||
- (coord2_t) (A.y - O.y) * (coord2_t) (B.x - O.x);
|
- (coord2_t) (A.y - O.y) * (coord2_t) (B.x - O.x);
|
||||||
|
@ -84,9 +84,9 @@ static coord2_t cross_product( const wxPoint& O, const wxPoint& A, const wxPoint
|
||||||
|
|
||||||
|
|
||||||
// Fills aResult with a list of points on the convex hull in counter-clockwise order.
|
// Fills aResult with a list of points on the convex hull in counter-clockwise order.
|
||||||
void BuildConvexHull( std::vector<wxPoint>& aResult, const std::vector<wxPoint>& aPoly )
|
void BuildConvexHull( std::vector<VECTOR2I>& aResult, const std::vector<VECTOR2I>& aPoly )
|
||||||
{
|
{
|
||||||
std::vector<wxPoint> poly = aPoly;
|
std::vector<VECTOR2I> poly = aPoly;
|
||||||
int point_count = poly.size();
|
int point_count = poly.size();
|
||||||
|
|
||||||
if( point_count < 2 ) // Should not happen, but who know
|
if( point_count < 2 ) // Should not happen, but who know
|
||||||
|
@ -131,17 +131,17 @@ void BuildConvexHull( std::vector<wxPoint>& aResult, const std::vector<wxPoint>&
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BuildConvexHull( std::vector<wxPoint>& aResult, const SHAPE_POLY_SET& aPolygons )
|
void BuildConvexHull( std::vector<VECTOR2I>& aResult, const SHAPE_POLY_SET& aPolygons )
|
||||||
{
|
{
|
||||||
BuildConvexHull( aResult, aPolygons, wxPoint( 0, 0 ), 0.0 );
|
BuildConvexHull( aResult, aPolygons, VECTOR2I( 0, 0 ), 0.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BuildConvexHull( std::vector<wxPoint>& aResult, const SHAPE_POLY_SET& aPolygons,
|
void BuildConvexHull( std::vector<VECTOR2I>& aResult, const SHAPE_POLY_SET& aPolygons,
|
||||||
const wxPoint& aPosition, double aRotation )
|
const VECTOR2I& aPosition, double aRotation )
|
||||||
{
|
{
|
||||||
// Build the convex hull of the SHAPE_POLY_SET
|
// Build the convex hull of the SHAPE_POLY_SET
|
||||||
std::vector<wxPoint> buf;
|
std::vector<VECTOR2I> buf;
|
||||||
|
|
||||||
for( int cnt = 0; cnt < aPolygons.OutlineCount(); cnt++ )
|
for( int cnt = 0; cnt < aPolygons.OutlineCount(); cnt++ )
|
||||||
{
|
{
|
||||||
|
@ -157,7 +157,7 @@ void BuildConvexHull( std::vector<wxPoint>& aResult, const SHAPE_POLY_SET& aPoly
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < aResult.size(); ii++ )
|
for( unsigned ii = 0; ii < aResult.size(); ii++ )
|
||||||
{
|
{
|
||||||
RotatePoint( &aResult[ii], aRotation );
|
RotatePoint( aResult[ii], aRotation );
|
||||||
aResult[ii] += aPosition;
|
aResult[ii] += aPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -919,13 +919,13 @@ SHAPE_POLY_SET FOOTPRINT::GetBoundingHull() const
|
||||||
rawPolys.Append( GetPosition().x - halfsize, GetPosition().y + halfsize );
|
rawPolys.Append( GetPosition().x - halfsize, GetPosition().y + halfsize );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<wxPoint> convex_hull;
|
std::vector<VECTOR2I> convex_hull;
|
||||||
BuildConvexHull( convex_hull, rawPolys );
|
BuildConvexHull( convex_hull, rawPolys );
|
||||||
|
|
||||||
m_cachedHull.RemoveAllContours();
|
m_cachedHull.RemoveAllContours();
|
||||||
m_cachedHull.NewOutline();
|
m_cachedHull.NewOutline();
|
||||||
|
|
||||||
for( const wxPoint& pt : convex_hull )
|
for( const VECTOR2I& pt : convex_hull )
|
||||||
m_cachedHull.Append( pt );
|
m_cachedHull.Append( pt );
|
||||||
|
|
||||||
if( board )
|
if( board )
|
||||||
|
|
|
@ -499,14 +499,14 @@ void PCB_DIMENSION_BASE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& a
|
||||||
|
|
||||||
if( circle )
|
if( circle )
|
||||||
{
|
{
|
||||||
TransformCircleToPolygon( aCornerBuffer, (wxPoint) circle->GetCenter(),
|
TransformCircleToPolygon( aCornerBuffer, circle->GetCenter(),
|
||||||
circle->GetRadius() + m_lineThickness / 2 + aClearance,
|
circle->GetRadius() + m_lineThickness / 2 + aClearance,
|
||||||
aError, aErrorLoc );
|
aError, aErrorLoc );
|
||||||
}
|
}
|
||||||
else if( seg )
|
else if( seg )
|
||||||
{
|
{
|
||||||
TransformOvalToPolygon( aCornerBuffer, (wxPoint) seg->GetSeg().A,
|
TransformOvalToPolygon( aCornerBuffer, seg->GetSeg().A,
|
||||||
(wxPoint) seg->GetSeg().B, m_lineThickness + 2 * aClearance,
|
seg->GetSeg().B, m_lineThickness + 2 * aClearance,
|
||||||
aError, aErrorLoc );
|
aError, aErrorLoc );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -596,8 +596,8 @@ void PCB_DIM_ALIGNED::updateGeometry()
|
||||||
|
|
||||||
// Add crossbar
|
// Add crossbar
|
||||||
VECTOR2I crossBarDistance = sign( m_height ) * extension.Resize( m_height );
|
VECTOR2I crossBarDistance = sign( m_height ) * extension.Resize( m_height );
|
||||||
m_crossBarStart = m_start + wxPoint( crossBarDistance );
|
m_crossBarStart = m_start + crossBarDistance;
|
||||||
m_crossBarEnd = m_end + wxPoint( crossBarDistance );
|
m_crossBarEnd = m_end + crossBarDistance;
|
||||||
|
|
||||||
// Update text after calculating crossbar position but before adding crossbar lines
|
// Update text after calculating crossbar position but before adding crossbar lines
|
||||||
updateText();
|
updateText();
|
||||||
|
@ -641,16 +641,16 @@ void PCB_DIM_ALIGNED::updateGeometry()
|
||||||
double arrowRotNeg = dimension.Angle() - DEG2RAD( s_arrowAngle );
|
double arrowRotNeg = dimension.Angle() - DEG2RAD( s_arrowAngle );
|
||||||
|
|
||||||
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart,
|
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart,
|
||||||
m_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) );
|
m_crossBarStart + arrowEnd.Rotate( arrowRotPos ) ) );
|
||||||
|
|
||||||
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart,
|
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart,
|
||||||
m_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) );
|
m_crossBarStart + arrowEnd.Rotate( arrowRotNeg ) ) );
|
||||||
|
|
||||||
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd,
|
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd,
|
||||||
m_crossBarEnd - wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) );
|
m_crossBarEnd - arrowEnd.Rotate( arrowRotPos ) ) );
|
||||||
|
|
||||||
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd,
|
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd,
|
||||||
m_crossBarEnd - wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) );
|
m_crossBarEnd - arrowEnd.Rotate( arrowRotNeg ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -671,11 +671,11 @@ void PCB_DIM_ALIGNED::updateText()
|
||||||
VECTOR2I textOffset = crossbarCenter.Rotate( rotation ).Resize( textOffsetDistance );
|
VECTOR2I textOffset = crossbarCenter.Rotate( rotation ).Resize( textOffsetDistance );
|
||||||
textOffset += crossbarCenter;
|
textOffset += crossbarCenter;
|
||||||
|
|
||||||
m_text.SetTextPos( m_crossBarStart + wxPoint( textOffset ) );
|
m_text.SetTextPos( m_crossBarStart + textOffset );
|
||||||
}
|
}
|
||||||
else if( m_textPosition == DIM_TEXT_POSITION::INLINE )
|
else if( m_textPosition == DIM_TEXT_POSITION::INLINE )
|
||||||
{
|
{
|
||||||
m_text.SetTextPos( m_crossBarStart + wxPoint( crossbarCenter ) );
|
m_text.SetTextPos( m_crossBarStart + crossbarCenter );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_keepTextAligned )
|
if( m_keepTextAligned )
|
||||||
|
@ -762,12 +762,12 @@ void PCB_DIM_ORTHOGONAL::updateGeometry()
|
||||||
|
|
||||||
// Add crossbar
|
// Add crossbar
|
||||||
VECTOR2I crossBarDistance = sign( m_height ) * extension.Resize( m_height );
|
VECTOR2I crossBarDistance = sign( m_height ) * extension.Resize( m_height );
|
||||||
m_crossBarStart = m_start + wxPoint( crossBarDistance );
|
m_crossBarStart = m_start + crossBarDistance;
|
||||||
|
|
||||||
if( m_orientation == DIR::HORIZONTAL )
|
if( m_orientation == DIR::HORIZONTAL )
|
||||||
m_crossBarEnd = wxPoint( m_end.x, m_crossBarStart.y );
|
m_crossBarEnd = VECTOR2I( m_end.x, m_crossBarStart.y );
|
||||||
else
|
else
|
||||||
m_crossBarEnd = wxPoint( m_crossBarStart.x, m_end.y );
|
m_crossBarEnd = VECTOR2I( m_crossBarStart.x, m_end.y );
|
||||||
|
|
||||||
// Add second extension line (m_end to crossbar end)
|
// Add second extension line (m_end to crossbar end)
|
||||||
if( m_orientation == DIR::HORIZONTAL )
|
if( m_orientation == DIR::HORIZONTAL )
|
||||||
|
@ -824,17 +824,13 @@ void PCB_DIM_ORTHOGONAL::updateGeometry()
|
||||||
double arrowRotPos = crossBarAngle.Angle() + DEG2RAD( s_arrowAngle );
|
double arrowRotPos = crossBarAngle.Angle() + DEG2RAD( s_arrowAngle );
|
||||||
double arrowRotNeg = crossBarAngle.Angle() - DEG2RAD( s_arrowAngle );
|
double arrowRotNeg = crossBarAngle.Angle() - DEG2RAD( s_arrowAngle );
|
||||||
|
|
||||||
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart,
|
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart, m_crossBarStart + arrowEnd.Rotate( arrowRotPos ) ) );
|
||||||
m_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) );
|
|
||||||
|
|
||||||
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart,
|
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart, m_crossBarStart + arrowEnd.Rotate( arrowRotNeg ) ) );
|
||||||
m_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) );
|
|
||||||
|
|
||||||
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd,
|
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd, m_crossBarEnd - arrowEnd.Rotate( arrowRotPos ) ) );
|
||||||
m_crossBarEnd - wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) );
|
|
||||||
|
|
||||||
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd,
|
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd, m_crossBarEnd - arrowEnd.Rotate( arrowRotNeg ) ) );
|
||||||
m_crossBarEnd - wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -855,11 +851,11 @@ void PCB_DIM_ORTHOGONAL::updateText()
|
||||||
|
|
||||||
textOffset += crossbarCenter;
|
textOffset += crossbarCenter;
|
||||||
|
|
||||||
m_text.SetTextPos( m_crossBarStart + wxPoint( textOffset ) );
|
m_text.SetTextPos( m_crossBarStart + textOffset );
|
||||||
}
|
}
|
||||||
else if( m_textPosition == DIM_TEXT_POSITION::INLINE )
|
else if( m_textPosition == DIM_TEXT_POSITION::INLINE )
|
||||||
{
|
{
|
||||||
m_text.SetTextPos( m_crossBarStart + wxPoint( crossbarCenter ) );
|
m_text.SetTextPos( m_crossBarStart + crossbarCenter );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_keepTextAligned )
|
if( m_keepTextAligned )
|
||||||
|
@ -1023,10 +1019,8 @@ void PCB_DIM_LEADER::updateGeometry()
|
||||||
double arrowRotPos = firstLine.Angle() + DEG2RAD( s_arrowAngle );
|
double arrowRotPos = firstLine.Angle() + DEG2RAD( s_arrowAngle );
|
||||||
double arrowRotNeg = firstLine.Angle() - DEG2RAD( s_arrowAngle );
|
double arrowRotNeg = firstLine.Angle() - DEG2RAD( s_arrowAngle );
|
||||||
|
|
||||||
m_shapes.emplace_back( new SHAPE_SEGMENT( start,
|
m_shapes.emplace_back( new SHAPE_SEGMENT( start, start + arrowEnd.Rotate( arrowRotPos ) ) );
|
||||||
start + (wxPoint) arrowEnd.Rotate( arrowRotPos ) ) );
|
m_shapes.emplace_back( new SHAPE_SEGMENT( start, start + arrowEnd.Rotate( arrowRotNeg ) ) );
|
||||||
m_shapes.emplace_back( new SHAPE_SEGMENT( start,
|
|
||||||
start + (wxPoint) arrowEnd.Rotate( arrowRotNeg ) ) );
|
|
||||||
|
|
||||||
|
|
||||||
if( !GetText().IsEmpty() )
|
if( !GetText().IsEmpty() )
|
||||||
|
@ -1183,7 +1177,7 @@ void PCB_DIM_RADIAL::updateGeometry()
|
||||||
VECTOR2I radial( m_end - m_start );
|
VECTOR2I radial( m_end - m_start );
|
||||||
radial = radial.Resize( m_leaderLength );
|
radial = radial.Resize( m_leaderLength );
|
||||||
|
|
||||||
SEG arrowSeg( m_end, m_end + (wxPoint) radial );
|
SEG arrowSeg( m_end, m_end + radial );
|
||||||
SEG textSeg( arrowSeg.B, m_text.GetPosition() );
|
SEG textSeg( arrowSeg.B, m_text.GetPosition() );
|
||||||
|
|
||||||
OPT_VECTOR2I arrowSegEnd = segPolyIntersection( polyBox, arrowSeg );
|
OPT_VECTOR2I arrowSegEnd = segPolyIntersection( polyBox, arrowSeg );
|
||||||
|
@ -1203,10 +1197,8 @@ void PCB_DIM_RADIAL::updateGeometry()
|
||||||
double arrowRotPos = radial.Angle() + DEG2RAD( s_arrowAngle );
|
double arrowRotPos = radial.Angle() + DEG2RAD( s_arrowAngle );
|
||||||
double arrowRotNeg = radial.Angle() - DEG2RAD( s_arrowAngle );
|
double arrowRotNeg = radial.Angle() - DEG2RAD( s_arrowAngle );
|
||||||
|
|
||||||
m_shapes.emplace_back( new SHAPE_SEGMENT( m_end,
|
m_shapes.emplace_back( new SHAPE_SEGMENT( m_end, m_end + arrowEnd.Rotate( arrowRotPos ) ) );
|
||||||
m_end + (wxPoint) arrowEnd.Rotate( arrowRotPos ) ) );
|
m_shapes.emplace_back( new SHAPE_SEGMENT( m_end, m_end + arrowEnd.Rotate( arrowRotNeg ) ) );
|
||||||
m_shapes.emplace_back( new SHAPE_SEGMENT( m_end,
|
|
||||||
m_end + (wxPoint) arrowEnd.Rotate( arrowRotNeg ) ) );
|
|
||||||
|
|
||||||
m_shapes.emplace_back( new SHAPE_SEGMENT( textSeg ) );
|
m_shapes.emplace_back( new SHAPE_SEGMENT( textSeg ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1536,7 +1536,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
||||||
for( SHAPE* shape : shapes )
|
for( SHAPE* shape : shapes )
|
||||||
{
|
{
|
||||||
STROKE_PARAMS::Stroke( shape, lineStyle, thickness, &m_pcbSettings,
|
STROKE_PARAMS::Stroke( shape, lineStyle, thickness, &m_pcbSettings,
|
||||||
[&]( const wxPoint& a, const wxPoint& b )
|
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||||
{
|
{
|
||||||
m_gal->DrawSegment( a, b, thickness );
|
m_gal->DrawSegment( a, b, thickness );
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -443,8 +443,8 @@ void BRDITEMS_PLOTTER::PlotDimension( const PCB_DIMENSION_BASE* aDim )
|
||||||
const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
|
const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
|
||||||
|
|
||||||
draw.SetShape( SHAPE_T::SEGMENT );
|
draw.SetShape( SHAPE_T::SEGMENT );
|
||||||
draw.SetStart( wxPoint( seg.A ) );
|
draw.SetStart( seg.A );
|
||||||
draw.SetEnd( wxPoint( seg.B ) );
|
draw.SetEnd( seg.B );
|
||||||
|
|
||||||
PlotPcbShape( &draw );
|
PlotPcbShape( &draw );
|
||||||
break;
|
break;
|
||||||
|
@ -452,13 +452,13 @@ void BRDITEMS_PLOTTER::PlotDimension( const PCB_DIMENSION_BASE* aDim )
|
||||||
|
|
||||||
case SH_CIRCLE:
|
case SH_CIRCLE:
|
||||||
{
|
{
|
||||||
wxPoint start( shape->Centre() );
|
VECTOR2I start( shape->Centre() );
|
||||||
int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
|
int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
|
||||||
|
|
||||||
draw.SetShape( SHAPE_T::CIRCLE );
|
draw.SetShape( SHAPE_T::CIRCLE );
|
||||||
draw.SetFilled( false );
|
draw.SetFilled( false );
|
||||||
draw.SetStart( start );
|
draw.SetStart( start );
|
||||||
draw.SetEnd( wxPoint( start.x + radius, start.y ) );
|
draw.SetEnd( VECTOR2I( start.x + radius, start.y ) );
|
||||||
|
|
||||||
PlotPcbShape( &draw );
|
PlotPcbShape( &draw );
|
||||||
break;
|
break;
|
||||||
|
@ -493,7 +493,7 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( const PCB_TARGET* aMire )
|
||||||
radius = aMire->GetSize() / 2;
|
radius = aMire->GetSize() / 2;
|
||||||
|
|
||||||
// Draw the circle
|
// Draw the circle
|
||||||
draw.SetEnd( wxPoint( draw.GetStart().x + radius, draw.GetStart().y ) );
|
draw.SetEnd( VECTOR2I( draw.GetStart().x + radius, draw.GetStart().y ) );
|
||||||
|
|
||||||
PlotPcbShape( &draw );
|
PlotPcbShape( &draw );
|
||||||
|
|
||||||
|
@ -512,15 +512,15 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( const PCB_TARGET* aMire )
|
||||||
dy2 = -dy1;
|
dy2 = -dy1;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint mirePos( aMire->GetPosition() );
|
VECTOR2I mirePos( aMire->GetPosition() );
|
||||||
|
|
||||||
// Draw the X or + shape:
|
// Draw the X or + shape:
|
||||||
draw.SetStart( wxPoint( mirePos.x - dx1, mirePos.y - dy1 ) );
|
draw.SetStart( VECTOR2I( mirePos.x - dx1, mirePos.y - dy1 ) );
|
||||||
draw.SetEnd( wxPoint( mirePos.x + dx1, mirePos.y + dy1 ) );
|
draw.SetEnd( VECTOR2I( mirePos.x + dx1, mirePos.y + dy1 ) );
|
||||||
PlotPcbShape( &draw );
|
PlotPcbShape( &draw );
|
||||||
|
|
||||||
draw.SetStart( wxPoint( mirePos.x - dx2, mirePos.y - dy2 ) );
|
draw.SetStart( VECTOR2I( mirePos.x - dx2, mirePos.y - dy2 ) );
|
||||||
draw.SetEnd( wxPoint( mirePos.x + dx2, mirePos.y + dy2 ) );
|
draw.SetEnd( VECTOR2I( mirePos.x + dx2, mirePos.y + dy2 ) );
|
||||||
PlotPcbShape( &draw );
|
PlotPcbShape( &draw );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -721,7 +721,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
|
||||||
for( SHAPE* shape : shapes )
|
for( SHAPE* shape : shapes )
|
||||||
{
|
{
|
||||||
STROKE_PARAMS::Stroke( shape, lineStyle, thickness, m_plotter->RenderSettings(),
|
STROKE_PARAMS::Stroke( shape, lineStyle, thickness, m_plotter->RenderSettings(),
|
||||||
[&]( const wxPoint& a, const wxPoint& b )
|
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||||
{
|
{
|
||||||
m_plotter->ThickSegment( a, b, thickness, GetPlotMode(),
|
m_plotter->ThickSegment( a, b, thickness, GetPlotMode(),
|
||||||
&gbr_metadata );
|
&gbr_metadata );
|
||||||
|
@ -856,8 +856,8 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( const ZONE* aZone, const SHAPE_POLY_SET&
|
||||||
|
|
||||||
if( outline.CPoint( 0 ) != outline.CPoint( last_idx ) )
|
if( outline.CPoint( 0 ) != outline.CPoint( last_idx ) )
|
||||||
{
|
{
|
||||||
m_plotter->ThickSegment( wxPoint( outline.CPoint( 0 ) ),
|
m_plotter->ThickSegment( VECTOR2I( outline.CPoint( 0 ) ),
|
||||||
wxPoint( outline.CPoint( last_idx ) ),
|
VECTOR2I( outline.CPoint( last_idx ) ),
|
||||||
outline_thickness, GetPlotMode(), &gbr_metadata );
|
outline_thickness, GetPlotMode(), &gbr_metadata );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -879,8 +879,8 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( const ZONE* aZone, const SHAPE_POLY_SET&
|
||||||
|
|
||||||
for( int jj = 1; jj <= last_idx; jj++ )
|
for( int jj = 1; jj <= last_idx; jj++ )
|
||||||
{
|
{
|
||||||
m_plotter->ThickSegment( wxPoint( outline.CPoint( jj - 1) ),
|
m_plotter->ThickSegment( VECTOR2I( outline.CPoint( jj - 1 ) ),
|
||||||
wxPoint( outline.CPoint( jj ) ),
|
VECTOR2I( outline.CPoint( jj ) ),
|
||||||
outline_thickness,
|
outline_thickness,
|
||||||
GetPlotMode(), &gbr_metadata );
|
GetPlotMode(), &gbr_metadata );
|
||||||
}
|
}
|
||||||
|
@ -888,8 +888,8 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( const ZONE* aZone, const SHAPE_POLY_SET&
|
||||||
// Ensure the outline is closed:
|
// Ensure the outline is closed:
|
||||||
if( outline.CPoint( 0 ) != outline.CPoint( last_idx ) )
|
if( outline.CPoint( 0 ) != outline.CPoint( last_idx ) )
|
||||||
{
|
{
|
||||||
m_plotter->ThickSegment( wxPoint( outline.CPoint( 0 ) ),
|
m_plotter->ThickSegment( VECTOR2I( outline.CPoint( 0 ) ),
|
||||||
wxPoint( outline.CPoint( last_idx ) ),
|
VECTOR2I( outline.CPoint( last_idx ) ),
|
||||||
outline_thickness,
|
outline_thickness,
|
||||||
GetPlotMode(), &gbr_metadata );
|
GetPlotMode(), &gbr_metadata );
|
||||||
}
|
}
|
||||||
|
@ -982,8 +982,8 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
|
||||||
for( auto it = aShape->GetPolyShape().CIterateSegments( 0 ); it; it++ )
|
for( auto it = aShape->GetPolyShape().CIterateSegments( 0 ); it; it++ )
|
||||||
{
|
{
|
||||||
auto seg = it.Get();
|
auto seg = it.Get();
|
||||||
m_plotter->ThickSegment( wxPoint( seg.A ), wxPoint( seg.B ),
|
m_plotter->ThickSegment( seg.A, seg.B, thickness, GetPlotMode(),
|
||||||
thickness, GetPlotMode(), &gbr_metadata );
|
&gbr_metadata );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1045,7 +1045,7 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
|
||||||
for( SHAPE* shape : shapes )
|
for( SHAPE* shape : shapes )
|
||||||
{
|
{
|
||||||
STROKE_PARAMS::Stroke( shape, lineStyle, thickness, m_plotter->RenderSettings(),
|
STROKE_PARAMS::Stroke( shape, lineStyle, thickness, m_plotter->RenderSettings(),
|
||||||
[&]( const wxPoint& a, const wxPoint& b )
|
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||||
{
|
{
|
||||||
m_plotter->ThickSegment( a, b, thickness, GetPlotMode(),
|
m_plotter->ThickSegment( a, b, thickness, GetPlotMode(),
|
||||||
&gbr_metadata );
|
&gbr_metadata );
|
||||||
|
|
|
@ -157,9 +157,9 @@ void altium_parse_polygons( std::map<wxString, wxString>& aProps,
|
||||||
const int32_t radius = ALTIUM_PARSER::ReadKicadUnit( aProps, "R" + si, "0mil" );
|
const int32_t radius = ALTIUM_PARSER::ReadKicadUnit( aProps, "R" + si, "0mil" );
|
||||||
const double sa = ALTIUM_PARSER::ReadDouble( aProps, "SA" + si, 0. );
|
const double sa = ALTIUM_PARSER::ReadDouble( aProps, "SA" + si, 0. );
|
||||||
const double ea = ALTIUM_PARSER::ReadDouble( aProps, "EA" + si, 0. );
|
const double ea = ALTIUM_PARSER::ReadDouble( aProps, "EA" + si, 0. );
|
||||||
const wxPoint vp = wxPoint( ALTIUM_PARSER::ReadKicadUnit( aProps, vxi, "0mil" ),
|
const VECTOR2I vp = VECTOR2I( ALTIUM_PARSER::ReadKicadUnit( aProps, vxi, "0mil" ),
|
||||||
-ALTIUM_PARSER::ReadKicadUnit( aProps, vyi, "0mil" ) );
|
-ALTIUM_PARSER::ReadKicadUnit( aProps, vyi, "0mil" ) );
|
||||||
const wxPoint cp = wxPoint( ALTIUM_PARSER::ReadKicadUnit( aProps, "CX" + si, "0mil" ),
|
const VECTOR2I cp = VECTOR2I( ALTIUM_PARSER::ReadKicadUnit( aProps, "CX" + si, "0mil" ),
|
||||||
-ALTIUM_PARSER::ReadKicadUnit( aProps, "CY" + si, "0mil" ) );
|
-ALTIUM_PARSER::ReadKicadUnit( aProps, "CY" + si, "0mil" ) );
|
||||||
|
|
||||||
aVertices.emplace_back( isRound, radius, sa, ea, vp, cp );
|
aVertices.emplace_back( isRound, radius, sa, ea, vp, cp );
|
||||||
|
@ -173,7 +173,7 @@ ABOARD6::ABOARD6( ALTIUM_PARSER& aReader )
|
||||||
if( props.empty() )
|
if( props.empty() )
|
||||||
THROW_IO_ERROR( "Board6 stream has no props!" );
|
THROW_IO_ERROR( "Board6 stream has no props!" );
|
||||||
|
|
||||||
sheetpos = wxPoint( ALTIUM_PARSER::ReadKicadUnit( props, "SHEETX", "0mil" ),
|
sheetpos = VECTOR2I( ALTIUM_PARSER::ReadKicadUnit( props, "SHEETX", "0mil" ),
|
||||||
-ALTIUM_PARSER::ReadKicadUnit( props, "SHEETY", "0mil" ) );
|
-ALTIUM_PARSER::ReadKicadUnit( props, "SHEETY", "0mil" ) );
|
||||||
sheetsize = wxSize( ALTIUM_PARSER::ReadKicadUnit( props, "SHEETWIDTH", "0mil" ),
|
sheetsize = wxSize( ALTIUM_PARSER::ReadKicadUnit( props, "SHEETWIDTH", "0mil" ),
|
||||||
ALTIUM_PARSER::ReadKicadUnit( props, "SHEETHEIGHT", "0mil" ) );
|
ALTIUM_PARSER::ReadKicadUnit( props, "SHEETHEIGHT", "0mil" ) );
|
||||||
|
@ -243,7 +243,7 @@ ACOMPONENT6::ACOMPONENT6( ALTIUM_PARSER& aReader )
|
||||||
THROW_IO_ERROR( "Components6 stream has no props" );
|
THROW_IO_ERROR( "Components6 stream has no props" );
|
||||||
|
|
||||||
layer = altium_layer_from_name( ALTIUM_PARSER::ReadString( props, "LAYER", "" ) );
|
layer = altium_layer_from_name( ALTIUM_PARSER::ReadString( props, "LAYER", "" ) );
|
||||||
position = wxPoint( ALTIUM_PARSER::ReadKicadUnit( props, "X", "0mil" ),
|
position = VECTOR2I( ALTIUM_PARSER::ReadKicadUnit( props, "X", "0mil" ),
|
||||||
-ALTIUM_PARSER::ReadKicadUnit( props, "Y", "0mil" ) );
|
-ALTIUM_PARSER::ReadKicadUnit( props, "Y", "0mil" ) );
|
||||||
rotation = ALTIUM_PARSER::ReadDouble( props, "ROTATION", 0. );
|
rotation = ALTIUM_PARSER::ReadDouble( props, "ROTATION", 0. );
|
||||||
locked = ALTIUM_PARSER::ReadBool( props, "LOCKED", false );
|
locked = ALTIUM_PARSER::ReadBool( props, "LOCKED", false );
|
||||||
|
@ -296,7 +296,7 @@ ADIMENSION6::ADIMENSION6( ALTIUM_PARSER& aReader )
|
||||||
|
|
||||||
wxString text_position_raw = ALTIUM_PARSER::ReadString( props, "TEXTPOSITION", "" );
|
wxString text_position_raw = ALTIUM_PARSER::ReadString( props, "TEXTPOSITION", "" );
|
||||||
|
|
||||||
xy1 = wxPoint( ALTIUM_PARSER::ReadKicadUnit( props, "X1", "0mil" ),
|
xy1 = VECTOR2I( ALTIUM_PARSER::ReadKicadUnit( props, "X1", "0mil" ),
|
||||||
-ALTIUM_PARSER::ReadKicadUnit( props, "Y1", "0mil" ) );
|
-ALTIUM_PARSER::ReadKicadUnit( props, "Y1", "0mil" ) );
|
||||||
|
|
||||||
int refcount = ALTIUM_PARSER::ReadInt( props, "REFERENCES_COUNT", 0 );
|
int refcount = ALTIUM_PARSER::ReadInt( props, "REFERENCES_COUNT", 0 );
|
||||||
|
@ -506,7 +506,7 @@ AARC6::AARC6( ALTIUM_PARSER& aReader )
|
||||||
subpolyindex = aReader.Read<uint16_t>();
|
subpolyindex = aReader.Read<uint16_t>();
|
||||||
component = aReader.Read<uint16_t>();
|
component = aReader.Read<uint16_t>();
|
||||||
aReader.Skip( 4 );
|
aReader.Skip( 4 );
|
||||||
center = aReader.ReadWxPoint();
|
center = aReader.ReadVector2I();
|
||||||
radius = aReader.ReadKicadUnit();
|
radius = aReader.ReadKicadUnit();
|
||||||
startangle = aReader.Read<double>();
|
startangle = aReader.Read<double>();
|
||||||
endangle = aReader.Read<double>();
|
endangle = aReader.Read<double>();
|
||||||
|
@ -616,7 +616,7 @@ APAD6::APAD6( ALTIUM_PARSER& aReader )
|
||||||
component = aReader.Read<uint16_t>();
|
component = aReader.Read<uint16_t>();
|
||||||
aReader.Skip( 4 );
|
aReader.Skip( 4 );
|
||||||
|
|
||||||
position = aReader.ReadWxPoint();
|
position = aReader.ReadVector2I();
|
||||||
topsize = aReader.ReadWxSize();
|
topsize = aReader.ReadWxSize();
|
||||||
midsize = aReader.ReadWxSize();
|
midsize = aReader.ReadWxSize();
|
||||||
botsize = aReader.ReadWxSize();
|
botsize = aReader.ReadWxSize();
|
||||||
|
@ -675,10 +675,10 @@ APAD6::APAD6( ALTIUM_PARSER& aReader )
|
||||||
sizeAndShape->slotsize = aReader.ReadKicadUnit();
|
sizeAndShape->slotsize = aReader.ReadKicadUnit();
|
||||||
sizeAndShape->slotrotation = aReader.Read<double>();
|
sizeAndShape->slotrotation = aReader.Read<double>();
|
||||||
|
|
||||||
for( wxPoint& pt : sizeAndShape->holeoffset )
|
for( VECTOR2I& pt : sizeAndShape->holeoffset )
|
||||||
pt.x = aReader.ReadKicadUnitX();
|
pt.x = aReader.ReadKicadUnitX();
|
||||||
|
|
||||||
for( wxPoint& pt : sizeAndShape->holeoffset )
|
for( VECTOR2I& pt : sizeAndShape->holeoffset )
|
||||||
pt.y = aReader.ReadKicadUnitY();
|
pt.y = aReader.ReadKicadUnitY();
|
||||||
|
|
||||||
aReader.Skip( 1 );
|
aReader.Skip( 1 );
|
||||||
|
@ -723,7 +723,7 @@ AVIA6::AVIA6( ALTIUM_PARSER& aReader )
|
||||||
|
|
||||||
net = aReader.Read<uint16_t>();
|
net = aReader.Read<uint16_t>();
|
||||||
aReader.Skip( 8 );
|
aReader.Skip( 8 );
|
||||||
position = aReader.ReadWxPoint();
|
position = aReader.ReadVector2I();
|
||||||
diameter = aReader.ReadKicadUnit();
|
diameter = aReader.ReadKicadUnit();
|
||||||
holesize = aReader.ReadKicadUnit();
|
holesize = aReader.ReadKicadUnit();
|
||||||
|
|
||||||
|
@ -769,8 +769,8 @@ ATRACK6::ATRACK6( ALTIUM_PARSER& aReader )
|
||||||
subpolyindex = aReader.Read<uint16_t>();
|
subpolyindex = aReader.Read<uint16_t>();
|
||||||
component = aReader.Read<uint16_t>();
|
component = aReader.Read<uint16_t>();
|
||||||
aReader.Skip( 4 );
|
aReader.Skip( 4 );
|
||||||
start = aReader.ReadWxPoint();
|
start = aReader.ReadVector2I();
|
||||||
end = aReader.ReadWxPoint();
|
end = aReader.ReadVector2I();
|
||||||
width = aReader.ReadKicadUnit();
|
width = aReader.ReadKicadUnit();
|
||||||
|
|
||||||
aReader.SkipSubrecord();
|
aReader.SkipSubrecord();
|
||||||
|
@ -793,7 +793,7 @@ ATEXT6::ATEXT6( ALTIUM_PARSER& aReader, std::map<uint32_t, wxString>& aStringTab
|
||||||
aReader.Skip( 6 );
|
aReader.Skip( 6 );
|
||||||
component = aReader.Read<uint16_t>();
|
component = aReader.Read<uint16_t>();
|
||||||
aReader.Skip( 4 );
|
aReader.Skip( 4 );
|
||||||
position = aReader.ReadWxPoint();
|
position = aReader.ReadVector2I();
|
||||||
height = aReader.ReadKicadUnit();
|
height = aReader.ReadKicadUnit();
|
||||||
aReader.Skip( 2 );
|
aReader.Skip( 2 );
|
||||||
rotation = aReader.Read<double>();
|
rotation = aReader.Read<double>();
|
||||||
|
@ -863,8 +863,8 @@ AFILL6::AFILL6( ALTIUM_PARSER& aReader )
|
||||||
aReader.Skip( 2 );
|
aReader.Skip( 2 );
|
||||||
component = aReader.Read<uint16_t>();
|
component = aReader.Read<uint16_t>();
|
||||||
aReader.Skip( 4 );
|
aReader.Skip( 4 );
|
||||||
pos1 = aReader.ReadWxPoint();
|
pos1 = aReader.ReadVector2I();
|
||||||
pos2 = aReader.ReadWxPoint();
|
pos2 = aReader.ReadVector2I();
|
||||||
rotation = aReader.Read<double>();
|
rotation = aReader.Read<double>();
|
||||||
|
|
||||||
aReader.SkipSubrecord();
|
aReader.SkipSubrecord();
|
||||||
|
@ -948,8 +948,8 @@ AREGION6::AREGION6( ALTIUM_PARSER& aReader, bool aExtendedVertices )
|
||||||
if( aExtendedVertices )
|
if( aExtendedVertices )
|
||||||
{
|
{
|
||||||
bool isRound = aReader.Read<uint8_t>() != 0;
|
bool isRound = aReader.Read<uint8_t>() != 0;
|
||||||
wxPoint position = aReader.ReadWxPoint();
|
VECTOR2I position = aReader.ReadVector2I();
|
||||||
wxPoint center = aReader.ReadWxPoint();
|
VECTOR2I center = aReader.ReadVector2I();
|
||||||
int32_t radius = aReader.ReadKicadUnit();
|
int32_t radius = aReader.ReadKicadUnit();
|
||||||
double angle1 = aReader.Read<double>();
|
double angle1 = aReader.Read<double>();
|
||||||
double angle2 = aReader.Read<double>();
|
double angle2 = aReader.Read<double>();
|
||||||
|
@ -960,7 +960,7 @@ AREGION6::AREGION6( ALTIUM_PARSER& aReader, bool aExtendedVertices )
|
||||||
// For some regions the coordinates are stored as double and not as int32_t
|
// For some regions the coordinates are stored as double and not as int32_t
|
||||||
int32_t x = ALTIUM_PARSER::ConvertToKicadUnit( aReader.Read<double>() );
|
int32_t x = ALTIUM_PARSER::ConvertToKicadUnit( aReader.Read<double>() );
|
||||||
int32_t y = ALTIUM_PARSER::ConvertToKicadUnit( -aReader.Read<double>() );
|
int32_t y = ALTIUM_PARSER::ConvertToKicadUnit( -aReader.Read<double>() );
|
||||||
outline.emplace_back( wxPoint( x, y ) );
|
outline.emplace_back( VECTOR2I( x, y ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ struct ALTIUM_VERTICE
|
||||||
const VECTOR2I position;
|
const VECTOR2I position;
|
||||||
const VECTOR2I center;
|
const VECTOR2I center;
|
||||||
|
|
||||||
explicit ALTIUM_VERTICE( const wxPoint& aPosition )
|
explicit ALTIUM_VERTICE( const VECTOR2I& aPosition )
|
||||||
: isRound( false ),
|
: isRound( false ),
|
||||||
radius( 0 ),
|
radius( 0 ),
|
||||||
startangle( 0. ),
|
startangle( 0. ),
|
||||||
|
@ -223,7 +223,7 @@ struct ALTIUM_VERTICE
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit ALTIUM_VERTICE( bool aIsRound, int32_t aRadius, double aStartAngle, double aEndAngle,
|
explicit ALTIUM_VERTICE( bool aIsRound, int32_t aRadius, double aStartAngle, double aEndAngle,
|
||||||
const wxPoint aPosition, const wxPoint aCenter )
|
const VECTOR2I aPosition, const VECTOR2I aCenter )
|
||||||
: isRound( aIsRound ),
|
: isRound( aIsRound ),
|
||||||
radius( aRadius ),
|
radius( aRadius ),
|
||||||
startangle( aStartAngle ),
|
startangle( aStartAngle ),
|
||||||
|
@ -345,7 +345,7 @@ struct ABOARD6_LAYER_STACKUP
|
||||||
|
|
||||||
struct ABOARD6
|
struct ABOARD6
|
||||||
{
|
{
|
||||||
wxPoint sheetpos;
|
VECTOR2I sheetpos;
|
||||||
wxSize sheetsize;
|
wxSize sheetsize;
|
||||||
|
|
||||||
int layercount;
|
int layercount;
|
||||||
|
@ -371,7 +371,7 @@ struct ACLASS6
|
||||||
struct ACOMPONENT6
|
struct ACOMPONENT6
|
||||||
{
|
{
|
||||||
ALTIUM_LAYER layer;
|
ALTIUM_LAYER layer;
|
||||||
wxPoint position;
|
VECTOR2I position;
|
||||||
double rotation;
|
double rotation;
|
||||||
bool locked;
|
bool locked;
|
||||||
bool nameon;
|
bool nameon;
|
||||||
|
@ -552,7 +552,7 @@ struct APAD6_SIZE_AND_SHAPE
|
||||||
|
|
||||||
wxSize inner_size[29];
|
wxSize inner_size[29];
|
||||||
ALTIUM_PAD_SHAPE inner_shape[29];
|
ALTIUM_PAD_SHAPE inner_shape[29];
|
||||||
wxPoint holeoffset[32];
|
VECTOR2I holeoffset[32];
|
||||||
ALTIUM_PAD_SHAPE_ALT alt_shape[32];
|
ALTIUM_PAD_SHAPE_ALT alt_shape[32];
|
||||||
uint8_t cornerradius[32];
|
uint8_t cornerradius[32];
|
||||||
};
|
};
|
||||||
|
@ -571,7 +571,7 @@ struct APAD6
|
||||||
uint16_t net;
|
uint16_t net;
|
||||||
uint16_t component;
|
uint16_t component;
|
||||||
|
|
||||||
wxPoint position;
|
VECTOR2I position;
|
||||||
wxSize topsize;
|
wxSize topsize;
|
||||||
wxSize midsize;
|
wxSize midsize;
|
||||||
wxSize botsize;
|
wxSize botsize;
|
||||||
|
@ -609,7 +609,7 @@ struct AVIA6
|
||||||
|
|
||||||
uint16_t net;
|
uint16_t net;
|
||||||
|
|
||||||
wxPoint position;
|
VECTOR2I position;
|
||||||
uint32_t diameter;
|
uint32_t diameter;
|
||||||
uint32_t holesize;
|
uint32_t holesize;
|
||||||
|
|
||||||
|
@ -631,8 +631,8 @@ struct ATRACK6
|
||||||
uint16_t component;
|
uint16_t component;
|
||||||
uint16_t subpolyindex;
|
uint16_t subpolyindex;
|
||||||
|
|
||||||
wxPoint start;
|
VECTOR2I start;
|
||||||
wxPoint end;
|
VECTOR2I end;
|
||||||
uint32_t width;
|
uint32_t width;
|
||||||
|
|
||||||
explicit ATRACK6( ALTIUM_PARSER& aReader );
|
explicit ATRACK6( ALTIUM_PARSER& aReader );
|
||||||
|
@ -643,7 +643,7 @@ struct ATEXT6
|
||||||
ALTIUM_LAYER layer;
|
ALTIUM_LAYER layer;
|
||||||
uint16_t component;
|
uint16_t component;
|
||||||
|
|
||||||
wxPoint position;
|
VECTOR2I position;
|
||||||
uint32_t height;
|
uint32_t height;
|
||||||
double rotation;
|
double rotation;
|
||||||
uint32_t strokewidth;
|
uint32_t strokewidth;
|
||||||
|
@ -673,8 +673,8 @@ struct AFILL6
|
||||||
uint16_t component;
|
uint16_t component;
|
||||||
uint16_t net;
|
uint16_t net;
|
||||||
|
|
||||||
wxPoint pos1;
|
VECTOR2I pos1;
|
||||||
wxPoint pos2;
|
VECTOR2I pos2;
|
||||||
double rotation;
|
double rotation;
|
||||||
|
|
||||||
explicit AFILL6( ALTIUM_PARSER& aReader );
|
explicit AFILL6( ALTIUM_PARSER& aReader );
|
||||||
|
|
|
@ -2360,10 +2360,10 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
||||||
int offsetX = aElem.topsize.x / 2 - offset;
|
int offsetX = aElem.topsize.x / 2 - offset;
|
||||||
int offsetY = aElem.topsize.y / 2 - offset;
|
int offsetY = aElem.topsize.y / 2 - offset;
|
||||||
|
|
||||||
wxPoint p11 = aElem.position + wxPoint( offsetX, offsetY );
|
VECTOR2I p11 = aElem.position + VECTOR2I( offsetX, offsetY );
|
||||||
wxPoint p12 = aElem.position + wxPoint( offsetX, -offsetY );
|
VECTOR2I p12 = aElem.position + VECTOR2I( offsetX, -offsetY );
|
||||||
wxPoint p22 = aElem.position + wxPoint( -offsetX, -offsetY );
|
VECTOR2I p22 = aElem.position + VECTOR2I( -offsetX, -offsetY );
|
||||||
wxPoint p21 = aElem.position + wxPoint( -offsetX, offsetY );
|
VECTOR2I p21 = aElem.position + VECTOR2I( -offsetX, offsetY );
|
||||||
|
|
||||||
shape->SetShape( SHAPE_T::POLY );
|
shape->SetShape( SHAPE_T::POLY );
|
||||||
shape->SetFilled( true );
|
shape->SetFilled( true );
|
||||||
|
@ -2375,7 +2375,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
||||||
shape->SetShape( SHAPE_T::CIRCLE );
|
shape->SetShape( SHAPE_T::CIRCLE );
|
||||||
shape->SetFilled( true );
|
shape->SetFilled( true );
|
||||||
shape->SetStart( aElem.position );
|
shape->SetStart( aElem.position );
|
||||||
shape->SetEnd( aElem.position - wxPoint( 0, aElem.topsize.x / 4 ) );
|
shape->SetEnd( aElem.position - VECTOR2I( 0, aElem.topsize.x / 4 ) );
|
||||||
shape->SetStroke( STROKE_PARAMS( aElem.topsize.x / 2, PLOT_DASH_TYPE::SOLID ) );
|
shape->SetStroke( STROKE_PARAMS( aElem.topsize.x / 2, PLOT_DASH_TYPE::SOLID ) );
|
||||||
}
|
}
|
||||||
else if( aElem.topsize.x < aElem.topsize.y )
|
else if( aElem.topsize.x < aElem.topsize.y )
|
||||||
|
@ -2450,14 +2450,14 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
|
||||||
shape->SetLayer( klayer );
|
shape->SetLayer( klayer );
|
||||||
shape->SetStroke( STROKE_PARAMS( 0 ) );
|
shape->SetStroke( STROKE_PARAMS( 0 ) );
|
||||||
|
|
||||||
wxPoint p11 = aElem.position + wxPoint( aElem.topsize.x / 2, aElem.topsize.y / 2 );
|
VECTOR2I p11 = aElem.position + wxPoint( aElem.topsize.x / 2, aElem.topsize.y / 2 );
|
||||||
wxPoint p12 = aElem.position + wxPoint( aElem.topsize.x / 2, -aElem.topsize.y / 2 );
|
VECTOR2I p12 = aElem.position + wxPoint( aElem.topsize.x / 2, -aElem.topsize.y / 2 );
|
||||||
wxPoint p22 = aElem.position + wxPoint( -aElem.topsize.x / 2, -aElem.topsize.y / 2 );
|
VECTOR2I p22 = aElem.position + wxPoint( -aElem.topsize.x / 2, -aElem.topsize.y / 2 );
|
||||||
wxPoint p21 = aElem.position + wxPoint( -aElem.topsize.x / 2, aElem.topsize.y / 2 );
|
VECTOR2I p21 = aElem.position + wxPoint( -aElem.topsize.x / 2, aElem.topsize.y / 2 );
|
||||||
|
|
||||||
int chamfer = std::min( aElem.topsize.x, aElem.topsize.y ) / 4;
|
int chamfer = std::min( aElem.topsize.x, aElem.topsize.y ) / 4;
|
||||||
wxPoint chamferX( chamfer, 0 );
|
VECTOR2I chamferX( chamfer, 0 );
|
||||||
wxPoint chamferY( 0, chamfer );
|
VECTOR2I chamferY( 0, chamfer );
|
||||||
|
|
||||||
shape->SetPolyPoints( { p11 - chamferX, p11 - chamferY, p12 + chamferY, p12 - chamferX,
|
shape->SetPolyPoints( { p11 - chamferX, p11 - chamferY, p12 + chamferY, p12 - chamferX,
|
||||||
p22 + chamferX, p22 + chamferY, p21 - chamferY, p21 + chamferX } );
|
p22 + chamferX, p22 + chamferY, p21 - chamferY, p21 + chamferX } );
|
||||||
|
|
|
@ -319,7 +319,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
||||||
|
|
||||||
// GPCB unit = 0.01 mils and Pcbnew 0.1.
|
// GPCB unit = 0.01 mils and Pcbnew 0.1.
|
||||||
double conv_unit = NEW_GPCB_UNIT_CONV;
|
double conv_unit = NEW_GPCB_UNIT_CONV;
|
||||||
wxPoint textPos;
|
VECTOR2I textPos;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxArrayString parameters;
|
wxArrayString parameters;
|
||||||
std::unique_ptr<FOOTPRINT> footprint = std::make_unique<FOOTPRINT>( nullptr );
|
std::unique_ptr<FOOTPRINT> footprint = std::make_unique<FOOTPRINT>( nullptr );
|
||||||
|
@ -383,12 +383,12 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
||||||
|
|
||||||
if( paramCnt == 14 )
|
if( paramCnt == 14 )
|
||||||
{
|
{
|
||||||
textPos = wxPoint( parseInt( parameters[8], conv_unit ),
|
textPos = VECTOR2I( parseInt( parameters[8], conv_unit ),
|
||||||
parseInt( parameters[9], conv_unit ) );
|
parseInt( parameters[9], conv_unit ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
textPos = wxPoint( parseInt( parameters[6], conv_unit ),
|
textPos = VECTOR2I( parseInt( parameters[6], conv_unit ),
|
||||||
parseInt( parameters[7], conv_unit ) );
|
parseInt( parameters[7], conv_unit ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,9 +465,9 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
||||||
|
|
||||||
FP_SHAPE* shape = new FP_SHAPE( footprint.get(), SHAPE_T::SEGMENT );
|
FP_SHAPE* shape = new FP_SHAPE( footprint.get(), SHAPE_T::SEGMENT );
|
||||||
shape->SetLayer( F_SilkS );
|
shape->SetLayer( F_SilkS );
|
||||||
shape->SetStart0( wxPoint( parseInt( parameters[2], conv_unit ),
|
shape->SetStart0( VECTOR2I( parseInt( parameters[2], conv_unit ),
|
||||||
parseInt( parameters[3], conv_unit ) ) );
|
parseInt( parameters[3], conv_unit ) ) );
|
||||||
shape->SetEnd0( wxPoint( parseInt( parameters[4], conv_unit ),
|
shape->SetEnd0( VECTOR2I( parseInt( parameters[4], conv_unit ),
|
||||||
parseInt( parameters[5], conv_unit ) ) );
|
parseInt( parameters[5], conv_unit ) ) );
|
||||||
shape->SetStroke( STROKE_PARAMS( parseInt( parameters[6], conv_unit ),
|
shape->SetStroke( STROKE_PARAMS( parseInt( parameters[6], conv_unit ),
|
||||||
PLOT_DASH_TYPE::SOLID ) );
|
PLOT_DASH_TYPE::SOLID ) );
|
||||||
|
@ -495,7 +495,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
||||||
int radius = ( parseInt( parameters[4], conv_unit ) +
|
int radius = ( parseInt( parameters[4], conv_unit ) +
|
||||||
parseInt( parameters[5], conv_unit ) ) / 2;
|
parseInt( parameters[5], conv_unit ) ) / 2;
|
||||||
|
|
||||||
wxPoint centre( parseInt( parameters[2], conv_unit ),
|
VECTOR2I centre( parseInt( parameters[2], conv_unit ),
|
||||||
parseInt( parameters[3], conv_unit ) );
|
parseInt( parameters[3], conv_unit ) );
|
||||||
|
|
||||||
shape->SetCenter0( centre );
|
shape->SetCenter0( centre );
|
||||||
|
@ -511,8 +511,8 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
||||||
shape->SetShape( SHAPE_T::CIRCLE );
|
shape->SetShape( SHAPE_T::CIRCLE );
|
||||||
|
|
||||||
// Calculate start point coordinate of arc
|
// Calculate start point coordinate of arc
|
||||||
wxPoint arcStart( radius, 0 );
|
VECTOR2I arcStart( radius, 0 );
|
||||||
RotatePoint( &arcStart, -start_angle );
|
RotatePoint( arcStart, -start_angle );
|
||||||
shape->SetStart0( arcStart + centre );
|
shape->SetStart0( arcStart + centre );
|
||||||
|
|
||||||
// Angle value is clockwise in gpcb and Pcbnew.
|
// Angle value is clockwise in gpcb and Pcbnew.
|
||||||
|
@ -565,7 +565,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
||||||
int y1 = parseInt( parameters[3], conv_unit );
|
int y1 = parseInt( parameters[3], conv_unit );
|
||||||
int y2 = parseInt( parameters[5], conv_unit );
|
int y2 = parseInt( parameters[5], conv_unit );
|
||||||
int width = parseInt( parameters[6], conv_unit );
|
int width = parseInt( parameters[6], conv_unit );
|
||||||
wxPoint delta( x2 - x1, y2 - y1 );
|
VECTOR2I delta( x2 - x1, y2 - y1 );
|
||||||
double angle = atan2( (double)delta.y, (double)delta.x );
|
double angle = atan2( (double)delta.y, (double)delta.x );
|
||||||
|
|
||||||
// Get the pad clearance and the solder mask clearance.
|
// Get the pad clearance and the solder mask clearance.
|
||||||
|
|
|
@ -301,7 +301,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
|
||||||
{
|
{
|
||||||
char offsetTxt[64];
|
char offsetTxt[64];
|
||||||
|
|
||||||
wxPoint offset( aPad->GetOffset().x, aPad->GetOffset().y );
|
VECTOR2I offset( aPad->GetOffset().x, aPad->GetOffset().y );
|
||||||
|
|
||||||
dsnOffset = mapPt( offset );
|
dsnOffset = mapPt( offset );
|
||||||
|
|
||||||
|
@ -500,7 +500,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
|
||||||
bool doChamfer = aPad->GetShape() == PAD_SHAPE::CHAMFERED_RECT;
|
bool doChamfer = aPad->GetShape() == PAD_SHAPE::CHAMFERED_RECT;
|
||||||
|
|
||||||
TransformRoundChamferedRectToPolygon(
|
TransformRoundChamferedRectToPolygon(
|
||||||
cornerBuffer, wxPoint( 0, 0 ), psize, 0, rradius, aPad->GetChamferRectRatio(),
|
cornerBuffer, VECTOR2I( 0, 0 ), psize, 0, rradius, aPad->GetChamferRectRatio(),
|
||||||
doChamfer ? aPad->GetChamferPositions() : 0, 0,
|
doChamfer ? aPad->GetChamferPositions() : 0, 0,
|
||||||
aBoard->GetDesignSettings().m_MaxError, ERROR_INSIDE );
|
aBoard->GetDesignSettings().m_MaxError, ERROR_INSIDE );
|
||||||
SHAPE_LINE_CHAIN& polygonal_shape = cornerBuffer.Outline( 0 );
|
SHAPE_LINE_CHAIN& polygonal_shape = cornerBuffer.Outline( 0 );
|
||||||
|
@ -549,7 +549,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
|
||||||
|
|
||||||
case PAD_SHAPE::CUSTOM:
|
case PAD_SHAPE::CUSTOM:
|
||||||
{
|
{
|
||||||
std::vector<wxPoint> polygonal_shape;
|
std::vector<VECTOR2I> polygonal_shape;
|
||||||
SHAPE_POLY_SET pad_shape;
|
SHAPE_POLY_SET pad_shape;
|
||||||
aPad->MergePrimitivesAsPolygon( &pad_shape );
|
aPad->MergePrimitivesAsPolygon( &pad_shape );
|
||||||
|
|
||||||
|
|
|
@ -482,13 +482,13 @@ bool TRACKS_CLEANER::mergeCollinearSegments( PCB_TRACK* aSeg1, PCB_TRACK* aSeg2
|
||||||
if( ( aSeg1->GetStart().x > aSeg1->GetEnd().x )
|
if( ( aSeg1->GetStart().x > aSeg1->GetEnd().x )
|
||||||
== ( aSeg1->GetStart().y > aSeg1->GetEnd().y ) )
|
== ( aSeg1->GetStart().y > aSeg1->GetEnd().y ) )
|
||||||
{
|
{
|
||||||
dummy_seg.SetStart( wxPoint( min_x, min_y ) );
|
dummy_seg.SetStart( VECTOR2I( min_x, min_y ) );
|
||||||
dummy_seg.SetEnd( wxPoint( max_x, max_y ) );
|
dummy_seg.SetEnd( VECTOR2I( max_x, max_y ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dummy_seg.SetStart( wxPoint( min_x, max_y ) );
|
dummy_seg.SetStart( VECTOR2I( min_x, max_y ) );
|
||||||
dummy_seg.SetEnd( wxPoint( max_x, min_y ) );
|
dummy_seg.SetEnd( VECTOR2I( max_x, min_y ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now find the removed end(s) and stop merging if it is a node:
|
// Now find the removed end(s) and stop merging if it is a node:
|
||||||
|
|
|
@ -516,12 +516,12 @@ void ZONE_FILLER::addKnockout( PAD* aPad, PCB_LAYER_ID aLayer, int aGap, SHAPE_P
|
||||||
// the pad shape in zone can be its convex hull or the shape itself
|
// the pad shape in zone can be its convex hull or the shape itself
|
||||||
if( aPad->GetCustomShapeInZoneOpt() == CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL )
|
if( aPad->GetCustomShapeInZoneOpt() == CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL )
|
||||||
{
|
{
|
||||||
std::vector<wxPoint> convex_hull;
|
std::vector<VECTOR2I> convex_hull;
|
||||||
BuildConvexHull( convex_hull, poly );
|
BuildConvexHull( convex_hull, poly );
|
||||||
|
|
||||||
aHoles.NewOutline();
|
aHoles.NewOutline();
|
||||||
|
|
||||||
for( const wxPoint& pt : convex_hull )
|
for( const VECTOR2I& pt : convex_hull )
|
||||||
aHoles.Append( pt );
|
aHoles.Append( pt );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE( Junctions )
|
||||||
for( int i = 0; i < 100; i++ )
|
for( int i = 0; i < 100; i++ )
|
||||||
{
|
{
|
||||||
SCH_JUNCTION* junction =
|
SCH_JUNCTION* junction =
|
||||||
new SCH_JUNCTION( wxPoint( Mils2iu( 100 ) * i, Mils2iu( 100 ) * i ) );
|
new SCH_JUNCTION( VECTOR2I( Mils2iu( 100 ) * i, Mils2iu( 100 ) * i ) );
|
||||||
m_tree.insert( junction );
|
m_tree.insert( junction );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,9 +127,9 @@ BOOST_AUTO_TEST_CASE( Junctions )
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL( count, 0 );
|
BOOST_CHECK_EQUAL( count, 0 );
|
||||||
|
|
||||||
EDA_RECT small_bbox( wxPoint( -1, -1 ), wxSize( Mils2iu( 2 ), Mils2iu( 2 ) ) );
|
EDA_RECT small_bbox( VECTOR2I( -1, -1 ), VECTOR2I( Mils2iu( 2 ), Mils2iu( 2 ) ) );
|
||||||
EDA_RECT med_bbox( wxPoint( 0, 0 ), wxSize( Mils2iu( 100 ), Mils2iu( 100 ) ) );
|
EDA_RECT med_bbox( VECTOR2I( 0, 0 ), VECTOR2I( Mils2iu( 100 ), Mils2iu( 100 ) ) );
|
||||||
EDA_RECT big_bbox( wxPoint( 0, 0 ), wxSize( Mils2iu( 5000 ), Mils2iu( 5000 ) ) );
|
EDA_RECT big_bbox( VECTOR2I( 0, 0 ), VECTOR2I( Mils2iu( 5000 ), Mils2iu( 5000 ) ) );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for( auto item : m_tree.Overlapping( small_bbox ) )
|
for( auto item : m_tree.Overlapping( small_bbox ) )
|
||||||
|
@ -188,11 +188,11 @@ BOOST_AUTO_TEST_CASE( MixedElements )
|
||||||
int y_sign = ( i % 3 == 0 ) ? -1 : 1;
|
int y_sign = ( i % 3 == 0 ) ? -1 : 1;
|
||||||
|
|
||||||
SCH_JUNCTION* junction = new SCH_JUNCTION(
|
SCH_JUNCTION* junction = new SCH_JUNCTION(
|
||||||
wxPoint( Mils2iu( 100 ) * i * x_sign, Mils2iu( 100 ) * i * y_sign ) );
|
VECTOR2I( Mils2iu( 100 ) * i * x_sign, Mils2iu( 100 ) * i * y_sign ) );
|
||||||
m_tree.insert( junction );
|
m_tree.insert( junction );
|
||||||
|
|
||||||
SCH_NO_CONNECT* nc = new SCH_NO_CONNECT(
|
SCH_NO_CONNECT* nc = new SCH_NO_CONNECT(
|
||||||
wxPoint( Mils2iu( 150 ) * i * y_sign, Mils2iu( 150 ) * i * x_sign ) );
|
VECTOR2I( Mils2iu( 150 ) * i * y_sign, Mils2iu( 150 ) * i * x_sign ) );
|
||||||
m_tree.insert( nc );
|
m_tree.insert( nc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ BOOST_AUTO_TEST_CASE( MixedElements )
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL( count, 100 );
|
BOOST_CHECK_EQUAL( count, 100 );
|
||||||
|
|
||||||
EDA_RECT small_bbox( wxPoint( -1, -1 ), wxSize( Mils2iu( 2 ), Mils2iu( 2 ) ) );
|
EDA_RECT small_bbox( VECTOR2I( -1, -1 ), VECTOR2I( Mils2iu( 2 ), Mils2iu( 2 ) ) );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for( auto item : m_tree.Overlapping( small_bbox ) )
|
for( auto item : m_tree.Overlapping( small_bbox ) )
|
||||||
|
@ -252,10 +252,10 @@ BOOST_AUTO_TEST_CASE( MixedElements )
|
||||||
// where the first case may or may not match
|
// where the first case may or may not match
|
||||||
BOOST_AUTO_TEST_CASE( SingleElementTree )
|
BOOST_AUTO_TEST_CASE( SingleElementTree )
|
||||||
{
|
{
|
||||||
SCH_JUNCTION* junction = new SCH_JUNCTION( wxPoint( Mils2iu( 100 ), Mils2iu( 100 ) ) );
|
SCH_JUNCTION* junction = new SCH_JUNCTION( VECTOR2I( Mils2iu( 100 ), Mils2iu( 100 ) ) );
|
||||||
m_tree.insert( junction );
|
m_tree.insert( junction );
|
||||||
|
|
||||||
SCH_NO_CONNECT* nc = new SCH_NO_CONNECT( wxPoint( Mils2iu( 150 ), Mils2iu( 150 ) ) );
|
SCH_NO_CONNECT* nc = new SCH_NO_CONNECT( VECTOR2I( Mils2iu( 150 ), Mils2iu( 150 ) ) );
|
||||||
m_tree.insert( nc );
|
m_tree.insert( nc );
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
Loading…
Reference in New Issue