Some more wxPoint removal

This commit is contained in:
Marek Roszko 2022-01-01 12:11:21 -05:00
parent c4c56de708
commit d1552c3fec
10 changed files with 148 additions and 146 deletions

View File

@ -78,9 +78,9 @@ public:
void CalcArcAngles( int& aStartAngle, int& aEndAngle ) const;
void BeginEdit( const wxPoint& aStartPoint ) { beginEdit( aStartPoint ); }
bool ContinueEdit( const wxPoint& aPosition ) { return continueEdit( aPosition ); }
void CalcEdit( const wxPoint& aPosition ) { calcEdit( aPosition ); }
void BeginEdit( const VECTOR2I& aStartPoint ) { beginEdit( aStartPoint ); }
bool ContinueEdit( const VECTOR2I& aPosition ) { return continueEdit( aPosition ); }
void CalcEdit( const VECTOR2I& aPosition ) { calcEdit( aPosition ); }
void EndEdit() { endEdit(); }
void SetEditState( int aState ) { setEditState( aState ); }

View File

@ -103,7 +103,7 @@ SCH_SYMBOL::SCH_SYMBOL() :
SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId,
const SCH_SHEET_PATH* aSheet, int unit, int convert, const wxPoint& pos ) :
const SCH_SHEET_PATH* aSheet, int unit, int convert, const VECTOR2I& pos ) :
SCH_ITEM( nullptr, SCH_SYMBOL_T )
{
Init( pos );
@ -146,7 +146,7 @@ SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId,
SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet,
const PICKED_SYMBOL& aSel, const wxPoint& pos ) :
const PICKED_SYMBOL& aSel, const VECTOR2I& pos ) :
SCH_SYMBOL( aSymbol, aSel.LibId, aSheet, aSel.Unit, aSel.Convert, pos )
{
// Set any fields that were modified as part of the symbol selection

View File

@ -92,10 +92,10 @@ public:
* @param setNewItemFlag is used to set the symbol #IS_NEW and #IS_MOVING flags.
*/
SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
int unit = 0, int convert = 0, const wxPoint& pos = wxPoint( 0, 0 ) );
int unit = 0, int convert = 0, const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
const wxPoint& pos = wxPoint( 0, 0 ) );
const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
/**
* Clone \a aSymbol into a new schematic symbol object.

View File

@ -187,10 +187,10 @@ public:
VECTOR2I topLeft = sheet->GetPosition();
VECTOR2I botRight = sheet->GetPosition() + sheet->GetSize();
points->AddPoint( (wxPoint) topLeft );
points->AddPoint( wxPoint( botRight.x, topLeft.y ) );
points->AddPoint( wxPoint( topLeft.x, botRight.y ) );
points->AddPoint( (wxPoint) botRight );
points->AddPoint( topLeft );
points->AddPoint( VECTOR2I( botRight.x, topLeft.y ) );
points->AddPoint( VECTOR2I( topLeft.x, botRight.y ) );
points->AddPoint( botRight );
}
break;
@ -200,10 +200,10 @@ public:
VECTOR2I topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2;
VECTOR2I botRight = bitmap->GetPosition() + bitmap->GetSize() / 2;
points->AddPoint( (wxPoint) topLeft );
points->AddPoint( wxPoint( botRight.x, topLeft.y ) );
points->AddPoint( wxPoint( topLeft.x, botRight.y ) );
points->AddPoint( (wxPoint) botRight );
points->AddPoint( topLeft );
points->AddPoint( VECTOR2I( botRight.x, topLeft.y ) );
points->AddPoint( VECTOR2I( topLeft.x, botRight.y ) );
points->AddPoint( botRight );
}
break;
@ -608,23 +608,23 @@ void EE_POINT_EDITOR::updateParentItem() const
if( getEditedPointIndex() == ARC_CENTER )
{
shape->SetEditState( 4 );
shape->CalcEdit( (wxPoint) m_editPoints->Point( ARC_CENTER ).GetPosition() );
shape->CalcEdit( m_editPoints->Point( ARC_CENTER ).GetPosition() );
}
else if( getEditedPointIndex() == ARC_START )
{
shape->SetEditState( 2 );
shape->CalcEdit( (wxPoint) m_editPoints->Point( ARC_START ).GetPosition() );
shape->CalcEdit( m_editPoints->Point( ARC_START ).GetPosition() );
}
else if( getEditedPointIndex() == ARC_END )
{
shape->SetEditState( 3 );
shape->CalcEdit( (wxPoint) m_editPoints->Point( ARC_END ).GetPosition() );
shape->CalcEdit( m_editPoints->Point( ARC_END ).GetPosition() );
}
break;
case SHAPE_T::CIRCLE:
shape->SetPosition( (wxPoint) m_editPoints->Point( CIRC_CENTER ).GetPosition() );
shape->SetEnd( (wxPoint) m_editPoints->Point( CIRC_END ).GetPosition() );
shape->SetPosition( m_editPoints->Point( CIRC_CENTER ).GetPosition() );
shape->SetEnd( m_editPoints->Point( CIRC_END ).GetPosition() );
break;
case SHAPE_T::POLY:
@ -647,8 +647,8 @@ void EE_POINT_EDITOR::updateParentItem() const
pinEditedCorner( getEditedPointIndex(), Mils2iu( 1 ), Mils2iu( 1 ),
topLeft, topRight, botLeft, botRight, &gridHelper );
shape->SetPosition( (wxPoint) topLeft );
shape->SetEnd( (wxPoint) botRight );
shape->SetPosition( topLeft );
shape->SetEnd( botRight );
}
break;
@ -703,9 +703,9 @@ void EE_POINT_EDITOR::updateParentItem() const
// Pin positions are relative to origin. Attempt to leave them where they
// are if the origin moves.
VECTOR2I originDelta = sheet->GetPosition() - (wxPoint) topLeft;
VECTOR2I originDelta = sheet->GetPosition() - topLeft;
sheet->SetPosition( (wxPoint) topLeft );
sheet->SetPosition( topLeft );
sheet->SetSize( wxSize( botRight.x - topLeft.x, botRight.y - topLeft.y ) );
// Update the fields if we're in autoplace mode
@ -737,8 +737,8 @@ void EE_POINT_EDITOR::updateParentItem() const
{
SCH_LINE* line = (SCH_LINE*) item;
line->SetStartPoint( (wxPoint) m_editPoints->Point( LINE_START ).GetPosition() );
line->SetEndPoint( (wxPoint) m_editPoints->Point( LINE_END ).GetPosition() );
line->SetStartPoint( m_editPoints->Point( LINE_START ).GetPosition() );
line->SetEndPoint( m_editPoints->Point( LINE_END ).GetPosition() );
std::pair<EDA_ITEM*, int> connected = m_editPoints->Point( LINE_START ).GetConnected();
@ -1022,7 +1022,7 @@ bool EE_POINT_EDITOR::addCornerCondition( const SELECTION& )
VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
double threshold = getView()->ToWorld( EDIT_POINT::POINT_SIZE );
return shape->HitTest( (wxPoint) cursorPos, (int) threshold );
return shape->HitTest( cursorPos, (int) threshold );
}
@ -1035,14 +1035,14 @@ int EE_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
SHAPE_LINE_CHAIN& poly = shape->GetPolyShape().Outline( 0 );
VECTOR2I cursor = getViewControls()->GetCursorPosition( !aEvent.DisableGridSnapping() );
wxPoint pos = mapCoords( cursor );
VECTOR2I pos = mapCoords( cursor );
int currentMinDistance = INT_MAX;
int closestLineStart = 0;
for( unsigned i = 0; i < poly.GetPointCount() - 1; ++i )
{
int distance = (int) DistanceLinePoint( (wxPoint) poly.CPoint( i ),
(wxPoint) poly.CPoint( i + 1 ), pos );
int distance = (int) DistanceLinePoint( poly.CPoint( i ),
poly.CPoint( i + 1 ), pos );
if( distance < currentMinDistance )
{

View File

@ -257,9 +257,9 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
// but only if it has meaning (i.e inside the canvas)
VECTOR2D newMousePos = controls->GetMousePosition(false);
if( canvas_area.Contains( wxPoint( initialMousePos ) ) )
if( canvas_area.Contains( VECTOR2I( initialMousePos ) ) )
controls->WarpCursor( controls->GetCursorPosition(), true );
else if( !canvas_area.Contains( wxPoint( newMousePos ) ) )
else if( !canvas_area.Contains( VECTOR2I( newMousePos ) ) )
// The mouse is outside the canvas area, after closing the dialog,
// thus can creating autopan issues. Warp the mouse to the canvas center
controls->WarpCursor( canvas_area.Centre(), false );
@ -270,7 +270,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
if( !libSymbol )
continue;
wxPoint pos( cursorPos );
VECTOR2I pos( cursorPos );
symbol = new SCH_SYMBOL( *libSymbol, &m_frame->GetCurrentSheet(), sel, pos );
addSymbol( symbol );
@ -346,7 +346,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
}
else if( symbol && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
symbol->SetPosition( (wxPoint)cursorPos );
symbol->SetPosition( cursorPos );
m_view->Update( symbol );
}
else if( symbol && evt->IsAction( &ACTIONS::doDelete ) )
@ -387,7 +387,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
// Add all the drawable symbols to preview
if( image )
{
image->SetPosition( (wxPoint)cursorPos );
image->SetPosition( cursorPos );
m_view->ClearPreview();
m_view->AddToPreview( image->Clone() );
}
@ -503,9 +503,9 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
// but only if it has meaning (i.e inside the canvas)
VECTOR2D newMousePos = controls->GetMousePosition( false );
if( canvas_area.Contains( wxPoint( initialMousePos ) ) )
if( canvas_area.Contains( VECTOR2I( initialMousePos ) ) )
controls->WarpCursor( controls->GetCursorPosition(), true );
else if( !canvas_area.Contains( wxPoint( newMousePos ) ) )
else if( !canvas_area.Contains( VECTOR2I( newMousePos ) ) )
// The mouse is outside the canvas area, after closing the dialog,
// thus can creating autopan issues. Warp the mouse to the canvas center
controls->WarpCursor( canvas_area.Centre(), false );
@ -515,7 +515,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
wxString fullFilename = dlg.GetPath();
if( wxFileExists( fullFilename ) )
image = new SCH_BITMAP( (wxPoint)cursorPos );
image = new SCH_BITMAP( cursorPos );
if( !image || !image->ReadImageFile( fullFilename ) )
{
@ -563,7 +563,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
}
else if( image && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
image->SetPosition( (wxPoint)cursorPos );
image->SetPosition( cursorPos );
m_view->ClearPreview();
m_view->AddToPreview( image->Clone() );
m_view->RecacheAllItems(); // Bitmaps are cached in Opengl
@ -872,25 +872,25 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
switch( aType )
{
case LAYER_NOTES:
textItem = new SCH_TEXT( (wxPoint) aPosition );
textItem = new SCH_TEXT( aPosition );
break;
case LAYER_LOCLABEL:
textItem = new SCH_LABEL( (wxPoint) aPosition );
textItem = new SCH_LABEL( aPosition );
break;
case LAYER_NETCLASS_REFS:
textItem = new SCH_NETCLASS_FLAG( (wxPoint) aPosition );
textItem = new SCH_NETCLASS_FLAG( aPosition );
textItem->SetShape( m_lastNetClassFlagShape );
break;
case LAYER_HIERLABEL:
textItem = new SCH_HIERLABEL( (wxPoint) aPosition );
textItem = new SCH_HIERLABEL( aPosition );
textItem->SetShape( m_lastGlobalLabelShape );
break;
case LAYER_GLOBLABEL:
textItem = new SCH_GLOBALLABEL( (wxPoint) aPosition );
textItem = new SCH_GLOBALLABEL( aPosition );
textItem->SetShape( m_lastGlobalLabelShape );
static_cast<SCH_GLOBALLABEL*>( textItem )->GetFields()[0].SetVisible( true );
break;
@ -991,7 +991,7 @@ SCH_SHEET_PIN* SCH_DRAWING_TOOLS::createSheetPin( SCH_SHEET* aSheet, SCH_HIERLAB
m_lastSheetPinType = aLabel->GetShape();
}
sheetPin = new SCH_SHEET_PIN( aSheet, wxPoint( 0, 0 ), text );
sheetPin = new SCH_SHEET_PIN( aSheet, VECTOR2I( 0, 0 ), text );
sheetPin->SetFlags( IS_NEW );
sheetPin->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
sheetPin->SetShape( m_lastSheetPinType );
@ -1009,7 +1009,7 @@ SCH_SHEET_PIN* SCH_DRAWING_TOOLS::createSheetPin( SCH_SHEET* aSheet, SCH_HIERLAB
m_lastSheetPinType = sheetPin->GetShape();
sheetPin->SetPosition( (wxPoint) getViewControls()->GetCursorPosition() );
sheetPin->SetPosition( (VECTOR2I) getViewControls()->GetCursorPosition() );
return sheetPin;
}
@ -1539,7 +1539,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
sheet = new SCH_SHEET( m_frame->GetCurrentSheet().Last(), (wxPoint) cursorPos );
sheet = new SCH_SHEET( m_frame->GetCurrentSheet().Last(), (VECTOR2I) cursorPos );
sheet->SetFlags( IS_NEW | IS_RESIZING );
sheet->SetScreen( nullptr );
sheet->SetBorderWidth( Mils2iu( cfg->m_Drawing.default_line_thickness ) );

View File

@ -243,12 +243,12 @@ bool PAD::FlashLayer( int aLayer ) const
case PAD_ATTRIB::NPTH:
if( GetShape() == PAD_SHAPE::CIRCLE && GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
{
if( GetOffset() == wxPoint( 0, 0 ) && GetDrillSize().x >= GetSize().x )
if( GetOffset() == VECTOR2I( 0, 0 ) && GetDrillSize().x >= GetSize().x )
return false;
}
else if( GetShape() == PAD_SHAPE::OVAL && GetDrillShape() == PAD_DRILL_SHAPE_OBLONG )
{
if( GetOffset() == wxPoint( 0, 0 )
if( GetOffset() == VECTOR2I( 0, 0 )
&& GetDrillSize().x >= GetSize().x && GetDrillSize().y >= GetSize().y )
{
return false;
@ -376,8 +376,8 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
{
wxSize half_size = m_size / 2;
int half_width = std::min( half_size.x, half_size.y );
wxPoint half_len( half_size.x - half_width, half_size.y - half_width );
RotatePoint( &half_len, m_orient );
VECTOR2I half_len( half_size.x - half_width, half_size.y - half_width );
RotatePoint( half_len, m_orient );
add( new SHAPE_SEGMENT( shapePos - half_len, shapePos + half_len, half_width * 2 ) );
}
@ -387,13 +387,13 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
case PAD_SHAPE::TRAPEZOID:
case PAD_SHAPE::ROUNDRECT:
{
int r = ( effectiveShape == PAD_SHAPE::ROUNDRECT ) ? GetRoundRectCornerRadius() : 0;
wxPoint half_size( m_size.x / 2, m_size.y / 2 );
wxSize trap_delta( 0, 0 );
int r = ( effectiveShape == PAD_SHAPE::ROUNDRECT ) ? GetRoundRectCornerRadius() : 0;
VECTOR2I half_size( m_size.x / 2, m_size.y / 2 );
wxSize trap_delta( 0, 0 );
if( r )
{
half_size -= wxPoint( r, r );
half_size -= VECTOR2I( r, r );
// Avoid degenerated shapes (0 length segments) that always create issues
// For roundrect pad very near a circle, use only a circle
@ -490,20 +490,20 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
}
BOX2I bbox = m_effectiveShape->BBox();
m_effectiveBoundingBox = EDA_RECT( (wxPoint) bbox.GetPosition(),
m_effectiveBoundingBox = EDA_RECT( bbox.GetPosition(),
wxSize( bbox.GetWidth(), bbox.GetHeight() ) );
// Hole shape
wxSize half_size = m_drill / 2;
int half_width = std::min( half_size.x, half_size.y );
wxPoint half_len( half_size.x - half_width, half_size.y - half_width );
wxSize half_size = m_drill / 2;
int half_width = std::min( half_size.x, half_size.y );
VECTOR2I half_len( half_size.x - half_width, half_size.y - half_width );
RotatePoint( &half_len, m_orient );
RotatePoint( half_len, m_orient );
m_effectiveHoleShape = std::make_shared<SHAPE_SEGMENT>( m_pos - half_len, m_pos + half_len,
half_width * 2 );
bbox = m_effectiveHoleShape->BBox();
m_effectiveBoundingBox.Merge( EDA_RECT( (wxPoint) bbox.GetPosition(),
m_effectiveBoundingBox.Merge( EDA_RECT( bbox.GetPosition(),
wxSize( bbox.GetWidth(), bbox.GetHeight() ) ) );
// All done
@ -681,7 +681,7 @@ void PAD::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
void PAD::FlipPrimitives( bool aFlipLeftRight )
{
for( std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
primitive->Flip( wxPoint( 0, 0 ), aFlipLeftRight );
primitive->Flip( VECTOR2I( 0, 0 ), aFlipLeftRight );
SetDirty();
}
@ -998,15 +998,15 @@ bool PAD::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
for( int ii = 0; ii < count; ii++ )
{
auto vertex = poly->CVertex( ii );
auto vertexNext = poly->CVertex(( ii + 1 ) % count );
VECTOR2I vertex = poly->CVertex( ii );
VECTOR2I vertexNext = poly->CVertex( ( ii + 1 ) % count );
// Test if the point is within aRect
if( arect.Contains( ( wxPoint ) vertex ) )
if( arect.Contains( vertex ) )
return true;
// Test if this edge intersects aRect
if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
if( arect.Intersects( vertex, vertexNext ) )
return true;
}
@ -1490,7 +1490,7 @@ bool PAD::TransformHoleWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, in
const SHAPE_SEGMENT* seg = GetEffectiveHoleShape();
TransformOvalToPolygon( aCornerBuffer, (wxPoint) seg->GetSeg().A, (wxPoint) seg->GetSeg().B,
TransformOvalToPolygon( aCornerBuffer, seg->GetSeg().A, seg->GetSeg().B,
seg->GetWidth() + aInflateValue * 2, aError, aErrorLoc );
return true;
@ -1527,10 +1527,10 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
}
else
{
int half_width = std::min( dx, dy );
wxPoint delta( dx - half_width, dy - half_width );
int half_width = std::min( dx, dy );
VECTOR2I delta( dx - half_width, dy - half_width );
RotatePoint( &delta, angle );
RotatePoint( delta, angle );
TransformOvalToPolygon( aCornerBuffer, padShapePos - delta, padShapePos + delta,
( half_width + aClearanceValue ) * 2, aError, aErrorLoc,

View File

@ -45,8 +45,8 @@ PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) :
m_layer = Edge_Cuts; // a target is on all layers
}
PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent, int aShape, PCB_LAYER_ID aLayer,
const wxPoint& aPos, int aSize, int aWidth ) :
PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent, int aShape, PCB_LAYER_ID aLayer, const VECTOR2I& aPos,
int aSize, int aWidth ) :
BOARD_ITEM( aParent, PCB_TARGET_T )
{
m_shape = aShape;

View File

@ -39,8 +39,8 @@ public:
// Do not create a copy constructor. The one generated by the compiler is adequate.
PCB_TARGET( BOARD_ITEM* aParent, int aShape, PCB_LAYER_ID aLayer,
const wxPoint& aPos, int aSize, int aWidth );
PCB_TARGET( BOARD_ITEM* aParent, int aShape, PCB_LAYER_ID aLayer, const VECTOR2I& aPos,
int aSize, int aWidth );
// Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate.

View File

@ -869,7 +869,7 @@ void LEGACY_PLUGIN::loadSETUP()
BIU gx = biuParse( line + SZ( "AuxiliaryAxisOrg" ), &data );
BIU gy = biuParse( data );
bds.SetAuxOrigin( wxPoint( gx, gy ) );
bds.SetAuxOrigin( VECTOR2I( gx, gy ) );
}
else if( TESTSUBSTR( "Layer[" ) )
{
@ -1062,7 +1062,7 @@ void LEGACY_PLUGIN::loadSETUP()
BIU x = biuParse( line + SZ( "GridOrigin" ), &data );
BIU y = biuParse( data );
bds.SetGridOrigin( wxPoint( x, y ) );
bds.SetGridOrigin( VECTOR2I( x, y ) );
}
else if( TESTLINE( "VisibleElements" ) )
{
@ -1192,7 +1192,7 @@ void LEGACY_PLUGIN::loadFOOTPRINT( FOOTPRINT* aFootprint )
if( data && data[1] == 'P' )
aFootprint->SetIsPlaced( true );
aFootprint->SetPosition( wxPoint( pos_x, pos_y ) );
aFootprint->SetPosition( VECTOR2I( pos_x, pos_y ) );
aFootprint->SetLayer( layer_id );
aFootprint->SetOrientation( orient );
const_cast<KIID&>( aFootprint->m_Uuid ) = KIID( uuid );
@ -1405,7 +1405,7 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint )
}
pad->SetDrillShape( drShape );
pad->SetOffset( wxPoint( offs_x, offs_y ) );
pad->SetOffset( VECTOR2I( offs_x, offs_y ) );
pad->SetDrillSize( wxSize( drill_x, drill_y ) );
}
else if( TESTLINE( "At" ) ) // (At)tribute
@ -1456,7 +1456,7 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint )
else if( TESTLINE( "Po" ) ) // (Po)sition
{
// e.g. "Po 500 -500"
wxPoint pos;
VECTOR2I pos;
pos.x = biuParse( line + SZ( "Po" ), &data );
pos.y = biuParse( data );
@ -1563,8 +1563,8 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
width = biuParse( data, &data );
layer = intParse( data );
dwg->SetCenter0( wxPoint( center0_x, center0_y ) );
dwg->SetStart0( wxPoint( start0_x, start0_y ) );
dwg->SetCenter0( VECTOR2I( center0_x, center0_y ) );
dwg->SetStart0( VECTOR2I( start0_x, start0_y ) );
dwg->SetArcAngleAndEnd0( angle, true );
break;
}
@ -1581,8 +1581,8 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
width = biuParse( data, &data );
layer = intParse( data );
dwg->SetStart0( wxPoint( start0_x, start0_y ) );
dwg->SetEnd0( wxPoint( end0_x, end0_y ) );
dwg->SetStart0( VECTOR2I( start0_x, start0_y ) );
dwg->SetEnd0( VECTOR2I( end0_x, end0_y ) );
break;
}
@ -1598,8 +1598,8 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint )
width = biuParse( data, &data );
layer = intParse( data );
dwg->SetStart0( wxPoint( start0_x, start0_y ) );
dwg->SetEnd0( wxPoint( end0_x, end0_y ) );
dwg->SetStart0( VECTOR2I( start0_x, start0_y ) );
dwg->SetEnd0( VECTOR2I( end0_x, end0_y ) );
std::vector<VECTOR2I> pts;
pts.reserve( ptCount );
@ -1706,7 +1706,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( FP_TEXT* aText )
aText->SetType( static_cast<FP_TEXT::TEXT_TYPE>( type ) );
aText->SetPos0( wxPoint( pos0_x, pos0_y ) );
aText->SetPos0( VECTOR2I( pos0_x, pos0_y ) );
aText->SetTextSize( wxSize( size0_x, size0_y ) );
orient -= ( static_cast<FOOTPRINT*>( aText->GetParent() ) )->GetOrientation();
@ -1819,8 +1819,8 @@ void LEGACY_PLUGIN::loadPCB_LINE()
dseg->SetShape( static_cast<SHAPE_T>( shape ) );
dseg->SetFilled( false );
dseg->SetStroke( STROKE_PARAMS( width, PLOT_DASH_TYPE::SOLID ) );
dseg->SetStart( wxPoint( start_x, start_y ) );
dseg->SetEnd( wxPoint( end_x, end_y ) );
dseg->SetStart( VECTOR2I( start_x, start_y ) );
dseg->SetEnd( VECTOR2I( end_x, end_y ) );
}
else if( TESTLINE( "De" ) )
{
@ -1871,7 +1871,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
break;
case 6:
y = biuParse( data );
dseg->SetBezierC1( wxPoint( x, y ));
dseg->SetBezierC1( VECTOR2I( x, y ) );
break;
case 7:
@ -1879,7 +1879,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
break;
case 8:
y = biuParse( data );
dseg->SetBezierC2( wxPoint( x, y ));
dseg->SetBezierC2( VECTOR2I( x, y ) );
break;
default:
@ -2024,7 +2024,7 @@ void LEGACY_PLUGIN::loadPCB_TEXT()
pcbtxt->SetTextThickness( thickn );
pcbtxt->SetTextAngle( angle );
pcbtxt->SetTextPos( wxPoint( pos_x, pos_y ) );
pcbtxt->SetTextPos( VECTOR2I( pos_x, pos_y ) );
}
else if( TESTLINE( "De" ) )
{
@ -2163,8 +2163,8 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
}
const_cast<KIID&>( newTrack->m_Uuid ) = KIID( uuid );
newTrack->SetPosition( wxPoint( start_x, start_y ) );
newTrack->SetEnd( wxPoint( end_x, end_y ) );
newTrack->SetPosition( VECTOR2I( start_x, start_y ) );
newTrack->SetEnd( VECTOR2I( end_x, end_y ) );
newTrack->SetWidth( width );
@ -2339,7 +2339,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
holeIndex++;
}
zc->AppendCorner( wxPoint( x, y ), holeIndex );
zc->AppendCorner( VECTOR2I( x, y ), holeIndex );
// Is this corner the end of current contour?
// the next corner (if any) will be stored in a new contour (a hole)
@ -2598,8 +2598,8 @@ void LEGACY_PLUGIN::loadDIMENSION()
{
std::unique_ptr<PCB_DIM_ALIGNED> dim = std::make_unique<PCB_DIM_ALIGNED>( m_board,
PCB_DIM_ALIGNED_T );
wxPoint crossBarO;
wxPoint crossBarF;
VECTOR2I crossBarO;
VECTOR2I crossBarF;
char* line;
@ -2654,7 +2654,7 @@ void LEGACY_PLUGIN::loadDIMENSION()
double orient = degParse( data, &data );
char* mirror = strtok_r( (char*) data, delims, (char**) &data );
dim->Text().SetTextPos( wxPoint( pos_x, pos_y ) );
dim->Text().SetTextPos( VECTOR2I( pos_x, pos_y ) );
dim->Text().SetTextSize( wxSize( width, height ) );
dim->Text().SetMirrored( mirror && *mirror == '0' );
dim->Text().SetTextThickness( thickn );
@ -2670,8 +2670,8 @@ void LEGACY_PLUGIN::loadDIMENSION()
BIU width = biuParse( data );
dim->SetLineThickness( width );
crossBarO = wxPoint( crossBarOx, crossBarOy );
crossBarF = wxPoint( crossBarFx, crossBarFy );
crossBarO = VECTOR2I( crossBarOx, crossBarOy );
crossBarF = VECTOR2I( crossBarFx, crossBarFy );
}
else if( TESTLINE( "Sd" ) )
{
@ -2682,7 +2682,7 @@ void LEGACY_PLUGIN::loadDIMENSION()
ignore_unused( biuParse( data, &data ) );
ignore_unused( biuParse( data ) );
dim->SetStart( wxPoint( featureLineDOx, featureLineDOy ) );
dim->SetStart( VECTOR2I( featureLineDOx, featureLineDOy ) );
}
else if( TESTLINE( "Sg" ) )
{
@ -2693,7 +2693,7 @@ void LEGACY_PLUGIN::loadDIMENSION()
ignore_unused( biuParse( data, &data ) );
ignore_unused( biuParse( data ) );
dim->SetEnd( wxPoint( featureLineGOx, featureLineGOy ) );
dim->SetEnd( VECTOR2I( featureLineGOx, featureLineGOy ) );
}
else if( TESTLINE( "S1" ) ) // Arrow: no longer imported
{
@ -2761,7 +2761,7 @@ void LEGACY_PLUGIN::loadPCB_TARGET()
layer_num = LAST_NON_COPPER_LAYER;
PCB_TARGET* t = new PCB_TARGET( m_board, shape, leg_layer2new( m_cu_count, layer_num ),
wxPoint( pos_x, pos_y ), size, width );
VECTOR2I( pos_x, pos_y ), size, width );
m_board->Add( t, ADD_MODE::APPEND );
const_cast<KIID&>( t->m_Uuid ) = KIID( uuid );

View File

@ -199,9 +199,9 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
case SHAPE_T::RECT:
points->AddPoint( shape->GetStart() );
points->AddPoint( wxPoint( shape->GetEnd().x, shape->GetStart().y ) );
points->AddPoint( VECTOR2I( shape->GetEnd().x, shape->GetStart().y ) );
points->AddPoint( shape->GetEnd() );
points->AddPoint( wxPoint( shape->GetStart().x, shape->GetEnd().y ) );
points->AddPoint( VECTOR2I( shape->GetStart().x, shape->GetEnd().y ) );
points->AddLine( points->Point( RECT_TOP_LEFT ), points->Point( RECT_TOP_RIGHT ) );
points->Line( RECT_TOP ).SetConstraint( new EC_PERPLINE( points->Line( RECT_TOP ) ) );
@ -261,7 +261,7 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
switch( pad->GetShape() )
{
case PAD_SHAPE::CIRCLE:
points->AddPoint( wxPoint( shapePos.x + halfSize.x, shapePos.y ) );
points->AddPoint( VECTOR2I( shapePos.x + halfSize.x, shapePos.y ) );
break;
case PAD_SHAPE::OVAL:
@ -277,9 +277,9 @@ std::shared_ptr<EDIT_POINTS> PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem )
std::swap( halfSize.x, halfSize.y );
points->AddPoint( shapePos - halfSize );
points->AddPoint( wxPoint( shapePos.x + halfSize.x, shapePos.y - halfSize.y ) );
points->AddPoint( VECTOR2I( shapePos.x + halfSize.x, shapePos.y - halfSize.y ) );
points->AddPoint( shapePos + halfSize );
points->AddPoint( wxPoint( shapePos.x - halfSize.x, shapePos.y + halfSize.y ) );
points->AddPoint( VECTOR2I( shapePos.x - halfSize.x, shapePos.y + halfSize.y ) );
}
break;
@ -785,12 +785,12 @@ void PCB_POINT_EDITOR::editArcEndpointKeepTangent( PCB_SHAPE* aArc, const VECTOR
if( arcValid )
{
aArc->SetCenter( (wxPoint) center );
aArc->SetCenter( center );
if( movingStart )
aArc->SetStart( (wxPoint) start );
aArc->SetStart( start );
else
aArc->SetEnd( (wxPoint) end );
aArc->SetEnd( end );
}
}
}
@ -956,12 +956,12 @@ void PCB_POINT_EDITOR::editArcEndpointKeepCenter( PCB_SHAPE* aArc, const VECTOR2
p1 = p1 + aCenter;
p2 = p2 + aCenter;
aArc->SetCenter( (wxPoint) aCenter );
aArc->SetCenter( aCenter );
if( movingStart )
aArc->SetStart( (wxPoint) aStart );
aArc->SetStart( aStart );
else
aArc->SetEnd( (wxPoint) aEnd );
aArc->SetEnd( aEnd );
}
@ -1021,8 +1021,8 @@ void PCB_POINT_EDITOR::editArcMidKeepCenter( PCB_SHAPE* aArc, const VECTOR2I& aC
start = start + aCenter;
end = end + aCenter;
aArc->SetStart( (wxPoint) start );
aArc->SetEnd( (wxPoint) end );
aArc->SetStart( start );
aArc->SetEnd( end );
}
@ -1040,7 +1040,7 @@ void PCB_POINT_EDITOR::editArcMidKeepEndpoints( PCB_SHAPE* aArc, const VECTOR2I&
SEG legal( m + v.Resize( JUST_OFF ), m + v.Resize( INT_MAX / 2 ) );
VECTOR2I mid = legal.NearestPoint( aCursor );
aArc->SetArcGeometry( (wxPoint) aStart, (wxPoint) mid, (wxPoint) aEnd );
aArc->SetArcGeometry( aStart, mid, aEnd );
}
@ -1062,9 +1062,9 @@ void PCB_POINT_EDITOR::updateItem() const
{
case SHAPE_T::SEGMENT:
if( isModified( m_editPoints->Point( SEG_START ) ) )
shape->SetStart( (wxPoint) m_editPoints->Point( SEG_START ).GetPosition() );
shape->SetStart( m_editPoints->Point( SEG_START ).GetPosition() );
else if( isModified( m_editPoints->Point( SEG_END ) ) )
shape->SetEnd( (wxPoint) m_editPoints->Point( SEG_END ).GetPosition() );
shape->SetEnd( m_editPoints->Point( SEG_END ).GetPosition() );
break;
@ -1072,7 +1072,7 @@ void PCB_POINT_EDITOR::updateItem() const
{
if( isModified( m_editPoints->Point( RECT_TOP_LEFT ) ) )
{
shape->SetStart( (wxPoint) m_editPoints->Point( RECT_TOP_LEFT ).GetPosition() );
shape->SetStart( m_editPoints->Point( RECT_TOP_LEFT ).GetPosition() );
}
else if( isModified( m_editPoints->Point( RECT_TOP_RIGHT ) ) )
{
@ -1081,7 +1081,7 @@ void PCB_POINT_EDITOR::updateItem() const
}
else if( isModified( m_editPoints->Point( RECT_BOT_RIGHT ) ) )
{
shape->SetEnd( (wxPoint) m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition() );
shape->SetEnd( m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition() );
}
else if( isModified( m_editPoints->Point( RECT_BOT_LEFT ) ) )
{
@ -1185,16 +1185,16 @@ void PCB_POINT_EDITOR::updateItem() const
case SHAPE_T::BEZIER:
if( isModified( m_editPoints->Point( BEZIER_CURVE_START ) ) )
shape->SetStart( (wxPoint) m_editPoints->Point( BEZIER_CURVE_START ).
shape->SetStart( m_editPoints->Point( BEZIER_CURVE_START ).
GetPosition() );
else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ) ) )
shape->SetBezierC1( (wxPoint) m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).
shape->SetBezierC1( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).
GetPosition() );
else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ) ) )
shape->SetBezierC2( (wxPoint) m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).
shape->SetBezierC2( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).
GetPosition() );
else if( isModified( m_editPoints->Point( BEZIER_CURVE_END ) ) )
shape->SetEnd( (wxPoint) m_editPoints->Point( BEZIER_CURVE_END ).GetPosition() );
shape->SetEnd( m_editPoints->Point( BEZIER_CURVE_END ).GetPosition() );
shape->RebuildBezierToSegmentsPointsList( shape->GetWidth() );
break;
@ -1218,7 +1218,7 @@ void PCB_POINT_EDITOR::updateItem() const
{
case PAD_SHAPE::CIRCLE:
{
VECTOR2I end = (wxPoint) m_editPoints->Point( 0 ).GetPosition();
VECTOR2I end = m_editPoints->Point( 0 ).GetPosition();
int diameter = (int) EuclideanNorm( end - pad->GetPosition() ) * 2;
pad->SetSize( wxSize( diameter, diameter ) );
@ -1266,12 +1266,12 @@ void PCB_POINT_EDITOR::updateItem() const
}
wxSize padSize( dist[0] + dist[2], dist[1] + dist[3] );
wxPoint deltaOffset( padSize.x / 2 - dist[2], padSize.y / 2 - dist[3] );
VECTOR2I deltaOffset( padSize.x / 2 - dist[2], padSize.y / 2 - dist[3] );
if( pad->GetOrientation() == 900 || pad->GetOrientation() == 2700 )
std::swap( padSize.x, padSize.y );
RotatePoint( &deltaOffset, -pad->GetOrientation() );
RotatePoint( deltaOffset, -pad->GetOrientation() );
pad->SetSize( padSize );
pad->SetOffset( -deltaOffset );
@ -1304,7 +1304,7 @@ void PCB_POINT_EDITOR::updateItem() const
std::swap( padSize.x, padSize.y );
pad->SetSize( padSize );
pad->SetPosition( wxPoint( ( left + right ) / 2, ( top + bottom ) / 2 ) );
pad->SetPosition( VECTOR2I( ( left + right ) / 2, ( top + bottom ) / 2 ) );
}
}
break;
@ -1376,7 +1376,7 @@ void PCB_POINT_EDITOR::updateItem() const
}
else if( isModified( m_editPoints->Point( DIM_START ) ) )
{
dimension->SetStart( (wxPoint) m_editedPoint->GetPosition() );
dimension->SetStart( m_editedPoint->GetPosition() );
dimension->Update();
m_editPoints->Point( DIM_CROSSBARSTART ).
@ -1388,7 +1388,7 @@ void PCB_POINT_EDITOR::updateItem() const
}
else if( isModified( m_editPoints->Point( DIM_END ) ) )
{
dimension->SetEnd( (wxPoint) m_editedPoint->GetPosition() );
dimension->SetEnd( m_editedPoint->GetPosition() );
dimension->Update();
m_editPoints->Point( DIM_CROSSBARSTART ).
@ -1402,7 +1402,7 @@ void PCB_POINT_EDITOR::updateItem() const
{
// Force manual mode if we weren't already in it
dimension->SetTextPositionMode( DIM_TEXT_POSITION::MANUAL );
dimension->Text().SetPosition( wxPoint( m_editedPoint->GetPosition() ) );
dimension->Text().SetPosition( m_editedPoint->GetPosition() );
dimension->Update();
}
@ -1457,17 +1457,17 @@ void PCB_POINT_EDITOR::updateItem() const
}
else if( isModified( m_editPoints->Point( DIM_START ) ) )
{
dimension->SetStart( (wxPoint) m_editedPoint->GetPosition() );
dimension->SetStart( m_editedPoint->GetPosition() );
}
else if( isModified( m_editPoints->Point( DIM_END ) ) )
{
dimension->SetEnd( (wxPoint) m_editedPoint->GetPosition() );
dimension->SetEnd( m_editedPoint->GetPosition() );
}
else if( isModified( m_editPoints->Point(DIM_TEXT ) ) )
{
// Force manual mode if we weren't already in it
dimension->SetTextPositionMode( DIM_TEXT_POSITION::MANUAL );
dimension->Text().SetPosition( wxPoint( m_editedPoint->GetPosition() ) );
dimension->Text().SetPosition( VECTOR2I( m_editedPoint->GetPosition() ) );
}
dimension->Update();
@ -1481,9 +1481,9 @@ void PCB_POINT_EDITOR::updateItem() const
PCB_DIM_CENTER* dimension = static_cast<PCB_DIM_CENTER*>( item );
if( isModified( m_editPoints->Point( DIM_START ) ) )
dimension->SetStart( (wxPoint) m_editedPoint->GetPosition() );
dimension->SetStart( m_editedPoint->GetPosition() );
else if( isModified( m_editPoints->Point( DIM_END ) ) )
dimension->SetEnd( (wxPoint) m_editedPoint->GetPosition() );
dimension->SetEnd( m_editedPoint->GetPosition() );
dimension->Update();
@ -1497,7 +1497,7 @@ void PCB_POINT_EDITOR::updateItem() const
if( isModified( m_editPoints->Point( DIM_START ) ) )
{
dimension->SetStart( (VECTOR2I) m_editedPoint->GetPosition() );
dimension->SetStart( m_editedPoint->GetPosition() );
dimension->Update();
m_editPoints->Point( DIM_KNEE ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_START ),
@ -1507,7 +1507,7 @@ void PCB_POINT_EDITOR::updateItem() const
{
VECTOR2I oldKnee = dimension->GetKnee();
dimension->SetEnd( (VECTOR2I) m_editedPoint->GetPosition() );
dimension->SetEnd( m_editedPoint->GetPosition() );
dimension->Update();
VECTOR2I kneeDelta = dimension->GetKnee() - oldKnee;
@ -1532,7 +1532,7 @@ void PCB_POINT_EDITOR::updateItem() const
}
else if( isModified( m_editPoints->Point( DIM_TEXT ) ) )
{
dimension->Text().SetPosition( (wxPoint) m_editedPoint->GetPosition() );
dimension->Text().SetPosition( m_editedPoint->GetPosition() );
dimension->Update();
}
@ -1747,11 +1747,13 @@ void PCB_POINT_EDITOR::updatePoints()
std::swap( halfSize.x, halfSize.y );
m_editPoints->Point( RECT_TOP_LEFT ).SetPosition( shapePos - halfSize );
m_editPoints->Point( RECT_TOP_RIGHT ).SetPosition( wxPoint( shapePos.x + halfSize.x,
shapePos.y - halfSize.y ) );
m_editPoints->Point( RECT_TOP_RIGHT )
.SetPosition(
VECTOR2I( shapePos.x + halfSize.x, shapePos.y - halfSize.y ) );
m_editPoints->Point( RECT_BOT_RIGHT ).SetPosition( shapePos + halfSize );
m_editPoints->Point( RECT_BOT_LEFT ).SetPosition( wxPoint( shapePos.x - halfSize.x,
shapePos.y + halfSize.y ) );
m_editPoints->Point( RECT_BOT_LEFT )
.SetPosition(
VECTOR2I( shapePos.x - halfSize.x, shapePos.y + halfSize.y ) );
}
break;
@ -2170,7 +2172,7 @@ int PCB_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
VECTOR2I nearestPoint = seg.NearestPoint( cursorPos );
// Move the end of the line to the break point..
graphicItem->SetEnd( wxPoint( nearestPoint.x, nearestPoint.y ) );
graphicItem->SetEnd( VECTOR2I( nearestPoint.x, nearestPoint.y ) );
if( graphicItem->Type() == PCB_FP_SHAPE_T )
static_cast<FP_SHAPE*>( graphicItem )->SetLocalCoord();
@ -2190,8 +2192,8 @@ int PCB_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
}
newSegment->ClearSelected();
newSegment->SetStart( wxPoint( nearestPoint.x, nearestPoint.y ) );
newSegment->SetEnd( wxPoint( seg.B.x, seg.B.y ) );
newSegment->SetStart( VECTOR2I( nearestPoint.x, nearestPoint.y ) );
newSegment->SetEnd( VECTOR2I( seg.B.x, seg.B.y ) );
if( newSegment->Type() == PCB_FP_SHAPE_T )
static_cast<FP_SHAPE*>( newSegment )->SetLocalCoord();