28#include "dialog_table_properties.h"
35#include <dialogs/dialog_text_properties.h>
61#include <wx/filedlg.h>
121 _(
"Specify custom track and via sizes" ), wxITEM_CHECK );
130 if(
via.m_Drill > 0 )
132 msg.Printf(
_(
"Via %s, hole %s" ),
138 msg.Printf(
_(
"Via %s" ),
143 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
152 int id = aEvent.GetId();
210 auto activeToolFunctor =
229 auto canCloseOutline =
249 auto tuningToolActive =
255 auto dimensionToolActive =
283 std::shared_ptr<VIA_SIZE_MENU> viaSizeMenu = std::make_shared<VIA_SIZE_MENU>();
284 viaSizeMenu->SetTool(
this );
285 m_menu->RegisterSubMenu( viaSizeMenu );
286 ctxMenu.
AddMenu( viaSizeMenu.get(), viaToolActive, 500 );
345 m_frame->DisplayConstraintsMsg(
_(
"Constrain to H, V, 45" ) );
348 m_frame->DisplayConstraintsMsg(
_(
"Constrain to H, V" ) );
351 m_frame->DisplayConstraintsMsg( wxString(
"" ) );
372 std::optional<VECTOR2D> startingPoint;
373 std::stack<PCB_SHAPE*> committedLines;
384 while(
drawShape( aEvent, &line, startingPoint, &committedLines ) )
389 commit.
Push(
_(
"Draw Line" ) );
391 committedLines.push( line );
395 startingPoint = std::nullopt;
422 std::optional<VECTOR2D> startingPoint;
435 while(
drawShape( aEvent, &rect, startingPoint,
nullptr ) )
439 bool cancelled =
false;
442 cancelled =
m_frame->ShowTextBoxPropertiesDialog( textbox ) != wxID_OK;
453 commit.
Push( isTextBox ?
_(
"Draw Text Box" ) :
_(
"Draw Rectangle" ) );
463 startingPoint = std::nullopt;
484 std::optional<VECTOR2D> startingPoint;
487 circle->SetFilled(
false );
501 commit.
Push(
_(
"Draw Circle" ) );
508 circle->SetFilled(
false );
511 startingPoint = std::nullopt;
532 std::optional<VECTOR2D> startingPoint;
543 while(
drawArc( aEvent, &arc, startingPoint ) )
548 commit.
Push(
_(
"Draw Arc" ) );
557 startingPoint = std::nullopt;
587 std::unique_ptr<PCB_SHAPE> bezier =
591 startingPoint = std::nullopt;
592 startingC1 = std::nullopt;
598 commit.
Add( bezier.release() );
599 commit.
Push(
_(
"Draw Bezier" ) );
604 startingPoint = bezierRef.
GetEnd();
629 bool immediateMode =
image !=
nullptr;
631 bool ignorePrimePosition =
false;
643 image->SetPosition( cursorPos );
664 m_view->RecacheAllItems();
689 ignorePrimePosition =
true;
698 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
702 m_controls->ForceCursorPosition(
true, cursorPos );
722 else if( evt->IsActivate() )
724 if(
image && evt->IsMoveTool() )
727 evt->SetPassEvent(
false );
733 m_frame->ShowInfoBarMsg(
_(
"Press <ESC> to cancel image creation." ) );
734 evt->SetPassEvent(
false );
738 if( evt->IsMoveTool() )
755 wxFileDialog dlg(
m_frame,
_(
"Choose Image" ), wxEmptyString, wxEmptyString,
760 bool cancelled =
false;
765 cancelled = dlg.ShowModal() != wxID_OK;
774 if( evt->IsPrime() && !ignorePrimePosition )
776 cursorPos =
grid.Align( evt->Position() );
787 wxString fullFilename = dlg.GetPath();
789 if( wxFileExists( fullFilename ) )
792 if( !
image || !
image->GetReferenceImage().ReadImageFile( fullFilename ) )
794 wxMessageBox( wxString::Format(
_(
"Could not load image from '%s'." ), fullFilename ) );
805 m_view->RecacheAllItems();
810 m_view->ShowPreview(
true );
815 commit.Push(
_(
"Place Image" ) );
840 || evt->IsMotion() ) )
842 image->SetPosition( cursorPos );
845 m_view->RecacheAllItems();
878 m_gridHelper( aDrawingTool.GetManager(), aFrame.GetMagneticItemsSettings() )
884 std::unique_ptr<PCB_POINT> new_point = std::make_unique<PCB_POINT>(
m_frame.GetModel() );
887 new_point->SetLayer( layer );
941 bool ignorePrimePosition =
false;
987 ignorePrimePosition =
true;
996 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
998 { m_frame->GetActiveLayer() },
GRID_TEXT ),
1000 m_controls->ForceCursorPosition(
true, cursorPos );
1006 else if( evt->IsCancelInteractive() || (
text && evt->IsAction( &
ACTIONS::undo ) ) )
1018 else if( evt->IsActivate() )
1023 if( evt->IsMoveTool() )
1041 else if( evt->IsClick(
BUT_LEFT ) )
1043 bool placing =
text !=
nullptr;
1068 text->SetLayer( layer );
1069 text->SetAttributes( textAttrs );
1070 text->SetTextPos( cursorPos );
1088 else if(
text->GetTextPos() != cursorPos )
1097 if( !
m_view->IsLayerVisible(
text->GetLayer() ) )
1099 m_frame->GetAppearancePanel()->SetLayerVisible(
text->GetLayer(),
true );
1100 m_frame->GetCanvas()->Refresh();
1117 commit.
Push(
_(
"Draw Text" ) );
1129 if( evt->IsPrime() && !ignorePrimePosition )
1131 cursorPos = evt->Position();
1132 m_controls->WarpMouseCursor( cursorPos,
true );
1136 m_controls->PinCursorInsideNonAutoscrollArea(
true );
1148 text->SetPosition( cursorPos );
1166 evt->SetPassEvent();
1238 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
1240 { m_frame->GetActiveLayer() },
GRID_TEXT ),
1242 m_controls->ForceCursorPosition(
true, cursorPos );
1248 else if( evt->IsCancelInteractive() || (
table && evt->IsAction( &
ACTIONS::undo ) ) )
1260 else if( evt->IsActivate() )
1265 if( evt->IsMoveTool() )
1284 else if( evt->IsClick(
BUT_LEFT ) )
1294 table->SetLayer( layer );
1295 table->SetColCount( 1 );
1298 table->SetLayer( layer );
1299 table->SetPosition( cursorPos );
1301 if( !
m_view->IsLayerVisible( layer ) )
1303 m_frame->GetAppearancePanel()->SetLayerVisible( layer,
true );
1304 m_frame->GetCanvas()->Refresh();
1336 commit.
Push(
_(
"Draw Table" ) );
1350 VECTOR2I requestedSize( cursorPos - origin );
1352 int colCount = std::max( 1, requestedSize.
x / ( fontSize.
x * 15 ) );
1353 int rowCount = std::max( 1, requestedSize.
y / ( fontSize.
y * 3 ) );
1355 VECTOR2I cellSize( std::max( fontSize.
x * 5, requestedSize.
x / colCount ),
1356 std::max( fontSize.
y * 3, requestedSize.
y / rowCount ) );
1358 cellSize.
x =
KiROUND( (
double) cellSize.
x / gridSize.
x ) * gridSize.
x;
1359 cellSize.
y =
KiROUND( (
double) cellSize.
y / gridSize.
y ) * gridSize.
y;
1361 table->ClearCells();
1362 table->SetColCount( colCount );
1364 for(
int col = 0; col < colCount; ++col )
1365 table->SetColWidth( col, cellSize.
x );
1367 for(
int row = 0; row < rowCount; ++row )
1369 table->SetRowHeight( row, cellSize.
y );
1371 for(
int col = 0; col < colCount; ++col )
1376 table->AddCell( cell );
1397 evt->SetPassEvent();
1471 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
1473 { m_frame->GetActiveLayer() },
GRID_TEXT ),
1475 m_controls->ForceCursorPosition(
true, cursorPos );
1481 else if( evt->IsCancelInteractive() || ( barcode && evt->IsAction( &
ACTIONS::undo ) ) )
1493 else if( evt->IsActivate() )
1498 if( evt->IsMoveTool() )
1516 else if( evt->IsClick(
BUT_LEFT ) )
1543 if( !
m_view->IsLayerVisible( layer ) )
1545 m_frame->GetAppearancePanel()->SetLayerVisible( layer,
true );
1546 m_frame->GetCanvas()->Refresh();
1549 commit.
Add( barcode );
1550 commit.
Push(
_(
"Draw Barcode" ) );
1560 evt->SetPassEvent();
1584 enum DIMENSION_STEPS
1599 int step = SET_ORIGIN;
1612 m_view->Update( &preview );
1615 dimension =
nullptr;
1644 if( step > SET_ORIGIN )
1645 frame()->SetMsgPanel( dimension );
1651 if( evt->Modifier(
MD_CTRL ) )
1654 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
1662 grid.SetUseGrid(
false );
1666 VECTOR2I cursorPos = evt->HasPosition() ? evt->Position() :
m_controls->GetMousePosition();
1670 m_controls->ForceCursorPosition(
true, cursorPos );
1672 if( evt->IsCancelInteractive() || ( dimension && evt->IsAction( &
ACTIONS::undo ) ) )
1676 if( step != SET_ORIGIN )
1686 else if( evt->IsActivate() )
1688 if( step != SET_ORIGIN )
1691 if( evt->IsPointEditor() )
1695 else if( evt->IsMoveTool() )
1710 m_view->Update( &preview );
1711 frame()->SetMsgPanel( dimension );
1719 m_view->Update( &preview );
1720 frame()->SetMsgPanel( dimension );
1741 auto setMeasurementAttributes =
1755 setMeasurementAttributes( dimension );
1760 setMeasurementAttributes( dimension );
1769 setMeasurementAttributes( dimension );
1778 wxFAIL_MSG( wxT(
"Unhandled action in DRAWING_TOOL::DrawDimension" ) );
1781 t = dimension->
Type();
1792 dimension->
SetEnd( cursorPos );
1795 if( !
m_view->IsLayerVisible( layer ) )
1797 m_frame->GetAppearancePanel()->SetLayerVisible( layer,
true );
1798 m_frame->GetCanvas()->Refresh();
1801 preview.
Add( dimension );
1802 frame()->SetMsgPanel( dimension );
1828 preview.
Remove( dimension );
1830 commit.
Add( dimension );
1831 commit.
Push(
_(
"Draw Dimension" ) );
1835 frame()->OnEditItemRequest( dimension );
1842 if( ++step >= FINISHED )
1844 dimension =
nullptr;
1849 else if( evt->IsDblClick(
BUT_LEFT ) )
1854 else if( evt->IsMotion() )
1859 dimension->
SetEnd( cursorPos );
1883 textOffset = -textOffset;
1892 textOffset = -textOffset;
1909 double height = (
delta.x * cos( angle ) ) + (
delta.y * sin( angle ) );
1947 ortho->SetHeight( vert ? heightVector.
x : heightVector.
y );
1955 m_view->Update( &preview );
1961 if( !
m_view->IsLayerVisible( layer ) )
1963 m_frame->GetAppearancePanel()->SetLayerVisible( layer,
true );
1964 m_frame->GetCanvas()->Refresh();
1974 m_view->Update( &preview );
1975 frame()->SetMsgPanel( dimension );
1979 if( step == SET_END || step == SET_HEIGHT )
1981 frame()->OnEditItemRequest( dimension );
1983 frame()->SetMsgPanel( dimension );
1993 switch( dimension->
Type() )
2008 m_view->Update( &preview );
2017 evt->SetPassEvent();
2021 if( step != SET_ORIGIN )
2029 m_view->Remove( &preview );
2058 if( dlgResult != wxID_OK )
2064 wxMessageBox(
_(
"No graphic items found in file.") );
2070 std::vector<BOARD_ITEM*> newItems;
2071 std::vector<BOARD_ITEM*> selectedItems;
2079 size_t boardItemCount = std::count_if( list.begin(), list.end(),
2080 [](
const std::unique_ptr<EDA_ITEM>& ptr )
2082 return ptr->IsBOARD_ITEM();
2085 if( boardItemCount >= 2 )
2089 newItems.push_back(
group );
2090 selectedItems.push_back(
group );
2097 std::vector<PCB_SHAPE*> shapeList;
2099 for(
const std::unique_ptr<EDA_ITEM>& ptr : list )
2102 shapeList.push_back( shape );
2108 for( std::unique_ptr<EDA_ITEM>& ptr : list )
2110 EDA_ITEM* eda_item = ptr.release();
2116 newItems.push_back( item );
2119 group->AddItem( item );
2121 selectedItems.push_back( item );
2126 preview.
Add( eda_item );
2132 EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() );
2140 commit.
Push(
_(
"Import Graphics" ) );
2148 if( !
m_view->IsLayerVisible( layer ) )
2150 m_frame->GetAppearancePanel()->SetLayerVisible( layer,
true );
2151 m_frame->GetCanvas()->Refresh();
2179 item->Move(
delta );
2181 m_view->Update( &preview );
2189 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
2192 m_controls->ForceCursorPosition(
true, cursorPos );
2194 if( evt->IsCancelInteractive() || evt->IsActivate() )
2206 else if( evt->IsMotion() )
2211 item->Move(
delta );
2213 m_view->Update( &preview );
2225 commit.
Push(
_(
"Import Graphics" ) );
2235 evt->SetPassEvent();
2240 m_view->Remove( &preview );
2292 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
2294 m_controls->ForceCursorPosition(
true, cursorPos );
2304 footprint->MoveAnchorPosition( moveVector );
2306 commit.
Push(
_(
"Move Footprint Anchor" ) );
2317 else if( evt->IsCancelInteractive() || evt->IsActivate() )
2324 evt->SetPassEvent();
2350 std::optional<VECTOR2D> aStartingPoint,
2351 std::stack<PCB_SHAPE*>* aCommittedGraphics )
2353 SHAPE_T shape = ( *aGraphic )->GetShape();
2394 m_view->Add( &twoPointAsst );
2396 bool started =
false;
2397 bool cancelled =
false;
2398 bool isLocalOriginSet = (
m_frame->GetScreen()->m_LocalOrigin !=
VECTOR2D( 0, 0 ) );
2415 if( !isLocalOriginSet )
2426 if( aStartingPoint )
2427 m_toolMgr->PrimeTool( *aStartingPoint );
2435 m_frame->SetMsgPanel( graphic );
2439 if( evt->Modifier(
MD_CTRL ) )
2446 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
2449 m_controls->ForceCursorPosition(
true, cursorPos );
2451 if( evt->IsCancelInteractive() || ( started && evt->IsAction( &
ACTIONS::undo ) ) )
2458 evt->SetPassEvent(
false );
2465 else if( evt->IsActivate() )
2467 if( evt->IsPointEditor() )
2471 else if( evt->IsMoveTool() )
2510 m_frame->GetCanvas()->Refresh();
2520 frame()->SetMsgPanel( graphic );
2524 evt->SetPassEvent();
2543 if( aStartingPoint )
2545 cursorPos = *aStartingPoint;
2546 aStartingPoint = std::nullopt;
2561 grid.SetSkipPoint( cursorPos );
2564 twoPointMgr.
SetEnd( cursorPos );
2566 if( !isLocalOriginSet )
2567 m_frame->GetScreen()->m_LocalOrigin = cursorPos;
2570 frame()->SetMsgPanel( graphic );
2577 m_frame->GetCanvas()->Refresh();
2593 commit.
Add( graphic );
2594 commit.
Push(
_(
"Draw Line" ) );
2607 twoPointMgr.
Reset();
2613 else if( evt->IsMotion() )
2615 VECTOR2I clampedCursorPos = cursorPos;
2639 twoPointMgr.
SetEnd( clampedCursorPos );
2645 m_view->Update( &twoPointAsst );
2650 if( aCommittedGraphics && !aCommittedGraphics->empty() )
2652 twoPointMgr.
SetOrigin( aCommittedGraphics->top()->GetStart() );
2653 twoPointMgr.
SetEnd( aCommittedGraphics->top()->GetEnd() );
2654 aCommittedGraphics->pop();
2667 m_view->Update( &twoPointAsst );
2680 frame()->SetMsgPanel( graphic );
2689 frame()->SetMsgPanel( graphic );
2694 frame()->OnEditItemRequest( graphic );
2696 frame()->SetMsgPanel( graphic );
2705 isLocalOriginSet =
true;
2706 evt->SetPassEvent();
2712 userUnits =
frame()->GetUserUnits();
2713 twoPointAsst.
SetUnits( userUnits );
2714 m_view->Update( &twoPointAsst );
2716 evt->SetPassEvent();
2720 evt->SetPassEvent();
2724 if( !isLocalOriginSet )
2727 m_view->Remove( &twoPointAsst );
2770 std::optional<VECTOR2D> aStartingPoint )
2772 wxCHECK( aGraphic,
false );
2776 wxCHECK( graphic,
false );
2809 *aGraphic =
nullptr;
2817 bool started =
false;
2818 bool cancelled =
false;
2822 if( aStartingPoint )
2823 m_toolMgr->PrimeTool( *aStartingPoint );
2829 m_frame->SetMsgPanel( graphic );
2838 if( evt->Modifier(
MD_CTRL ) )
2841 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
2845 m_controls->ForceCursorPosition(
true, cursorPos );
2847 if( evt->IsCancelInteractive() || ( started && evt->IsAction( &
ACTIONS::undo ) ) )
2854 evt->SetPassEvent(
false );
2861 else if( evt->IsActivate() )
2863 if( evt->IsPointEditor() )
2867 else if( evt->IsMoveTool() )
2882 else if( evt->IsClick(
BUT_LEFT ) )
2899 m_frame->GetCanvas()->Refresh();
2902 preview.
Add( graphic );
2903 frame()->SetMsgPanel( graphic );
2907 arcManager.
AddPoint( cursorPos,
true );
2913 else if( evt->IsMotion() )
2919 arcManager.
AddPoint( cursorPos,
false );
2936 m_frame->GetCanvas()->Refresh();
2941 m_view->Update( &preview );
2942 frame()->SetMsgPanel( graphic );
2946 evt->SetPassEvent();
2954 frame()->OnEditItemRequest( graphic );
2955 m_view->Update( &preview );
2956 frame()->SetMsgPanel( graphic );
2963 frame()->OnEditItemRequest( graphic );
2964 m_view->Update( &preview );
2965 frame()->SetMsgPanel( graphic );
2970 evt->SetPassEvent();
2987 m_view->Update( &preview );
2988 frame()->SetMsgPanel( graphic );
3000 m_view->Update( &preview );
3001 frame()->SetMsgPanel( graphic );
3012 m_view->Update( &arcAsst );
3013 evt->SetPassEvent();
3022 evt->SetPassEvent();
3032 m_view->Update( &preview );
3033 m_view->Update( &arcAsst );
3036 frame()->SetMsgPanel( graphic );
3042 preview.
Remove( graphic );
3043 m_view->Remove( &arcAsst );
3044 m_view->Remove( &preview );
3065 std::unique_ptr<PCB_SHAPE> bezier = std::make_unique<PCB_SHAPE>(
m_frame->GetModel() );
3067 bezier->SetFlags(
IS_NEW );
3086 m_view->Add( &bezierAsst );
3089 const auto setCursor =
3095 const auto resetProgress =
3107 const auto started =
3114 bool priming =
false;
3119 if( aStartingPoint )
3123 if( aStartingControl1Point )
3125 bezierManager.
AddPoint( *aStartingPoint,
true );
3126 bezierManager.
AddPoint( *aStartingControl1Point,
true );
3127 m_toolMgr->PrimeTool( *aStartingControl1Point );
3131 bezierManager.
AddPoint( *aStartingPoint,
true );
3132 m_toolMgr->PrimeTool( *aStartingPoint );
3140 m_frame->SetMsgPanel( bezier.get() );
3151 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
3155 m_controls->ForceCursorPosition(
true, cursorPos );
3157 if( evt->IsCancelInteractive() || ( started() && evt->IsAction( &
ACTIONS::undo ) ) )
3164 evt->SetPassEvent(
false );
3177 else if( evt->IsActivate() )
3179 if( evt->IsPointEditor() )
3183 else if( evt->IsMoveTool() )
3210 m_frame->GetCanvas()->Refresh();
3213 frame()->SetMsgPanel( bezier.get() );
3217 bezierManager.
AddPoint( cursorPos,
true );
3221 const bool doubleClick = evt->IsDblClick(
BUT_LEFT );
3227 bezierManager.
AddPoint( cursorPos,
true );
3231 preview.
Add( bezier.get() );
3246 preview.
Remove( bezier.get() );
3248 else if( evt->IsMotion() )
3254 bezierManager.
AddPoint( cursorPos,
false );
3269 m_frame->GetCanvas()->Refresh();
3274 m_view->Update( &preview );
3275 frame()->SetMsgPanel( bezier.get() );
3282 frame()->OnEditItemRequest( bezier.get() );
3283 m_view->Update( &preview );
3284 frame()->SetMsgPanel( bezier.get() );
3289 evt->SetPassEvent();
3301 m_view->Update( &preview );
3302 frame()->SetMsgPanel( bezier.get() );
3311 m_view->Update( &preview );
3312 frame()->SetMsgPanel( bezier.get() );
3318 m_view->Update( &bezierAsst );
3319 evt->SetPassEvent();
3328 evt->SetPassEvent();
3337 bezier->SetStart( bezierManager.
GetStart() );
3339 bezier->SetEnd( bezierManager.
GetEnd() );
3341 bezier->RebuildBezierToSegmentsPointsList( maxError );
3343 m_view->Update( &preview );
3344 m_view->Update( &bezierAsst );
3348 frame()->SetMsgPanel( bezier.get() );
3354 preview.
Remove( bezier.get() );
3355 m_view->Remove( &bezierAsst );
3356 m_view->Remove( &preview );
3372 bool clearSelection =
false;
3384 clearSelection =
true;
3395 if( clearSelection )
3429 ZONE* sourceZone =
nullptr;
3440 params.
m_mode = zoneMode;
3451 bool started =
false;
3465 polyGeomMgr.
Reset();
3467 grid.ClearSkipPoint();
3491 if( evt->Modifier(
MD_CTRL ) )
3494 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
3496 VECTOR2I cursorPos = evt->HasPosition() ? evt->Position() :
m_controls->GetMousePosition();
3499 m_controls->ForceCursorPosition(
true, cursorPos );
3503 if( evt->IsCancelInteractive() )
3514 evt->SetPassEvent(
false );
3518 else if( evt->IsActivate() )
3523 if( evt->IsPointEditor() )
3527 else if( evt->IsMoveTool() )
3545 m_frame->GetAppearancePanel()->SetLayerVisible( params.
m_layer,
true );
3546 m_frame->GetCanvas()->Refresh();
3562 const bool endPolygon = evt->IsDblClick(
BUT_LEFT )
3569 polyGeomMgr.
Reset();
3576 else if( polyGeomMgr.
AddPoint( cursorPos ) )
3587 m_frame->GetAppearancePanel()->SetLayerVisible( params.
m_layer,
true );
3588 m_frame->GetCanvas()->Refresh();
3599 cursorPos = last.value();
3601 m_controls->ForceCursorPosition(
true, cursorPos );
3609 else if( started && ( evt->IsMotion()
3635 evt->SetPassEvent();
3662 std::shared_ptr<DRC_ENGINE> m_drcEngine;
3664 int m_worstClearance;
3665 bool m_allowDRCViolations;
3672 m_worstClearance( 0 )
3690 m_worstClearance = std::max( m_worstClearance, constraint.
GetValue().
Min() );
3696 std::optional<int> padOverride =
pad->GetClearanceOverrides(
nullptr );
3698 if( padOverride.has_value() )
3699 m_worstClearance = std::max( m_worstClearance, padOverride.value() );
3708 virtual ~VIA_PLACER()
3726 const BOX2I bbox = getEffectiveBoundingBox( *aVia, aPosition );
3728 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> items;
3730 std::vector<PCB_TRACK*> possible_tracks;
3732 wxCHECK(
view,
nullptr );
3734 view->Query( bbox, items );
3738 if( !it.first->IsBOARD_ITEM() )
3753 possible_tracks.push_back( track );
3761 possible_tracks.push_back( arc );
3766 int min_d = std::numeric_limits<int>::max();
3768 for(
PCB_TRACK* track : possible_tracks )
3770 SEG test( track->GetStart(), track->GetEnd() );
3771 int dist = (
test.NearestPoint( aPosition ) - aPosition ).EuclideanNorm();
3776 return_track = track;
3780 return return_track;
3788 ZONE* zone =
dynamic_cast<ZONE*
>( aOther );
3814 int connectedItemNet = connectedItem->
GetNetCode();
3816 if( connectedItemNet == 0 || connectedItemNet == aVia->
GetNetCode() )
3834 if( viaShape->Collide( otherShape.get(),
clearance - m_drcEpsilon ) )
3856 bool checkDRCViolation(
PCB_VIA* aVia )
3858 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> items;
3859 std::set<BOARD_ITEM*> checkedItems;
3862 bbox.
Inflate( m_worstClearance );
3863 m_frame->GetCanvas()->GetView()->Query( bbox, items );
3865 for( std::pair<KIGFX::VIEW_ITEM*, int> it : items )
3867 if( !it.first->IsBOARD_ITEM() )
3885 else if( checkedItems.count( item ) )
3890 if( hasDRCViolation( aVia, item ) )
3893 checkedItems.insert( item );
3908 const BOX2I bbox = getEffectiveBoundingBox( *aVia, aPosition );
3911 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> items;
3913 view.Query( bbox, items );
3917 if( !it.first->IsBOARD_ITEM() )
3926 if(
pad.HitTest( aPosition ) )
3937 BOX2I bbox = getEffectiveBoundingBox( *aVia, aPosition );
3939 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> items;
3942 std::vector<PCB_SHAPE*> possible_shapes;
3944 view->Query( bbox, items );
3948 if( !it.first->IsBOARD_ITEM() )
3961 possible_shapes.push_back( shape );
3966 int min_d = std::numeric_limits<int>::max();
3968 for(
PCB_SHAPE* shape : possible_shapes )
3970 int dist = ( shape->GetPosition() - aPosition ).EuclideanNorm();
3975 return_shape = shape;
3979 return return_shape;
3982 std::optional<int> selectPossibleNetsByPopupMenu( std::set<int>& aNetcodeList )
3986 std::map<int, int> menuIDNetCodeMap;
3989 for(
int netcode : aNetcodeList )
3995 menuText = wxString::Format(
"%s\t",
3998 menuText = wxString::Format(
"&%d %s\t",
4009 menuIDNetCodeMap[ menuID ] = netcode;
4019 int selectedNetCode = -1;
4020 bool cancelled =
false;
4026 evt->SetPassEvent();
4030 std::optional<int>
id = evt->GetCommandId();
4033 if(
id && ( *
id > 0 ) && ( *
id < menuID ) )
4035 selectedNetCode = menuIDNetCodeMap.at( *
id );
4050 return std::optional<int>();
4052 return selectedNetCode;
4055 std::optional<int> findStitchedZoneNet(
PCB_VIA* aVia )
4059 std::set<int> netcodeList;
4069 if( z->IsOnLayer(
m_frame->GetActiveLayer() ) )
4071 if( z->HitTestFilledArea(
m_frame->GetActiveLayer(), position ) )
4072 netcodeList.insert( z->GetNetCode() );
4079 if( netcodeList.size() == 1 )
4080 return *netcodeList.begin();
4087 if( z->GetIsRuleArea() )
4092 if( z->IsOnLayer( layer ) )
4094 if( z->HitTestFilledArea( layer, position ) )
4095 netcodeList.insert( z->GetNetCode() );
4101 if( netcodeList.size() == 1 )
4102 return *netcodeList.begin();
4104 if( netcodeList.size() > 1 )
4107 return selectPossibleNetsByPopupMenu( netcodeList );
4132 SEG trackSeg( track->GetStart(), track->GetEnd() );
4142 if(
PAD*
pad = findPad(
via, position ) )
4153 if( shape->IsAnyFill() )
4159 double shapeArea = poly.
Area();
4161 int R =
via->GetWidth( shape->GetLayer() ) / 2;
4162 double viaArea =
M_PI * R * R;
4164 if( viaArea * 4 > shapeArea )
4169 switch( shape->GetShape() )
4173 SEG seg( shape->GetStart(), shape->GetEnd() );
4181 if( ( shape->GetEnd() - position ).SquaredEuclideanNorm() <
4182 ( shape->GetStart() - position ).SquaredEuclideanNorm() )
4196 if( !shape->IsPolyShapeValid() )
4203 std::optional<SEG> nearestSeg;
4204 int minDist = std::numeric_limits<int>::max();
4213 int dist = seg.
Distance( position );
4215 if( dist < minDist )
4254 via->SetIsFree(
false );
4258 via->SetNetCode(
pad->GetNetCode() );
4259 via->SetIsFree(
false );
4264 via->SetIsFree(
false );
4268 std::optional<int> netcode = findStitchedZoneNet(
via );
4270 if( !netcode.has_value() )
4273 via->SetNetCode( netcode.value() );
4274 via->SetIsFree(
via->GetNetCode() > 0 );
4277 if( checkDRCViolation(
via ) )
4279 m_frame->ShowInfoBarError(
_(
"Via location violates DRC." ),
true,
4280 WX_INFOBAR::MESSAGE_TYPE::DRC_VIOLATION );
4282 if( !m_allowDRCViolations )
4287 if( infobar->
GetMessageType() == WX_INFOBAR::MESSAGE_TYPE::DRC_VIOLATION )
4296 if( track && m_gridHelper.
GetSnap() )
4300 SEG trackSeg( trackStart, trackEnd );
4302 if( viaPos == trackStart || viaPos == trackEnd )
4316 newTrack->
SetEnd( trackEnd );
4317 aCommit.
Add( newTrack );
4323 std::unique_ptr<BOARD_ITEM> CreateItem()
override
4328 via->SetNetCode( 0 );
4341 if( first_layer !=
m_frame->GetScreen()->m_Route_Layer_TOP )
4342 last_layer =
m_frame->GetScreen()->m_Route_Layer_TOP;
4344 last_layer =
m_frame->GetScreen()->m_Route_Layer_BOTTOM;
4346 via->SetLayerPair( first_layer, last_layer );
4352 via->GetEffectiveNetClass()->GetuViaDiameter() );
4353 via->SetDrill(
via->GetEffectiveNetClass()->GetuViaDrill() );
4361 return std::unique_ptr<BOARD_ITEM>(
via );
4365 VIA_PLACER placer(
frame() );
constexpr EDA_IU_SCALE pcbIUScale
constexpr int ARC_LOW_DEF
@ HIDDEN
Inactive layers are hidden.
@ DIMMED
Inactive layers are dimmed (old high-contrast mode)
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION cancelInteractive
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
static TOOL_ACTION updateUnits
static TOOL_ACTION activatePointEditor
static TOOL_ACTION doDelete
static TOOL_ACTION cursorClick
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION refreshPreview
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
static TOOL_ACTION resetLocalCoords
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Container for design settings for a BOARD object.
DIM_PRECISION m_DimensionPrecision
Number of digits after the decimal.
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
VIATYPE m_CurrentViaType
(VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
DIM_UNITS_FORMAT m_DimensionUnitsFormat
bool GetTextUpright(PCB_LAYER_ID aLayer) const
int GetTextThickness(PCB_LAYER_ID aLayer) const
Return the default text thickness from the layer class for the given layer.
bool GetTextItalic(PCB_LAYER_ID aLayer) const
int GetCurrentViaSize() const
void SetViaSizeIndex(int aIndex)
Set the current via size list index to aIndex.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
bool m_UseConnectedTrackWidth
int GetViaSizeIndex() const
bool m_DimensionSuppressZeroes
int GetDRCEpsilon() const
Return an epsilon which accounts for rounding errors, etc.
bool m_DimensionKeepTextAligned
VECTOR2I GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
int GetCurrentViaDrill() const
DIM_TEXT_POSITION m_DimensionTextPosition
DIM_UNITS_MODE m_DimensionUnitsMode
std::vector< VIA_DIMENSION > m_ViasDimensionsList
int m_DimensionExtensionOffset
int m_DimensionArrowLength
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
virtual std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const
virtual bool HasHole() const
const FOOTPRINTS & Footprints() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr size_type GetWidth() const
constexpr Vec Centre() const
constexpr size_type GetHeight() const
constexpr coord_type GetLeft() const
constexpr bool Contains(const Vec &aPoint) const
constexpr void Move(const Vec &aMoveVector)
Move the rectangle by the aMoveVector.
constexpr coord_type GetRight() const
constexpr coord_type GetTop() const
constexpr coord_type GetBottom() const
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
DIALOG_BARCODE_PROPERTIES, derived from DIALOG_BARCODE_PROPERTIES_BASE, created by wxFormBuilder.
std::list< std::unique_ptr< EDA_ITEM > > & GetImportedItems()
bool ShouldFixDiscontinuities()
void SetFilenameOverride(const wxString &aFilenameOverride)
Set the filename override to be applied in TransferDataToWindow.
bool IsPlacementInteractive()
Implementing DIALOG_TRACK_VIA_SIZE_BASE.
SEVERITY GetSeverity() const
const MINOPTMAX< int > & GetValue() const
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
virtual void SetPosition(const VECTOR2I &aPos)
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
const VECTOR2I & GetBezierC2() const
void SetCenter(const VECTOR2I &aCenter)
virtual void SetFilled(bool aFlag)
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
void SetStart(const VECTOR2I &aStart)
void SetShape(SHAPE_T aShape)
void SetEnd(const VECTOR2I &aEnd)
void SetArcAngleAndEnd(const EDA_ANGLE &aAngle, bool aCheckNegativeAngle=false)
Set the end point from the angle center and start.
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
virtual bool IsVisible() const
void SetTextPos(const VECTOR2I &aPoint)
void SetMirrored(bool isMirrored)
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
A color representation with 4 components: red, green, blue, alpha.
Represents an assistant draw when interactively drawing an arc on a canvas.
void SetUnits(EDA_UNITS aUnits)
Manage the construction of a circular arc though sequential setting of critical points: center,...
VECTOR2I GetOrigin() const
< Get the center point of the arc (valid when state > SET_ORIGIN)
void SetAngleSnap(bool aSnap)
ARC_STEPS GetStep() const
Get the current step the manager is on (useful when drawing something depends on the current state)
void ToggleClockwise()
Set angle snapping (for the next point)
VECTOR2I GetStartRadiusEnd() const
Get the coordinates of the arc end point.
VECTOR2I GetEndRadiusEnd() const
Get the radius of the arc (valid if step >= SET_START)
EDA_ANGLE GetSubtended() const
@ SET_ANGLE
Waiting to lock in the arc end point.
@ SET_START
Waiting to lock in the arc start point.
Represents an assistant draw when interactively drawing a bezier on a canvas.
void SetUnits(EDA_UNITS aUnits)
Manage the construction of a bezier through a series of steps.
VECTOR2I GetControlC2() const
Get the coordinates of the arc end point.
VECTOR2I GetControlC1() const
VECTOR2I GetStart() const
< Get the center point of the arc (valid when state > SET_ORIGIN)
@ SET_END
Waiting to lock in the end point.
@ SET_START
Waiting to lock in the start point.
BEZIER_STEPS GetStep() const
Get the current step the manager is on (useful when drawing something depends on the current state)
bool HasGeometryChanged() const
void AddPoint(const VECTOR2I &aPt, bool aLockIn)
Add a point to the construction manager.
void RemoveLastPoint()
Undo the last point, and move the manager back to the previous step.
Represents an assistant draw when interactively drawing a line or circle on a canvas.
void SetUnits(EDA_UNITS aUnits)
Represent a very simple geometry manager for items that have a start and end point.
void SetOrigin(const VECTOR2I &aOrigin)
< Set the origin of the ruler (the fixed end)
void SetAngleSnap(LEADER_MODE aSnap)
VECTOR2I GetOrigin() const
void Reset()
Reset the manager to the initial state.
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the end that moves with the cursor.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const std::set< int > & GetHighlightNetCodes() const
Return the netcode of currently highlighted net.
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
virtual void WarpMouseCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Return the current mouse pointer position.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
virtual void PinCursorInsideNonAutoscrollArea(bool aWarpMouseCursor)=0
bool IsBOARD_ITEM() const
std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllLayersMask()
static LSET AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
const wxString & GetNetname() const
Container for NETINFO_ITEM elements, which are the nets.
static const int ORPHANED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
NETINFO_ITEM * GetNetItem(int aNetCode) const
void ForEachUniqueLayer(const std::function< void(PCB_LAYER_ID)> &aMethod) const
Runs the given callable for each active unique copper layer in this padstack, meaning F_Cu for MODE::...
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
static TOOL_ACTION deleteLastPoint
static TOOL_ACTION drawRuleArea
static TOOL_ACTION changeDimensionArrows
Switch between dimension arrow directions.
static TOOL_ACTION drawBezier
static TOOL_ACTION placeText
static TOOL_ACTION drawOrthogonalDimension
static TOOL_ACTION drawRectangle
static TOOL_ACTION setAnchor
static TOOL_ACTION placeReferenceImage
static TOOL_ACTION drawCircle
static TOOL_ACTION tuneDiffPair
static TOOL_ACTION trackViaSizeChanged
static TOOL_ACTION layerChanged
static TOOL_ACTION drawTable
static TOOL_ACTION drawTextBox
static TOOL_ACTION drawZoneCutout
static TOOL_ACTION drawPolygon
static TOOL_ACTION drawRadialDimension
static TOOL_ACTION tuneSingleTrack
static TOOL_ACTION properties
Activation of the edit tool.
static TOOL_ACTION drawLeader
static TOOL_ACTION tuneSkew
static TOOL_ACTION incWidth
Increase width of currently drawn line.
static TOOL_ACTION clearHighlight
static TOOL_ACTION spacingDecrease
static TOOL_ACTION placeImportedGraphics
static TOOL_ACTION drawVia
static TOOL_ACTION drawArc
static TOOL_ACTION drawSimilarZone
static TOOL_ACTION decWidth
Decrease width of currently drawn line.
static TOOL_ACTION drawCenterDimension
static TOOL_ACTION arcPosture
Switch posture when drawing arc.
static TOOL_ACTION ddImportGraphics
static TOOL_ACTION placeBarcode
static TOOL_ACTION placePoint
static TOOL_ACTION closeOutline
static TOOL_ACTION amplIncrease
static TOOL_ACTION amplDecrease
static TOOL_ACTION lengthTunerSettings
static TOOL_ACTION spacingIncrease
static TOOL_ACTION drawLine
static TOOL_ACTION drawAlignedDimension
static TOOL_ACTION drawZone
virtual bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void SetTextSize(int aTextSize)
Change the height of the human-readable text displayed below the barcode.
void SetPosition(const VECTOR2I &aPos) override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the drawing layer for the barcode and its text.
Common, abstract interface for edit frames.
wxString GetDesignRulesPath()
Return the absolute path to the design rules file for the currently-loaded board.
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
void Update()
Update the dimension's cached text and geometry.
int GetLineThickness() const
void SetExtensionOffset(int aOffset)
void SetLineThickness(int aWidth)
void SetArrowLength(int aLength)
virtual const VECTOR2I & GetStart() const
The dimension's origin is the first feature point for the dimension.
DIM_ARROW_DIRECTION GetArrowDirection() const
virtual void SetEnd(const VECTOR2I &aPoint)
virtual void SetStart(const VECTOR2I &aPoint)
void SetArrowDirection(const DIM_ARROW_DIRECTION &aDirection)
int GetArrowLength() const
virtual const VECTOR2I & GetEnd() const
For better understanding of the points that make a dimension:
double GetAngle() const
Return the angle of the crossbar.
void SetHeight(int aHeight)
Set the distance from the feature points to the crossbar line.
Mark the center of a circle or arc with a cross shape.
A leader is a dimension-like object pointing to a specific point.
An orthogonal dimension is like an aligned dimension, but the extension lines are locked to the X or ...
A radial dimension indicates either the radius or diameter of an arc or circle.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
The main frame for Pcbnew.
VECTOR2I AlignToSegment(const VECTOR2I &aPoint, const SEG &aSeg)
A set of BOARD_ITEMs (i.e., without duplicates).
Object to handle a bitmap image that can be inserted in a PCB.
EDA_ITEM * GetTopLeftItem(bool aFootprintsOnly=false) const override
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void SetPosition(const VECTOR2I &aPos) override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetStroke(const STROKE_PARAMS &aStroke) override
void Normalize() override
Perform any normalization required after a user rotate and/or flip.
VECTOR2I GetPosition() const override
void SetEnd(const VECTOR2I &aEnd)
void SetStart(const VECTOR2I &aStart)
virtual EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
virtual int GetWidth() const
VECTOR2I GetPosition() const override
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
const PADSTACK & Padstack() const
int GetWidth() const override
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
virtual COMMON_SETTINGS * GetCommonSettings() const
A holder to handle information on schematic or board items.
ROUTING_SETTINGS & Settings()
bool AllowDRCViolations() const
Class that handles the drawing of a polygon, including management of last corner deletion and drawing...
bool AddPoint(const VECTOR2I &aPt)
Lock in a polygon point.
void SetCursorPosition(const VECTOR2I &aPos)
Set the current cursor position.
bool NewPointClosesOutline(const VECTOR2I &aPt) const
std::optional< VECTOR2I > DeleteLastCorner()
Remove the last-added point from the polygon.
void SetFinished()
Mark the polygon finished and update the client.
void SetLeaderMode(LEADER_MODE aMode)
Set the leader mode to use when calculating the leader/returner lines.
void Reset()
Clear the manager state and start again.
RAII class that sets an value at construction and resets it to the original value at destruction.
int Distance(const SEG &aSeg) const
Compute minimum Euclidean distance to segment aSeg.
bool Contains(const SEG &aSeg) const
virtual void Add(EDA_ITEM *aItem)
virtual void Remove(EDA_ITEM *aItem)
virtual void Clear() override
Remove all the stored items from the group.
void SetReferencePoint(const VECTOR2I &aP)
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
virtual const SEG GetSegment(int aIndex) const override
int SegmentCount() const
Return the number of segments in this line chain.
Represent a set of closed polygons.
double Area()
Return the area of this poly set.
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int OutlineCount() const
Return the number of outlines in the set.
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
A modified version of the wxInfoBar class that allows us to:
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
MESSAGE_TYPE GetMessageType() const
void OnGeometryChange(const POLYGON_GEOM_MANAGER &aMgr) override
Called when the polygon is complete.
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
bool GetDoNotAllowVias() const
SHAPE_POLY_SET * Outline()
virtual bool IsOnLayer(PCB_LAYER_ID) const override
Test to see if this object is on the given layer.
PCB_LAYER_ID GetFirstLayer() const
This file is part of the common library.
@ HOLE_CLEARANCE_CONSTRAINT
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_90
#define IS_NEW
New item, just created.
#define IS_MOVING
Item being moved.
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
void ConnectBoardShapes(std::vector< PCB_SHAPE * > &aShapeList, int aChainingEpsilon)
Connects shapes to each other, making continious contours (adjacent shapes will have a common vertex)...
a few functions useful in geometry calculations.
VECTOR2< T > GetVectorSnapped45(const VECTOR2< T > &aVec, bool only45=false)
Snap a vector onto the nearest 0, 45 or 90 degree line.
VECTOR2< ret_type > GetClampedCoords(const VECTOR2< in_type > &aCoords, pad_type aPadding=1u)
Clamps a vector to values that can be negated, respecting numeric limits of coordinates data type wit...
LEADER_MODE
The kind of the leader line.
@ DIRECT
Unconstrained point-to-point.
VECTOR2< T > GetVectorSnapped90(const VECTOR2< T > &aVec)
Snap a vector onto the nearest horizontal or vertical line.
void InferBold(TEXT_ATTRIBUTES *aAttrs)
static wxString ImageFileWildcard()
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
@ LAYER_FILLED_SHAPES
Copper graphic shape opacity/visibility (color ignored).
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored).
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ SIMILAR
Add a new zone with the same settings as an existing one.
@ ADD
Add a new zone/keepout with fresh settings.
BARCODE class definition.
Class to handle a set of BOARD_ITEMs.
SCOPED_SET_RESET< DRAWING_TOOL::MODE > SCOPED_DRAW_MODE
@ ID_POPUP_PCB_SELECT_CUSTOM_WIDTH
@ ID_POPUP_PCB_SELECT_VIASIZE1
@ ID_POPUP_PCB_SELECT_VIASIZE16
int GetUserUnits()
Return the currently selected user unit value for the interface.
PGM_BASE & Pgm()
The global program "get" accessor.
Class that computes missing connections on a PCB.
std::vector< EDA_ITEM * > EDA_ITEMS
std::optional< VECTOR2I > OPT_VECTOR2I
bool NoPrintableChars(const wxString &aString)
Return true if the string is empty or contains only whitespace.
LINE_STYLE
Dashed line types.
A filename or source description, a problem input line, a line number, a byte offset,...
std::unique_ptr< BOARD_ITEM > CreateItem() override
DRAWING_TOOL & m_drawingTool
PCB_BASE_EDIT_FRAME & m_frame
PCB_GRID_HELPER m_gridHelper
void SnapItem(BOARD_ITEM *aItem) override
POINT_PLACER(DRAWING_TOOL &aDrawingTool, PCB_BASE_EDIT_FRAME &aFrame)
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
Parameters used to fully describe a zone creation process.
ZONE_MODE m_mode
Zone settings source (for similar and cutout zones)
bool m_keepout
< Should create a keepout zone?
ZONE * m_sourceZone
Zone leader mode.
PCB_LAYER_ID m_layer
The zone mode to operate in.
SHAPE_CIRCLE circle(c.m_circle_center, c.m_circle_radius)
wxString result
Test unit parsing edge cases and error handling.
bool TestSegmentHit(const VECTOR2I &aRefPoint, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
Definition of file extensions used in Kicad.