Another batch of point changes

This commit is contained in:
Marek Roszko 2022-01-01 13:08:03 -05:00
parent d1552c3fec
commit ea613cf448
29 changed files with 262 additions and 264 deletions

View File

@ -233,9 +233,9 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
/* Test A : Any corners exist in rotated rect? */
corners[0] = m_pos;
corners[1] = m_pos + wxPoint( m_size.x, 0 );
corners[2] = m_pos + wxPoint( m_size.x, m_size.y );
corners[3] = m_pos + wxPoint( 0, m_size.y );
corners[1] = m_pos + VECTOR2I( m_size.x, 0 );
corners[2] = m_pos + VECTOR2I( m_size.x, m_size.y );
corners[3] = m_pos + VECTOR2I( 0, m_size.y );
VECTOR2I rCentre = aRect.Centre();
@ -256,10 +256,10 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
int h = aRect.GetHeight() / 2;
// Construct corners around center of shape
corners[0] = wxPoint( -w, -h );
corners[1] = wxPoint( w, -h );
corners[2] = wxPoint( w, h );
corners[3] = wxPoint( -w, h );
corners[0] = VECTOR2I( -w, -h );
corners[1] = VECTOR2I( w, -h );
corners[2] = VECTOR2I( w, h );
corners[3] = VECTOR2I( -w, h );
// Rotate and test each corner
for( int j = 0; j < 4; j++ )

View File

@ -29,6 +29,7 @@
#include <memory>
#include <wx/gdicmn.h>
#include <math/vector2d.h>
#include <vector>
@ -144,7 +145,7 @@ public:
return -ReadKicadUnit();
}
wxPoint ReadWxPoint()
VECTOR2I ReadVector2I()
{
int32_t x = ReadKicadUnitX();
int32_t y = ReadKicadUnitY();

View File

@ -34,7 +34,7 @@ using namespace STROKEPARAMS_T;
void STROKE_PARAMS::Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int aWidth,
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 };
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 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();
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 ) );
// Drawing each segment can be done rounded to ints.
wxPoint a( KiROUND( start.x ), KiROUND( start.y ) );
wxPoint b( KiROUND( next.x ), KiROUND( next.y ) );
VECTOR2I a( KiROUND( start.x ), KiROUND( start.y ) );
VECTOR2I b( KiROUND( next.x ), KiROUND( next.y ) );
if( ClipLine( &clip, a.x, a.y, b.x, b.y ) )
break;
@ -151,10 +151,10 @@ void STROKE_PARAMS::Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int
if( i % 2 == 0 )
{
wxPoint a( center.x + r * cos( 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 ),
center.y + r * sin( endAngle * M_PI / 180.0 ) );
VECTOR2I a( center.x + r * cos( startAngle * M_PI / 180.0 ),
center.y + r * sin( startAngle * M_PI / 180.0 ) );
VECTOR2I b( center.x + r * cos( endAngle * M_PI / 180.0 ),
center.y + r * sin( endAngle * M_PI / 180.0 ) );
aStroker( a, b );
}

View File

@ -85,7 +85,7 @@ template<typename T> T round_n( const T& value, const T& n, bool aRoundUp )
class AUTOPLACER
{
public:
typedef wxPoint SIDE;
typedef VECTOR2I SIDE;
static const SIDE SIDE_TOP, SIDE_BOTTOM, SIDE_LEFT, SIDE_RIGHT;
enum COLLISION { COLLIDE_NONE, COLLIDE_OBJECTS, COLLIDE_H_WIRES };
@ -138,7 +138,7 @@ public:
bool force_wire_spacing = false;
SIDE_AND_NPINS sideandpins = chooseSideForFields( aManual );
SIDE field_side = sideandpins.side;
wxPoint fbox_pos = fieldBoxPlacement( sideandpins );
VECTOR2I fbox_pos = fieldBoxPlacement( sideandpins );
EDA_RECT field_box( fbox_pos, m_fbox_size );
if( aManual )
@ -166,8 +166,9 @@ public:
}
}
wxPoint pos( fieldHorizPlacement( field, field_box ),
fieldVertPlacement( field, field_box, &last_y_coord, !force_wire_spacing ) );
VECTOR2I pos(
fieldHorizPlacement( field, field_box ),
fieldVertPlacement( field, field_box, &last_y_coord, !force_wire_spacing ) );
if( m_align_to_grid )
{
@ -482,7 +483,7 @@ protected:
std::vector<SIDE_AND_NPINS> sides = getPreferredSides();
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 )
{
@ -525,7 +526,7 @@ protected:
/**
* 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();
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 );
auto getPinsBox =
[&]( const wxPoint& aSide )
[&]( const VECTOR2I& aSide )
{
EDA_RECT pinsBox;
@ -573,7 +574,7 @@ protected:
}
}
return wxPoint( x, y );
return VECTOR2I( x, y );
}
/**

View File

@ -283,7 +283,7 @@ void SCH_BUS_ENTRY_BASE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I
SHAPE_SEGMENT segment( start, end );
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 );
} );

View File

@ -387,7 +387,7 @@ void SCH_LINE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset )
SHAPE_SEGMENT segment( start, end );
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 );
} );

View File

@ -180,10 +180,10 @@ void SCH_NO_CONNECT::Plot( PLOTTER* aPlotter ) const
aPlotter->SetCurrentLineWidth( penWidth );
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_NOCONNECT ) );
aPlotter->MoveTo( wxPoint( pX - delta, pY - delta ) );
aPlotter->FinishTo( wxPoint( pX + delta, pY + delta ) );
aPlotter->MoveTo( wxPoint( pX + delta, pY - delta ) );
aPlotter->FinishTo( wxPoint( pX - delta, pY + delta ) );
aPlotter->MoveTo( VECTOR2I( pX - delta, pY - delta ) );
aPlotter->FinishTo( VECTOR2I( pX + delta, pY + delta ) );
aPlotter->MoveTo( VECTOR2I( pX + delta, pY - delta ) );
aPlotter->FinishTo( VECTOR2I( pX - delta, pY + delta ) );
}

View File

@ -870,15 +870,15 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseArc()
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as an arc." ) );
T token;
wxPoint startPoint( 1, 0 ); // Initialize to a non-degenerate arc just for safety
wxPoint midPoint( 1, 1 );
wxPoint endPoint( 0, 1 );
VECTOR2I startPoint( 1, 0 ); // Initialize to a non-degenerate arc just for safety
VECTOR2I midPoint( 1, 1 );
VECTOR2I endPoint( 0, 1 );
bool hasMidPoint = false;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
// Parameters for legacy format
wxPoint center( 0, 0 );
VECTOR2I center( 0, 0 );
int startAngle = 0;
int endAngle = 900;
bool hasAngles = false;
@ -972,7 +972,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseArc()
if( hasMidPoint )
{
arc->SetCenter( (wxPoint) CalcArcCenter( arc->GetStart(), midPoint, arc->GetEnd() ) );
arc->SetCenter( CalcArcCenter( arc->GetStart(), midPoint, arc->GetEnd() ) );
}
else if( hasAngles )
{
@ -1079,7 +1079,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseCircle()
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a circle." ) );
T token;
wxPoint center( 0, 0 );
VECTOR2I center( 0, 0 );
int radius = 1; // defaulting to 0 could result in troublesome math....
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
@ -1125,7 +1125,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseCircle()
}
circle->SetCenter( center );
circle->SetEnd( wxPoint( center.x + radius, center.y ) );
circle->SetEnd( VECTOR2I( center.x + radius, center.y ) );
return circle.release();
}
@ -1751,7 +1751,7 @@ SCH_SHEET_PIN* SCH_SEXPR_PARSER::parseSchSheetPin( SCH_SHEET* aSheet )
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();
@ -2753,7 +2753,7 @@ SCH_LINE* SCH_SEXPR_PARSER::parseLine()
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() )
{
@ -2810,10 +2810,10 @@ SCH_SHAPE* SCH_SEXPR_PARSER::parseSchArc()
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as an arc." ) );
T token;
wxPoint startPoint;
wxPoint midPoint;
wxPoint endPoint;
wxPoint pos;
VECTOR2I startPoint;
VECTOR2I midPoint;
VECTOR2I endPoint;
VECTOR2I pos;
int startAngle;
int endAngle;
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() );
arc->SetCenter( (wxPoint) center );
arc->SetCenter( center );
}
else if( hasAngles )
{
@ -2946,7 +2946,7 @@ SCH_SHAPE* SCH_SEXPR_PARSER::parseSchCircle()
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a circle." ) );
T token;
wxPoint center;
VECTOR2I center;
int radius = 0;
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
FILL_PARAMS fill;
@ -2994,7 +2994,7 @@ SCH_SHAPE* SCH_SEXPR_PARSER::parseSchCircle()
}
circle->SetCenter( center );
circle->SetEnd( wxPoint( center.x + radius, center.y ) );
circle->SetEnd( VECTOR2I( center.x + radius, center.y ) );
return circle.release();
}

View File

@ -1028,7 +1028,7 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
{
if( strCompare( "S", line, &line ) ) // Sheet dimensions.
{
wxPoint position;
VECTOR2I position;
position.x = 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 );
}
wxPoint position;
VECTOR2I position;
position.x = 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 ) )
{
wxPoint position;
VECTOR2I position;
position.x = 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 );
wxPoint position;
VECTOR2I position;
position.x = 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 );
wxPoint position;
VECTOR2I position;
position.x = 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:
line = aReader.ReadLine();
wxPoint begin, end;
VECTOR2I begin, end;
begin.x = 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();
wxPoint pos;
VECTOR2I pos;
wxSize size;
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 );
// Parse the parameters common to all text objects.
wxPoint position;
VECTOR2I position;
position.x = 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 ) )
{
wxPoint pos;
VECTOR2I pos;
pos.x = 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 );
char orientation = parseChar( aReader, line, &line );
wxPoint pos;
VECTOR2I pos;
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
pos.y = 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.
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 );
}
@ -3079,7 +3079,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr<LIB_SYMBOL>& aSymbol,
else
field->SetText( ConvertToNewOverbarNotation( text ) );
wxPoint pos;
VECTOR2I pos;
pos.x = 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 );
wxPoint center;
VECTOR2I center;
center.x = 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 ) );
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->SetConvert( 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 ) );
wxPoint center;
VECTOR2I center;
center.x = 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 );
wxPoint pos;
VECTOR2I pos;
pos.x = Mils2Iu( parseInt( aReader, line, &line ) );
pos.y = Mils2Iu( parseInt( aReader, line, &line ) );
rectangle->SetPosition( pos );
wxPoint end;
VECTOR2I end;
end.x = 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;
long num;
wxPoint position;
VECTOR2I position;
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 ) ),
PLOT_DASH_TYPE::SOLID ) );
wxPoint pt;
VECTOR2I pt;
for( int i = 0; i < points; i++ )
{
@ -3749,17 +3749,17 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadBezier( std::unique_ptr<LIB_SYMBOL>& aSy
bezier->SetStroke( STROKE_PARAMS( Mils2Iu( parseInt( aReader, line, &line ) ),
PLOT_DASH_TYPE::SOLID ) );
bezier->SetStart( wxPoint( Mils2Iu( parseInt( aReader, line, &line ) ),
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
bezier->SetStart( VECTOR2I( Mils2Iu( parseInt( aReader, line, &line ) ),
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
bezier->SetBezierC1( wxPoint( Mils2Iu( parseInt( aReader, line, &line ) ),
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
bezier->SetBezierC1( VECTOR2I( Mils2Iu( parseInt( aReader, line, &line ) ),
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
bezier->SetBezierC2( wxPoint( Mils2Iu( parseInt( aReader, line, &line ) ),
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
bezier->SetBezierC2( VECTOR2I( Mils2Iu( parseInt( aReader, line, &line ) ),
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
bezier->SetEnd( wxPoint( Mils2Iu( parseInt( aReader, line, &line ) ),
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
bezier->SetEnd( VECTOR2I( Mils2Iu( parseInt( aReader, line, &line ) ),
Mils2Iu( parseInt( aReader, line, &line ) ) ) );
bezier->RebuildBezierToSegmentsPointsList( bezier->GetWidth() );

View File

@ -61,13 +61,13 @@ void SCH_SHAPE::Move( const VECTOR2I& aOffset )
void SCH_SHAPE::MirrorHorizontally( int aCenter )
{
flip( wxPoint( aCenter, 0 ), true );
flip( VECTOR2I( aCenter, 0 ), true );
}
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 endAngle = 0;
static std::vector<wxPoint> cornerList;
static std::vector<VECTOR2I> cornerList;
if( GetShape() == SHAPE_T::POLY )
{
cornerList.clear();
for( const VECTOR2I& pt : m_poly.Outline( 0 ).CPoints() )
cornerList.push_back( (wxPoint) pt );
cornerList.push_back( pt );
}
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];
for( unsigned ii = 0; ii < ptCount; ++ii )
buffer[ii] = (wxPoint) poly.CPoint( ii );
buffer[ii] = poly.CPoint( ii );
}
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 )
{
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 );
} );

View File

@ -84,9 +84,9 @@
// 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)
// 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;
end.x = double(aEnd.x - aStart.x);
end.y = double(aEnd.y - aStart.y);
@ -161,22 +161,26 @@ extern double ReadDouble( char*& text, bool aSkipSeparator = true );
extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
APERTURE_T aAperture,
int Dcode_index,
const wxPoint& aPos,
const VECTOR2I& aPos,
wxSize aSize,
bool aLayerNegative );
extern void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
int Dcode_index,
const wxPoint& aStart,
const wxPoint& aEnd,
wxSize aPenSize,
bool aLayerNegative );
extern void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
int Dcode_index,
const VECTOR2I& aStart,
const VECTOR2I& aEnd,
wxSize aPenSize,
bool aLayerNegative );
extern void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index,
const wxPoint& aStart, const wxPoint& aEnd,
const wxPoint& aRelCenter, wxSize aPenSize,
bool aClockwise, bool aMultiquadrant,
bool aLayerNegative );
extern void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
int Dcode_index,
const VECTOR2I& aStart,
const VECTOR2I& aEnd,
const VECTOR2I& aRelCenter,
wxSize aPenSize,
bool aClockwise,
bool aMultiquadrant,
bool aLayerNegative );
// Gerber X2 files have a file attribute which specify the type of image
// (copper, solder paste ... and sides tpo, bottom or inner copper layers)
@ -1011,10 +1015,10 @@ void EXCELLON_IMAGE::FinishRouteCommand()
{
bool rot_ccw = m_RoutePositions[ii].m_rmode == ROUTE_CW;
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 )
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
center = computeCenter( m_RoutePositions[ii-1].GetPos(),
m_RoutePositions[ii].GetPos(), radius, rot_ccw );

View File

@ -99,7 +99,7 @@
void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
APERTURE_T aAperture,
int Dcode_index,
const wxPoint& aPos,
const VECTOR2I& aPos,
wxSize aSize,
bool aLayerNegative )
{
@ -152,8 +152,8 @@ void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
*/
void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
int Dcode_index,
const wxPoint& aStart,
const wxPoint& aEnd,
const VECTOR2I& aStart,
const VECTOR2I& aEnd,
wxSize aPenSize,
bool aLayerNegative )
{
@ -199,11 +199,11 @@ void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
* false when arc is inside one quadrant
* @param aLayerNegative set to true if the current layer is negative.
*/
void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, const wxPoint& aStart,
const wxPoint& aEnd, const wxPoint& aRelCenter, wxSize aPenSize,
bool aClockwise, bool aMultiquadrant, bool aLayerNegative )
void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, const VECTOR2I& aStart,
const VECTOR2I& aEnd, const VECTOR2I& aRelCenter, wxSize aPenSize,
bool aClockwise, bool aMultiquadrant, bool aLayerNegative )
{
wxPoint center, delta;
VECTOR2I center, delta;
aGbrItem->m_Shape = GBR_ARC;
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
* @param aLayerNegative set to true if the current layer is negative
*/
static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem, const wxPoint& aStart, const wxPoint& aEnd,
const wxPoint& rel_center, bool aClockwise, bool aMultiquadrant,
static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem, const VECTOR2I& aStart, const VECTOR2I& aEnd,
const VECTOR2I& rel_center, bool aClockwise, bool aMultiquadrant,
bool aLayerNegative )
{
/* in order to calculate arc parameters, we use fillArcGBRITEM

View File

@ -252,7 +252,7 @@ public:
/**
* 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.
*/
std::vector<VECTOR2I> TransformToSegmentList() const;
@ -276,7 +276,7 @@ public:
/**
* 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.
* @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
* 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.
*/
void GetLinePositions( std::vector<VECTOR2I>& aPositions, int aLineCount ) const;

View File

@ -77,7 +77,7 @@ public:
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 );
@ -105,9 +105,9 @@ public:
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.
*/
bool HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) const;

View File

@ -115,7 +115,7 @@ public:
static void Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int aWidth,
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:
int m_width;

View File

@ -27,8 +27,8 @@
#include <vector>
#include <math/vector2d.h>
class wxPoint; // Defined in wxWidgets
class SHAPE_POLY_SET;
/**
@ -38,7 +38,7 @@ class SHAPE_POLY_SET;
* @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.
@ -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 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.
@ -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 aRotation is the rotation of the convex hull.
*/
void BuildConvexHull( std::vector<wxPoint>& aResult, const SHAPE_POLY_SET& aPolygons,
const wxPoint& aPosition, double aRotation );
void BuildConvexHull( std::vector<VECTOR2I>& aResult, const SHAPE_POLY_SET& aPolygons,
const VECTOR2I& aPosition, double aRotation );
#endif // __CONVEX_HULL_H

View File

@ -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.
// 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);
}
@ -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.
// Returns a positive value, if OAB makes a counter-clockwise turn,
// 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)
- (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.
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();
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,
const wxPoint& aPosition, double aRotation )
void BuildConvexHull( std::vector<VECTOR2I>& aResult, const SHAPE_POLY_SET& aPolygons,
const VECTOR2I& aPosition, double aRotation )
{
// 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++ )
{
@ -157,7 +157,7 @@ void BuildConvexHull( std::vector<wxPoint>& aResult, const SHAPE_POLY_SET& aPoly
for( unsigned ii = 0; ii < aResult.size(); ii++ )
{
RotatePoint( &aResult[ii], aRotation );
RotatePoint( aResult[ii], aRotation );
aResult[ii] += aPosition;
}
}

View File

@ -919,13 +919,13 @@ SHAPE_POLY_SET FOOTPRINT::GetBoundingHull() const
rawPolys.Append( GetPosition().x - halfsize, GetPosition().y + halfsize );
}
std::vector<wxPoint> convex_hull;
std::vector<VECTOR2I> convex_hull;
BuildConvexHull( convex_hull, rawPolys );
m_cachedHull.RemoveAllContours();
m_cachedHull.NewOutline();
for( const wxPoint& pt : convex_hull )
for( const VECTOR2I& pt : convex_hull )
m_cachedHull.Append( pt );
if( board )

View File

@ -499,14 +499,14 @@ void PCB_DIMENSION_BASE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& a
if( circle )
{
TransformCircleToPolygon( aCornerBuffer, (wxPoint) circle->GetCenter(),
TransformCircleToPolygon( aCornerBuffer, circle->GetCenter(),
circle->GetRadius() + m_lineThickness / 2 + aClearance,
aError, aErrorLoc );
}
else if( seg )
{
TransformOvalToPolygon( aCornerBuffer, (wxPoint) seg->GetSeg().A,
(wxPoint) seg->GetSeg().B, m_lineThickness + 2 * aClearance,
TransformOvalToPolygon( aCornerBuffer, seg->GetSeg().A,
seg->GetSeg().B, m_lineThickness + 2 * aClearance,
aError, aErrorLoc );
}
else
@ -596,8 +596,8 @@ void PCB_DIM_ALIGNED::updateGeometry()
// Add crossbar
VECTOR2I crossBarDistance = sign( m_height ) * extension.Resize( m_height );
m_crossBarStart = m_start + wxPoint( crossBarDistance );
m_crossBarEnd = m_end + wxPoint( crossBarDistance );
m_crossBarStart = m_start + crossBarDistance;
m_crossBarEnd = m_end + crossBarDistance;
// Update text after calculating crossbar position but before adding crossbar lines
updateText();
@ -641,16 +641,16 @@ void PCB_DIM_ALIGNED::updateGeometry()
double arrowRotNeg = dimension.Angle() - DEG2RAD( s_arrowAngle );
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_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) );
m_crossBarStart + arrowEnd.Rotate( arrowRotNeg ) ) );
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_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 );
textOffset += crossbarCenter;
m_text.SetTextPos( m_crossBarStart + wxPoint( textOffset ) );
m_text.SetTextPos( m_crossBarStart + textOffset );
}
else if( m_textPosition == DIM_TEXT_POSITION::INLINE )
{
m_text.SetTextPos( m_crossBarStart + wxPoint( crossbarCenter ) );
m_text.SetTextPos( m_crossBarStart + crossbarCenter );
}
if( m_keepTextAligned )
@ -762,12 +762,12 @@ void PCB_DIM_ORTHOGONAL::updateGeometry()
// Add crossbar
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 )
m_crossBarEnd = wxPoint( m_end.x, m_crossBarStart.y );
m_crossBarEnd = VECTOR2I( m_end.x, m_crossBarStart.y );
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)
if( m_orientation == DIR::HORIZONTAL )
@ -824,17 +824,13 @@ void PCB_DIM_ORTHOGONAL::updateGeometry()
double arrowRotPos = crossBarAngle.Angle() + DEG2RAD( s_arrowAngle );
double arrowRotNeg = crossBarAngle.Angle() - DEG2RAD( s_arrowAngle );
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart,
m_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart, m_crossBarStart + arrowEnd.Rotate( arrowRotPos ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart,
m_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart, m_crossBarStart + arrowEnd.Rotate( arrowRotNeg ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd,
m_crossBarEnd - wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd, m_crossBarEnd - arrowEnd.Rotate( arrowRotPos ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd,
m_crossBarEnd - wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd, m_crossBarEnd - arrowEnd.Rotate( arrowRotNeg ) ) );
}
@ -855,11 +851,11 @@ void PCB_DIM_ORTHOGONAL::updateText()
textOffset += crossbarCenter;
m_text.SetTextPos( m_crossBarStart + wxPoint( textOffset ) );
m_text.SetTextPos( m_crossBarStart + textOffset );
}
else if( m_textPosition == DIM_TEXT_POSITION::INLINE )
{
m_text.SetTextPos( m_crossBarStart + wxPoint( crossbarCenter ) );
m_text.SetTextPos( m_crossBarStart + crossbarCenter );
}
if( m_keepTextAligned )
@ -1023,10 +1019,8 @@ void PCB_DIM_LEADER::updateGeometry()
double arrowRotPos = firstLine.Angle() + DEG2RAD( s_arrowAngle );
double arrowRotNeg = firstLine.Angle() - DEG2RAD( s_arrowAngle );
m_shapes.emplace_back( new SHAPE_SEGMENT( start,
start + (wxPoint) arrowEnd.Rotate( arrowRotPos ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( start,
start + (wxPoint) arrowEnd.Rotate( arrowRotNeg ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( start, start + arrowEnd.Rotate( arrowRotPos ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( start, start + arrowEnd.Rotate( arrowRotNeg ) ) );
if( !GetText().IsEmpty() )
@ -1183,7 +1177,7 @@ void PCB_DIM_RADIAL::updateGeometry()
VECTOR2I radial( m_end - m_start );
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() );
OPT_VECTOR2I arrowSegEnd = segPolyIntersection( polyBox, arrowSeg );
@ -1203,10 +1197,8 @@ void PCB_DIM_RADIAL::updateGeometry()
double arrowRotPos = radial.Angle() + DEG2RAD( s_arrowAngle );
double arrowRotNeg = radial.Angle() - DEG2RAD( s_arrowAngle );
m_shapes.emplace_back( new SHAPE_SEGMENT( m_end,
m_end + (wxPoint) arrowEnd.Rotate( arrowRotPos ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( m_end,
m_end + (wxPoint) arrowEnd.Rotate( arrowRotNeg ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( m_end, m_end + arrowEnd.Rotate( arrowRotPos ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( m_end, m_end + arrowEnd.Rotate( arrowRotNeg ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( textSeg ) );
}

View File

@ -1536,7 +1536,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
for( SHAPE* shape : shapes )
{
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 );
} );

View File

@ -443,8 +443,8 @@ void BRDITEMS_PLOTTER::PlotDimension( const PCB_DIMENSION_BASE* aDim )
const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
draw.SetShape( SHAPE_T::SEGMENT );
draw.SetStart( wxPoint( seg.A ) );
draw.SetEnd( wxPoint( seg.B ) );
draw.SetStart( seg.A );
draw.SetEnd( seg.B );
PlotPcbShape( &draw );
break;
@ -452,13 +452,13 @@ void BRDITEMS_PLOTTER::PlotDimension( const PCB_DIMENSION_BASE* aDim )
case SH_CIRCLE:
{
wxPoint start( shape->Centre() );
VECTOR2I start( shape->Centre() );
int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
draw.SetShape( SHAPE_T::CIRCLE );
draw.SetFilled( false );
draw.SetStart( start );
draw.SetEnd( wxPoint( start.x + radius, start.y ) );
draw.SetEnd( VECTOR2I( start.x + radius, start.y ) );
PlotPcbShape( &draw );
break;
@ -493,7 +493,7 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( const PCB_TARGET* aMire )
radius = aMire->GetSize() / 2;
// 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 );
@ -512,15 +512,15 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( const PCB_TARGET* aMire )
dy2 = -dy1;
}
wxPoint mirePos( aMire->GetPosition() );
VECTOR2I mirePos( aMire->GetPosition() );
// Draw the X or + shape:
draw.SetStart( wxPoint( mirePos.x - dx1, mirePos.y - dy1 ) );
draw.SetEnd( wxPoint( mirePos.x + dx1, mirePos.y + dy1 ) );
draw.SetStart( VECTOR2I( mirePos.x - dx1, mirePos.y - dy1 ) );
draw.SetEnd( VECTOR2I( mirePos.x + dx1, mirePos.y + dy1 ) );
PlotPcbShape( &draw );
draw.SetStart( wxPoint( mirePos.x - dx2, mirePos.y - dy2 ) );
draw.SetEnd( wxPoint( mirePos.x + dx2, mirePos.y + dy2 ) );
draw.SetStart( VECTOR2I( mirePos.x - dx2, mirePos.y - dy2 ) );
draw.SetEnd( VECTOR2I( mirePos.x + dx2, mirePos.y + dy2 ) );
PlotPcbShape( &draw );
}
@ -721,7 +721,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
for( SHAPE* shape : shapes )
{
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(),
&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 ) )
{
m_plotter->ThickSegment( wxPoint( outline.CPoint( 0 ) ),
wxPoint( outline.CPoint( last_idx ) ),
m_plotter->ThickSegment( VECTOR2I( outline.CPoint( 0 ) ),
VECTOR2I( outline.CPoint( last_idx ) ),
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++ )
{
m_plotter->ThickSegment( wxPoint( outline.CPoint( jj - 1) ),
wxPoint( outline.CPoint( jj ) ),
m_plotter->ThickSegment( VECTOR2I( outline.CPoint( jj - 1 ) ),
VECTOR2I( outline.CPoint( jj ) ),
outline_thickness,
GetPlotMode(), &gbr_metadata );
}
@ -888,8 +888,8 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( const ZONE* aZone, const SHAPE_POLY_SET&
// Ensure the outline is closed:
if( outline.CPoint( 0 ) != outline.CPoint( last_idx ) )
{
m_plotter->ThickSegment( wxPoint( outline.CPoint( 0 ) ),
wxPoint( outline.CPoint( last_idx ) ),
m_plotter->ThickSegment( VECTOR2I( outline.CPoint( 0 ) ),
VECTOR2I( outline.CPoint( last_idx ) ),
outline_thickness,
GetPlotMode(), &gbr_metadata );
}
@ -982,8 +982,8 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
for( auto it = aShape->GetPolyShape().CIterateSegments( 0 ); it; it++ )
{
auto seg = it.Get();
m_plotter->ThickSegment( wxPoint( seg.A ), wxPoint( seg.B ),
thickness, GetPlotMode(), &gbr_metadata );
m_plotter->ThickSegment( seg.A, seg.B, thickness, GetPlotMode(),
&gbr_metadata );
}
}
@ -1045,7 +1045,7 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
for( SHAPE* shape : shapes )
{
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(),
&gbr_metadata );

View File

@ -157,10 +157,10 @@ void altium_parse_polygons( std::map<wxString, wxString>& aProps,
const int32_t radius = ALTIUM_PARSER::ReadKicadUnit( aProps, "R" + si, "0mil" );
const double sa = ALTIUM_PARSER::ReadDouble( aProps, "SA" + si, 0. );
const double ea = ALTIUM_PARSER::ReadDouble( aProps, "EA" + si, 0. );
const wxPoint vp = wxPoint( ALTIUM_PARSER::ReadKicadUnit( aProps, vxi, "0mil" ),
-ALTIUM_PARSER::ReadKicadUnit( aProps, vyi, "0mil" ) );
const wxPoint cp = wxPoint( ALTIUM_PARSER::ReadKicadUnit( aProps, "CX" + si, "0mil" ),
-ALTIUM_PARSER::ReadKicadUnit( aProps, "CY" + si, "0mil" ) );
const VECTOR2I vp = VECTOR2I( ALTIUM_PARSER::ReadKicadUnit( aProps, vxi, "0mil" ),
-ALTIUM_PARSER::ReadKicadUnit( aProps, vyi, "0mil" ) );
const VECTOR2I cp = VECTOR2I( ALTIUM_PARSER::ReadKicadUnit( aProps, "CX" + si, "0mil" ),
-ALTIUM_PARSER::ReadKicadUnit( aProps, "CY" + si, "0mil" ) );
aVertices.emplace_back( isRound, radius, sa, ea, vp, cp );
}
@ -173,7 +173,7 @@ ABOARD6::ABOARD6( ALTIUM_PARSER& aReader )
if( props.empty() )
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" ) );
sheetsize = wxSize( ALTIUM_PARSER::ReadKicadUnit( props, "SHEETWIDTH", "0mil" ),
ALTIUM_PARSER::ReadKicadUnit( props, "SHEETHEIGHT", "0mil" ) );
@ -243,7 +243,7 @@ ACOMPONENT6::ACOMPONENT6( ALTIUM_PARSER& aReader )
THROW_IO_ERROR( "Components6 stream has no props" );
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" ) );
rotation = ALTIUM_PARSER::ReadDouble( props, "ROTATION", 0. );
locked = ALTIUM_PARSER::ReadBool( props, "LOCKED", false );
@ -296,8 +296,8 @@ ADIMENSION6::ADIMENSION6( ALTIUM_PARSER& aReader )
wxString text_position_raw = ALTIUM_PARSER::ReadString( props, "TEXTPOSITION", "" );
xy1 = wxPoint( ALTIUM_PARSER::ReadKicadUnit( props, "X1", "0mil" ),
-ALTIUM_PARSER::ReadKicadUnit( props, "Y1", "0mil" ) );
xy1 = VECTOR2I( ALTIUM_PARSER::ReadKicadUnit( props, "X1", "0mil" ),
-ALTIUM_PARSER::ReadKicadUnit( props, "Y1", "0mil" ) );
int refcount = ALTIUM_PARSER::ReadInt( props, "REFERENCES_COUNT", 0 );
@ -506,7 +506,7 @@ AARC6::AARC6( ALTIUM_PARSER& aReader )
subpolyindex = aReader.Read<uint16_t>();
component = aReader.Read<uint16_t>();
aReader.Skip( 4 );
center = aReader.ReadWxPoint();
center = aReader.ReadVector2I();
radius = aReader.ReadKicadUnit();
startangle = aReader.Read<double>();
endangle = aReader.Read<double>();
@ -616,7 +616,7 @@ APAD6::APAD6( ALTIUM_PARSER& aReader )
component = aReader.Read<uint16_t>();
aReader.Skip( 4 );
position = aReader.ReadWxPoint();
position = aReader.ReadVector2I();
topsize = aReader.ReadWxSize();
midsize = aReader.ReadWxSize();
botsize = aReader.ReadWxSize();
@ -675,10 +675,10 @@ APAD6::APAD6( ALTIUM_PARSER& aReader )
sizeAndShape->slotsize = aReader.ReadKicadUnit();
sizeAndShape->slotrotation = aReader.Read<double>();
for( wxPoint& pt : sizeAndShape->holeoffset )
for( VECTOR2I& pt : sizeAndShape->holeoffset )
pt.x = aReader.ReadKicadUnitX();
for( wxPoint& pt : sizeAndShape->holeoffset )
for( VECTOR2I& pt : sizeAndShape->holeoffset )
pt.y = aReader.ReadKicadUnitY();
aReader.Skip( 1 );
@ -723,7 +723,7 @@ AVIA6::AVIA6( ALTIUM_PARSER& aReader )
net = aReader.Read<uint16_t>();
aReader.Skip( 8 );
position = aReader.ReadWxPoint();
position = aReader.ReadVector2I();
diameter = aReader.ReadKicadUnit();
holesize = aReader.ReadKicadUnit();
@ -769,8 +769,8 @@ ATRACK6::ATRACK6( ALTIUM_PARSER& aReader )
subpolyindex = aReader.Read<uint16_t>();
component = aReader.Read<uint16_t>();
aReader.Skip( 4 );
start = aReader.ReadWxPoint();
end = aReader.ReadWxPoint();
start = aReader.ReadVector2I();
end = aReader.ReadVector2I();
width = aReader.ReadKicadUnit();
aReader.SkipSubrecord();
@ -793,7 +793,7 @@ ATEXT6::ATEXT6( ALTIUM_PARSER& aReader, std::map<uint32_t, wxString>& aStringTab
aReader.Skip( 6 );
component = aReader.Read<uint16_t>();
aReader.Skip( 4 );
position = aReader.ReadWxPoint();
position = aReader.ReadVector2I();
height = aReader.ReadKicadUnit();
aReader.Skip( 2 );
rotation = aReader.Read<double>();
@ -863,8 +863,8 @@ AFILL6::AFILL6( ALTIUM_PARSER& aReader )
aReader.Skip( 2 );
component = aReader.Read<uint16_t>();
aReader.Skip( 4 );
pos1 = aReader.ReadWxPoint();
pos2 = aReader.ReadWxPoint();
pos1 = aReader.ReadVector2I();
pos2 = aReader.ReadVector2I();
rotation = aReader.Read<double>();
aReader.SkipSubrecord();
@ -947,12 +947,12 @@ AREGION6::AREGION6( ALTIUM_PARSER& aReader, bool aExtendedVertices )
{
if( aExtendedVertices )
{
bool isRound = aReader.Read<uint8_t>() != 0;
wxPoint position = aReader.ReadWxPoint();
wxPoint center = aReader.ReadWxPoint();
int32_t radius = aReader.ReadKicadUnit();
double angle1 = aReader.Read<double>();
double angle2 = aReader.Read<double>();
bool isRound = aReader.Read<uint8_t>() != 0;
VECTOR2I position = aReader.ReadVector2I();
VECTOR2I center = aReader.ReadVector2I();
int32_t radius = aReader.ReadKicadUnit();
double angle1 = aReader.Read<double>();
double angle2 = aReader.Read<double>();
outline.emplace_back( isRound, radius, angle1, angle2, position, center );
}
else
@ -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
int32_t x = 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 ) );
}
}

View File

@ -212,7 +212,7 @@ struct ALTIUM_VERTICE
const VECTOR2I position;
const VECTOR2I center;
explicit ALTIUM_VERTICE( const wxPoint& aPosition )
explicit ALTIUM_VERTICE( const VECTOR2I& aPosition )
: isRound( false ),
radius( 0 ),
startangle( 0. ),
@ -223,7 +223,7 @@ struct ALTIUM_VERTICE
}
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 ),
radius( aRadius ),
startangle( aStartAngle ),
@ -345,8 +345,8 @@ struct ABOARD6_LAYER_STACKUP
struct ABOARD6
{
wxPoint sheetpos;
wxSize sheetsize;
VECTOR2I sheetpos;
wxSize sheetsize;
int layercount;
std::vector<ABOARD6_LAYER_STACKUP> stackup;
@ -371,7 +371,7 @@ struct ACLASS6
struct ACOMPONENT6
{
ALTIUM_LAYER layer;
wxPoint position;
VECTOR2I position;
double rotation;
bool locked;
bool nameon;
@ -552,7 +552,7 @@ struct APAD6_SIZE_AND_SHAPE
wxSize inner_size[29];
ALTIUM_PAD_SHAPE inner_shape[29];
wxPoint holeoffset[32];
VECTOR2I holeoffset[32];
ALTIUM_PAD_SHAPE_ALT alt_shape[32];
uint8_t cornerradius[32];
};
@ -571,7 +571,7 @@ struct APAD6
uint16_t net;
uint16_t component;
wxPoint position;
VECTOR2I position;
wxSize topsize;
wxSize midsize;
wxSize botsize;
@ -609,7 +609,7 @@ struct AVIA6
uint16_t net;
wxPoint position;
VECTOR2I position;
uint32_t diameter;
uint32_t holesize;
@ -631,8 +631,8 @@ struct ATRACK6
uint16_t component;
uint16_t subpolyindex;
wxPoint start;
wxPoint end;
VECTOR2I start;
VECTOR2I end;
uint32_t width;
explicit ATRACK6( ALTIUM_PARSER& aReader );
@ -643,7 +643,7 @@ struct ATEXT6
ALTIUM_LAYER layer;
uint16_t component;
wxPoint position;
VECTOR2I position;
uint32_t height;
double rotation;
uint32_t strokewidth;
@ -673,9 +673,9 @@ struct AFILL6
uint16_t component;
uint16_t net;
wxPoint pos1;
wxPoint pos2;
double rotation;
VECTOR2I pos1;
VECTOR2I pos2;
double rotation;
explicit AFILL6( ALTIUM_PARSER& aReader );
};

View File

@ -2360,10 +2360,10 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
int offsetX = aElem.topsize.x / 2 - offset;
int offsetY = aElem.topsize.y / 2 - offset;
wxPoint p11 = aElem.position + wxPoint( offsetX, offsetY );
wxPoint p12 = aElem.position + wxPoint( offsetX, -offsetY );
wxPoint p22 = aElem.position + wxPoint( -offsetX, -offsetY );
wxPoint p21 = aElem.position + wxPoint( -offsetX, offsetY );
VECTOR2I p11 = aElem.position + VECTOR2I( offsetX, offsetY );
VECTOR2I p12 = aElem.position + VECTOR2I( offsetX, -offsetY );
VECTOR2I p22 = aElem.position + VECTOR2I( -offsetX, -offsetY );
VECTOR2I p21 = aElem.position + VECTOR2I( -offsetX, offsetY );
shape->SetShape( SHAPE_T::POLY );
shape->SetFilled( true );
@ -2375,7 +2375,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
shape->SetShape( SHAPE_T::CIRCLE );
shape->SetFilled( true );
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 ) );
}
else if( aElem.topsize.x < aElem.topsize.y )
@ -2450,14 +2450,14 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
shape->SetLayer( klayer );
shape->SetStroke( STROKE_PARAMS( 0 ) );
wxPoint 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 );
wxPoint 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 p11 = aElem.position + wxPoint( aElem.topsize.x / 2, aElem.topsize.y / 2 );
VECTOR2I p12 = aElem.position + wxPoint( aElem.topsize.x / 2, -aElem.topsize.y / 2 );
VECTOR2I p22 = 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;
wxPoint chamferX( chamfer, 0 );
wxPoint chamferY( 0, chamfer );
VECTOR2I chamferX( chamfer, 0 );
VECTOR2I chamferY( 0, chamfer );
shape->SetPolyPoints( { p11 - chamferX, p11 - chamferY, p12 + chamferY, p12 - chamferX,
p22 + chamferX, p22 + chamferY, p21 - chamferY, p21 + chamferX } );

View File

@ -319,7 +319,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
// GPCB unit = 0.01 mils and Pcbnew 0.1.
double conv_unit = NEW_GPCB_UNIT_CONV;
wxPoint textPos;
VECTOR2I textPos;
wxString msg;
wxArrayString parameters;
std::unique_ptr<FOOTPRINT> footprint = std::make_unique<FOOTPRINT>( nullptr );
@ -383,13 +383,13 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
if( paramCnt == 14 )
{
textPos = wxPoint( parseInt( parameters[8], conv_unit ),
parseInt( parameters[9], conv_unit ) );
textPos = VECTOR2I( parseInt( parameters[8], conv_unit ),
parseInt( parameters[9], conv_unit ) );
}
else
{
textPos = wxPoint( parseInt( parameters[6], conv_unit ),
parseInt( parameters[7], conv_unit ) );
textPos = VECTOR2I( parseInt( parameters[6], conv_unit ),
parseInt( parameters[7], conv_unit ) );
}
int orientation = parseInt( parameters[paramCnt-4], 1.0 );
@ -465,10 +465,10 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
FP_SHAPE* shape = new FP_SHAPE( footprint.get(), SHAPE_T::SEGMENT );
shape->SetLayer( F_SilkS );
shape->SetStart0( wxPoint( parseInt( parameters[2], conv_unit ),
parseInt( parameters[3], conv_unit ) ) );
shape->SetEnd0( wxPoint( parseInt( parameters[4], conv_unit ),
parseInt( parameters[5], conv_unit ) ) );
shape->SetStart0( VECTOR2I( parseInt( parameters[2], conv_unit ),
parseInt( parameters[3], conv_unit ) ) );
shape->SetEnd0( VECTOR2I( parseInt( parameters[4], conv_unit ),
parseInt( parameters[5], conv_unit ) ) );
shape->SetStroke( STROKE_PARAMS( parseInt( parameters[6], conv_unit ),
PLOT_DASH_TYPE::SOLID ) );
shape->SetDrawCoord();
@ -495,8 +495,8 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
int radius = ( parseInt( parameters[4], conv_unit ) +
parseInt( parameters[5], conv_unit ) ) / 2;
wxPoint centre( parseInt( parameters[2], conv_unit ),
parseInt( parameters[3], conv_unit ) );
VECTOR2I centre( parseInt( parameters[2], conv_unit ),
parseInt( parameters[3], conv_unit ) );
shape->SetCenter0( centre );
@ -511,8 +511,8 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
shape->SetShape( SHAPE_T::CIRCLE );
// Calculate start point coordinate of arc
wxPoint arcStart( radius, 0 );
RotatePoint( &arcStart, -start_angle );
VECTOR2I arcStart( radius, 0 );
RotatePoint( arcStart, -start_angle );
shape->SetStart0( arcStart + centre );
// 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 y2 = parseInt( parameters[5], 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 );
// Get the pad clearance and the solder mask clearance.

View File

@ -301,7 +301,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
{
char offsetTxt[64];
wxPoint offset( aPad->GetOffset().x, aPad->GetOffset().y );
VECTOR2I offset( aPad->GetOffset().x, aPad->GetOffset().y );
dsnOffset = mapPt( offset );
@ -500,7 +500,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
bool doChamfer = aPad->GetShape() == PAD_SHAPE::CHAMFERED_RECT;
TransformRoundChamferedRectToPolygon(
cornerBuffer, wxPoint( 0, 0 ), psize, 0, rradius, aPad->GetChamferRectRatio(),
cornerBuffer, VECTOR2I( 0, 0 ), psize, 0, rradius, aPad->GetChamferRectRatio(),
doChamfer ? aPad->GetChamferPositions() : 0, 0,
aBoard->GetDesignSettings().m_MaxError, ERROR_INSIDE );
SHAPE_LINE_CHAIN& polygonal_shape = cornerBuffer.Outline( 0 );
@ -549,7 +549,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
case PAD_SHAPE::CUSTOM:
{
std::vector<wxPoint> polygonal_shape;
std::vector<VECTOR2I> polygonal_shape;
SHAPE_POLY_SET pad_shape;
aPad->MergePrimitivesAsPolygon( &pad_shape );

View File

@ -482,13 +482,13 @@ bool TRACKS_CLEANER::mergeCollinearSegments( PCB_TRACK* aSeg1, PCB_TRACK* aSeg2
if( ( aSeg1->GetStart().x > aSeg1->GetEnd().x )
== ( aSeg1->GetStart().y > aSeg1->GetEnd().y ) )
{
dummy_seg.SetStart( wxPoint( min_x, min_y ) );
dummy_seg.SetEnd( wxPoint( max_x, max_y ) );
dummy_seg.SetStart( VECTOR2I( min_x, min_y ) );
dummy_seg.SetEnd( VECTOR2I( max_x, max_y ) );
}
else
{
dummy_seg.SetStart( wxPoint( min_x, max_y ) );
dummy_seg.SetEnd( wxPoint( max_x, min_y ) );
dummy_seg.SetStart( VECTOR2I( min_x, max_y ) );
dummy_seg.SetEnd( VECTOR2I( max_x, min_y ) );
}
// Now find the removed end(s) and stop merging if it is a node:

View File

@ -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
if( aPad->GetCustomShapeInZoneOpt() == CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL )
{
std::vector<wxPoint> convex_hull;
std::vector<VECTOR2I> convex_hull;
BuildConvexHull( convex_hull, poly );
aHoles.NewOutline();
for( const wxPoint& pt : convex_hull )
for( const VECTOR2I& pt : convex_hull )
aHoles.Append( pt );
}
else

View File

@ -104,7 +104,7 @@ BOOST_AUTO_TEST_CASE( Junctions )
for( int i = 0; i < 100; i++ )
{
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 );
}
@ -127,9 +127,9 @@ BOOST_AUTO_TEST_CASE( Junctions )
BOOST_CHECK_EQUAL( count, 0 );
EDA_RECT small_bbox( wxPoint( -1, -1 ), wxSize( Mils2iu( 2 ), Mils2iu( 2 ) ) );
EDA_RECT med_bbox( wxPoint( 0, 0 ), wxSize( Mils2iu( 100 ), Mils2iu( 100 ) ) );
EDA_RECT big_bbox( wxPoint( 0, 0 ), wxSize( Mils2iu( 5000 ), Mils2iu( 5000 ) ) );
EDA_RECT small_bbox( VECTOR2I( -1, -1 ), VECTOR2I( Mils2iu( 2 ), Mils2iu( 2 ) ) );
EDA_RECT med_bbox( VECTOR2I( 0, 0 ), VECTOR2I( Mils2iu( 100 ), Mils2iu( 100 ) ) );
EDA_RECT big_bbox( VECTOR2I( 0, 0 ), VECTOR2I( Mils2iu( 5000 ), Mils2iu( 5000 ) ) );
count = 0;
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;
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 );
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 );
}
@ -215,7 +215,7 @@ BOOST_AUTO_TEST_CASE( MixedElements )
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;
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
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 );
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 );
int count = 0;