28#include "dialog_table_properties.h"
34#include <dialogs/dialog_text_properties.h>
57#include <wx/filedlg.h>
94 SetIcon( BITMAPS::width_track_via );
115 _(
"Specify custom track and via sizes" ), wxITEM_CHECK );
124 if(
via.m_Drill > 0 )
126 msg.Printf(
_(
"Via %s, hole %s" ),
132 msg.Printf(
_(
"Via %s" ),
137 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
146 int id = aEvent.GetId();
155 if( sizeDlg.ShowModal() == wxID_OK )
176 m_controls( nullptr ),
180 m_inDrawingTool( false ),
183 m_pickerItem( nullptr ),
184 m_tuningPattern( nullptr )
204 auto activeToolFunctor =
221 auto canCloseOutline =
241 auto tuningToolActive =
269 std::shared_ptr<VIA_SIZE_MENU> viaSizeMenu = std::make_shared<VIA_SIZE_MENU>();
270 viaSizeMenu->SetTool(
this );
271 m_menu->RegisterSubMenu( viaSizeMenu );
272 ctxMenu.
AddMenu( viaSizeMenu.get(), viaToolActive, 500 );
280 getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( *
m_menu.get() );
292 m_frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
355 std::optional<VECTOR2D> startingPoint;
356 std::stack<PCB_SHAPE*> committedLines;
367 while(
drawShape( aEvent, &line, startingPoint, &committedLines ) )
372 commit.
Push(
_(
"Draw Line" ) );
374 committedLines.push( line );
378 startingPoint = std::nullopt;
405 std::optional<VECTOR2D> startingPoint;
408 rect->
SetShape( SHAPE_T::RECTANGLE );
418 while(
drawShape( aEvent, &rect, startingPoint,
nullptr ) )
422 bool cancelled =
false;
436 commit.
Push( isTextBox ?
_(
"Draw Text Box" ) :
_(
"Draw Rectangle" ) );
443 rect->
SetShape( SHAPE_T::RECTANGLE );
446 startingPoint = std::nullopt;
467 std::optional<VECTOR2D> startingPoint;
469 circle->
SetShape( SHAPE_T::CIRCLE );
479 while(
drawShape( aEvent, &circle, startingPoint,
nullptr ) )
483 commit.
Add( circle );
484 commit.
Push(
_(
"Draw Circle" ) );
490 circle->
SetShape( SHAPE_T::CIRCLE );
494 startingPoint = std::nullopt;
515 std::optional<VECTOR2D> startingPoint;
526 while(
drawArc( aEvent, &arc, startingPoint ) )
531 commit.
Push(
_(
"Draw Arc" ) );
540 startingPoint = std::nullopt;
567 while( std::unique_ptr<PCB_SHAPE> bezier =
drawOneBezier( aEvent, startingPoint, startingC1 ) )
570 commit.
Add( bezier.release() );
571 commit.
Push(
_(
"Draw Bezier" ) );
573 startingPoint = bezierRef.
GetEnd();
577 startingC1 = *startingPoint - ( bezierRef.
GetBezierC2() - *startingPoint );
594 bool immediateMode =
image !=
nullptr;
596 bool ignorePrimePosition =
false;
608 image->SetPosition( cursorPos );
654 ignorePrimePosition =
true;
663 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
665 { m_frame->GetActiveLayer() },
688 else if( evt->IsActivate() )
690 if(
image && evt->IsMoveTool() )
693 evt->SetPassEvent(
false );
700 evt->SetPassEvent(
false );
704 if( evt->IsMoveTool() )
721 wxFileDialog dlg(
m_frame,
_(
"Choose Image" ), wxEmptyString, wxEmptyString,
722 _(
"Image Files" ) + wxS(
" " ) + wxImage::GetImageExtWildcard(),
725 if( dlg.ShowModal() != wxID_OK )
731 if( evt->IsPrime() && !ignorePrimePosition )
733 cursorPos =
grid.Align( evt->Position() );
744 wxString fullFilename = dlg.GetPath();
746 if( wxFileExists( fullFilename ) )
749 if( !
image || !
image->GetReferenceImage().ReadImageFile( fullFilename ) )
751 wxMessageBox( wxString::Format(
_(
"Could not load image from '%s'." ), fullFilename ) );
772 commit.Push(
_(
"Place Image" ) );
797 || evt->IsMotion() ) )
799 image->SetPosition( cursorPos );
843 bool ignorePrimePosition =
false;
889 ignorePrimePosition =
true;
898 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
901 { m_frame->GetActiveLayer() },
GRID_TEXT ),
917 else if( evt->IsActivate() )
922 if( evt->IsMoveTool() )
942 bool placing =
text !=
nullptr;
967 text->SetLayer( layer );
968 text->SetAttributes( textAttrs );
969 text->SetTextPos( cursorPos );
985 else if(
text->GetTextPos() != cursorPos )
1014 commit.
Push(
_(
"Draw Text" ) );
1026 if( evt->IsPrime() && !ignorePrimePosition )
1028 cursorPos = evt->Position();
1043 else if(
text && ( evt->IsMotion()
1046 text->SetPosition( cursorPos );
1063 evt->SetPassEvent();
1135 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
1138 { m_frame->GetActiveLayer() },
GRID_TEXT ),
1142 if( evt->IsCancelInteractive() || ( table && evt->IsAction( &
ACTIONS::undo ) ) )
1154 else if( evt->IsActivate() )
1159 if( evt->IsMoveTool() )
1178 else if( evt->IsClick(
BUT_LEFT ) )
1219 commit.
Push(
_(
"Draw Table" ) );
1237 VECTOR2I requestedSize( cursorPos - origin );
1239 int colCount = std::max( 1, requestedSize.
x / ( fontSize.
x * 15 ) );
1240 int rowCount = std::max( 1, requestedSize.
y / ( fontSize.
y * 3 ) );
1242 VECTOR2I cellSize( std::max( fontSize.
x * 5, requestedSize.
x / colCount ),
1243 std::max( fontSize.
y * 3, requestedSize.
y / rowCount ) );
1245 cellSize.
x =
KiROUND( (
double) cellSize.
x / gridSize.
x ) * gridSize.
x;
1246 cellSize.
y =
KiROUND( (
double) cellSize.
y / gridSize.
y ) * gridSize.
y;
1251 for(
int col = 0; col < colCount; ++col )
1254 for(
int row = 0; row < rowCount; ++row )
1258 for(
int col = 0; col < colCount; ++col )
1273 frame()->OnEditItemRequest( table );
1275 frame()->SetMsgPanel( table );
1284 evt->SetPassEvent();
1318 enum DIMENSION_STEPS
1333 int step = SET_ORIGIN;
1349 dimension =
nullptr;
1378 if( step > SET_ORIGIN )
1379 frame()->SetMsgPanel( dimension );
1384 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
1392 grid.SetUseGrid(
false );
1402 if( evt->IsCancelInteractive() || ( dimension && evt->IsAction( &
ACTIONS::undo ) ) )
1406 if( step != SET_ORIGIN )
1416 else if( evt->IsActivate() )
1418 if( step != SET_ORIGIN )
1421 if( evt->IsPointEditor() )
1425 else if( evt->IsMoveTool() )
1441 frame()->SetMsgPanel( dimension );
1450 frame()->SetMsgPanel( dimension );
1471 auto setMeasurementAttributes =
1485 setMeasurementAttributes( dimension );
1490 setMeasurementAttributes( dimension );
1499 setMeasurementAttributes( dimension );
1508 wxFAIL_MSG( wxT(
"Unhandled action in DRAWING_TOOL::DrawDimension" ) );
1511 t = dimension->
Type();
1522 dimension->
SetEnd( cursorPos );
1531 preview.
Add( dimension );
1532 frame()->SetMsgPanel( dimension );
1562 preview.
Remove( dimension );
1564 commit.
Add( dimension );
1565 commit.
Push(
_(
"Draw Dimension" ) );
1569 frame()->OnEditItemRequest( dimension );
1576 if( ++step >= FINISHED )
1578 dimension =
nullptr;
1583 else if( evt->IsDblClick(
BUT_LEFT ) )
1588 else if( evt->IsMotion() )
1593 dimension->
SetEnd( cursorPos );
1617 textOffset = -textOffset;
1626 textOffset = -textOffset;
1640 double angle = aligned->
GetAngle() + ( M_PI / 2 );
1643 double height = (
delta.x * cos( angle ) ) + (
delta.y * sin( angle ) );
1681 ortho->SetHeight( vert ? heightVector.
x : heightVector.
y );
1709 frame()->SetMsgPanel( dimension );
1713 if( step == SET_END || step == SET_HEIGHT )
1715 frame()->OnEditItemRequest( dimension );
1717 frame()->SetMsgPanel( dimension );
1732 evt->SetPassEvent();
1736 if( step != SET_ORIGIN )
1764 int dlgResult = dlg.ShowModal();
1768 if( dlgResult != wxID_OK )
1774 wxMessageBox(
_(
"No graphic items found in file.") );
1780 std::vector<BOARD_ITEM*> newItems;
1781 std::vector<BOARD_ITEM*> selectedItems;
1792 newItems.push_back(
group );
1793 selectedItems.push_back(
group );
1799 std::vector<PCB_SHAPE*> shapeList;
1800 std::vector<std::unique_ptr<PCB_SHAPE>> newShapes;
1802 for(
const std::unique_ptr<EDA_ITEM>& ptr : list )
1805 shapeList.push_back( shape );
1810 for( std::unique_ptr<PCB_SHAPE>& ptr : newShapes )
1813 list.push_back( std::move( ptr ) );
1817 for( std::unique_ptr<EDA_ITEM>& ptr : list )
1819 EDA_ITEM* eda_item = ptr.release();
1825 newItems.push_back( item );
1829 group->AddItem( item );
1834 selectedItems.push_back( item );
1840 preview.
Add( eda_item );
1846 EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() );
1855 commit.
Stage( groupUndoList );
1857 commit.
Push(
_(
"Import Graphics" ) );
1896 item->Move(
delta );
1906 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
1912 if( evt->IsCancelInteractive() || evt->IsActivate() )
1927 else if( evt->IsMotion() )
1932 item->Move(
delta );
1947 commit.
Stage( groupUndoList );
1949 commit.
Push(
_(
"Import Graphics" ) );
1959 evt->SetPassEvent();
2016 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
2031 commit.
Push(
_(
"Move Footprint Anchor" ) );
2042 else if( evt->IsCancelInteractive() || evt->IsActivate() )
2049 evt->SetPassEvent();
2062#define TOGGLE( a ) a = !a
2094 std::optional<VECTOR2D> aStartingPoint,
2095 std::stack<PCB_SHAPE*>* aCommittedGraphics )
2097 SHAPE_T shape = ( *aGraphic )->GetShape();
2100 wxASSERT( shape == SHAPE_T::SEGMENT || shape == SHAPE_T::CIRCLE || shape == SHAPE_T::RECTANGLE );
2140 bool started =
false;
2141 bool cancelled =
false;
2159 if( !isLocalOriginSet )
2170 if( aStartingPoint )
2182 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
2188 if( evt->IsCancelInteractive() || ( started && evt->IsAction( &
ACTIONS::undo ) ) )
2195 evt->SetPassEvent(
false );
2202 else if( evt->IsActivate() )
2204 if( evt->IsPointEditor() )
2208 else if( evt->IsMoveTool() )
2257 frame()->SetMsgPanel( graphic );
2261 evt->SetPassEvent();
2280 if( aStartingPoint )
2282 cursorPos = *aStartingPoint;
2283 aStartingPoint = std::nullopt;
2298 grid.SetSkipPoint( cursorPos );
2301 twoPointMgr.
SetEnd( cursorPos );
2303 if( !isLocalOriginSet )
2307 frame()->SetMsgPanel( graphic );
2325 if( shape == SHAPE_T::SEGMENT && snapItem && graphic->
GetLength() > 0 )
2330 commit.
Add( graphic );
2331 commit.
Push(
_(
"Draw Line" ) );
2344 twoPointMgr.
Reset();
2350 else if( evt->IsMotion() )
2352 VECTOR2I clampedCursorPos = cursorPos;
2354 if( shape == SHAPE_T::CIRCLE || shape == SHAPE_T::ARC )
2372 twoPointMgr.
SetEnd( clampedCursorPos );
2383 if( aCommittedGraphics && !aCommittedGraphics->empty() )
2385 twoPointMgr.
SetOrigin( aCommittedGraphics->top()->GetStart() );
2386 twoPointMgr.
SetEnd( aCommittedGraphics->top()->GetEnd() );
2387 aCommittedGraphics->pop();
2413 frame()->SetMsgPanel( graphic );
2422 frame()->SetMsgPanel( graphic );
2427 frame()->OnEditItemRequest( graphic );
2429 frame()->SetMsgPanel( graphic );
2438 isLocalOriginSet =
true;
2439 evt->SetPassEvent();
2445 userUnits =
frame()->GetUserUnits();
2446 twoPointAsst.
SetUnits( userUnits );
2449 evt->SetPassEvent();
2453 evt->SetPassEvent();
2457 if( !isLocalOriginSet )
2503 std::optional<VECTOR2D> aStartingPoint )
2505 wxCHECK( aGraphic,
false );
2509 wxCHECK( graphic,
false );
2545 *aGraphic =
nullptr;
2553 bool started =
false;
2554 bool cancelled =
false;
2558 if( aStartingPoint )
2572 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
2578 if( evt->IsCancelInteractive() || ( started && evt->IsAction( &
ACTIONS::undo ) ) )
2585 evt->SetPassEvent(
false );
2592 else if( evt->IsActivate() )
2594 if( evt->IsPointEditor() )
2598 else if( evt->IsMoveTool() )
2613 else if( evt->IsClick(
BUT_LEFT ) )
2633 preview.
Add( graphic );
2634 frame()->SetMsgPanel( graphic );
2638 arcManager.
AddPoint( cursorPos,
true );
2644 else if( evt->IsMotion() )
2650 arcManager.
AddPoint( cursorPos,
false );
2673 frame()->SetMsgPanel( graphic );
2677 evt->SetPassEvent();
2685 frame()->OnEditItemRequest( graphic );
2687 frame()->SetMsgPanel( graphic );
2694 frame()->OnEditItemRequest( graphic );
2696 frame()->SetMsgPanel( graphic );
2701 evt->SetPassEvent();
2719 frame()->SetMsgPanel( graphic );
2732 frame()->SetMsgPanel( graphic );
2744 evt->SetPassEvent();
2753 evt->SetPassEvent();
2767 frame()->SetMsgPanel( graphic );
2773 preview.
Remove( graphic );
2811 std::unique_ptr<PCB_SHAPE> bezier = std::make_unique<PCB_SHAPE>(
m_frame->
GetModel() );
2812 bezier->SetShape( SHAPE_T::BEZIER );
2813 bezier->SetFlags(
IS_NEW );
2839 auto setCursor = [&]()
2844 auto cleanup = [&]()
2859 const auto started = [&]()
2861 return bezierManager.
GetStep() > startedAfterStep;
2863 bool cancelled =
false;
2864 bool priming =
false;
2869 if( aStartingPoint )
2872 if( aStartingControl1Point )
2874 bezierManager.
AddPoint( *aStartingPoint,
true );
2875 bezierManager.
AddPoint( *aStartingControl1Point,
true );
2897 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
2903 if( evt->IsCancelInteractive() || ( started() && evt->IsAction( &
ACTIONS::undo ) ) )
2910 evt->SetPassEvent(
false );
2917 else if( evt->IsActivate() )
2919 if( evt->IsPointEditor() )
2923 else if( evt->IsMoveTool() )
2938 else if( evt->IsClick(
BUT_LEFT ) )
2949 bezier->SetShape( SHAPE_T::BEZIER );
2958 frame()->SetMsgPanel( bezier.get() );
2962 bezierManager.
AddPoint( cursorPos,
true );
2968 preview.
Add( bezier.get() );
2977 preview.
Remove( bezier.get() );
2980 else if( evt->IsMotion() )
2986 bezierManager.
AddPoint( cursorPos,
false );
3009 frame()->SetMsgPanel( bezier.get() );
3013 evt->SetPassEvent();
3021 frame()->OnEditItemRequest( bezier.get() );
3023 frame()->SetMsgPanel( bezier.get() );
3028 evt->SetPassEvent();
3046 frame()->SetMsgPanel( bezier.get() );
3059 frame()->SetMsgPanel( bezier.get() );
3067 evt->SetPassEvent();
3077 evt->SetPassEvent();
3092 frame()->SetMsgPanel( bezier.get() );
3098 preview.
Remove( bezier.get() );
3118 bool clearSelection =
false;
3122 if( aMode == ZONE_MODE::ADD || aMode == ZONE_MODE::GRAPHIC_POLYGON )
3130 clearSelection =
true;
3141 if( clearSelection )
3169 ZONE* sourceZone =
nullptr;
3180 params.
m_mode = zoneMode;
3184 if( zoneMode == ZONE_MODE::SIMILAR && !sourceZone->
IsOnLayer( params.
m_layer ) )
3191 bool started =
false;
3205 polyGeomMgr.
Reset();
3207 grid.ClearSkipPoint();
3229 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
3240 if( evt->IsCancelInteractive() )
3251 evt->SetPassEvent(
false );
3255 else if( evt->IsActivate() )
3260 if( evt->IsPointEditor() )
3264 else if( evt->IsMoveTool() )
3277 if( zoneMode != ZONE_MODE::SIMILAR )
3299 const bool endPolygon = evt->IsDblClick(
BUT_LEFT )
3306 polyGeomMgr.
Reset();
3313 else if( polyGeomMgr.
AddPoint( cursorPos ) )
3336 cursorPos = last.value();
3346 else if( started && ( evt->IsMotion()
3372 evt->SetPassEvent();
3394 std::shared_ptr<DRC_ENGINE> m_drcEngine;
3396 int m_worstClearance;
3397 bool m_allowDRCViolations;
3404 m_worstClearance( 0 )
3422 m_worstClearance = std::max( m_worstClearance, constraint.
GetValue().
Min() );
3426 for(
PAD*
pad : footprint->Pads() )
3428 std::optional<int> padOverride =
pad->GetClearanceOverrides(
nullptr );
3430 if( padOverride.has_value() )
3431 m_worstClearance = std::max( m_worstClearance, padOverride.value() );
3440 virtual ~VIA_PLACER()
3450 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> items;
3452 std::vector<PCB_TRACK*> possible_tracks;
3454 wxCHECK( view,
nullptr );
3456 view->
Query( bbox, items );
3473 possible_tracks.push_back( track );
3481 possible_tracks.push_back( arc );
3486 int min_d = std::numeric_limits<int>::max();
3488 for(
PCB_TRACK* track : possible_tracks )
3490 SEG test( track->GetStart(), track->GetEnd() );
3491 int dist = (
test.NearestPoint( position ) - position ).EuclideanNorm();
3496 return_track = track;
3500 return return_track;
3508 ZONE* zone =
dynamic_cast<ZONE*
>( aOther );
3537 int connectedItemNet = connectedItem->
GetNetCode();
3539 if( connectedItemNet == 0 || connectedItemNet == aVia->
GetNetCode() )
3552 if( clearance >= 0 )
3557 if( viaShape->Collide( otherShape.get(), clearance - m_drcEpsilon ) )
3568 if( clearance >= 0 )
3573 clearance - m_drcEpsilon ) )
3583 bool checkDRCViolation(
PCB_VIA* aVia )
3585 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> items;
3586 std::set<BOARD_ITEM*> checkedItems;
3589 bbox.
Inflate( m_worstClearance );
3592 for( std::pair<KIGFX::VIEW_ITEM*, int> it : items )
3594 if( !it.first->IsBOARD_ITEM() )
3612 else if( checkedItems.count( item ) )
3617 if( hasDRCViolation( aVia, item ) )
3620 checkedItems.insert( item );
3637 for(
FOOTPRINT* fp : m_board->Footprints() )
3639 for(
PAD*
pad : fp->Pads() )
3641 if(
pad->HitTest( position ) && (
pad->GetLayerSet() & lset ).any() )
3657 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> items;
3660 std::vector<PCB_SHAPE*> possible_shapes;
3662 view->
Query( bbox, items );
3676 possible_shapes.push_back( shape );
3681 int min_d = std::numeric_limits<int>::max();
3683 for(
PCB_SHAPE* shape : possible_shapes )
3685 int dist = ( shape->GetPosition() - position ).EuclideanNorm();
3690 return_shape = shape;
3694 return return_shape;
3697 std::optional<int> selectPossibleNetsByPopupMenu( std::set<int>& aNetcodeList )
3701 std::map<int, int> menuIDNetCodeMap;
3704 for(
int netcode : aNetcodeList )
3710 menuText = wxString::Format(
"%s\t",
3713 menuText = wxString::Format(
"&%d %s\t",
3723 menu.
Add( menuText, menuID, BITMAPS::INVALID_BITMAP );
3724 menuIDNetCodeMap[ menuID ] = netcode;
3734 int selectedNetCode = -1;
3735 bool cancelled =
false;
3741 evt->SetPassEvent();
3745 std::optional<int>
id = evt->GetCommandId();
3748 if(
id && ( *
id > 0 ) && ( *
id < menuID ) )
3750 selectedNetCode = menuIDNetCodeMap.at( *
id );
3765 return std::optional<int>();
3767 return selectedNetCode;
3770 std::optional<int> findStitchedZoneNet(
PCB_VIA* aVia )
3774 std::set<int> netcodeList;
3782 for(
ZONE* z : m_board->Zones() )
3786 if( z->HitTestFilledArea( m_frame->
GetActiveLayer(), position ) )
3787 netcodeList.insert( z->GetNetCode() );
3794 if( netcodeList.size() == 1 )
3795 return *netcodeList.begin();
3800 for(
ZONE* z : m_board->Zones() )
3804 if( z->IsOnLayer( layer ) )
3806 if( z->HitTestFilledArea( layer, position ) )
3807 netcodeList.insert( z->GetNetCode() );
3813 if( netcodeList.size() == 1 )
3814 return *netcodeList.begin();
3816 if( netcodeList.size() > 1 )
3819 return selectPossibleNetsByPopupMenu( netcodeList );
3835 if( settings->
tracks != MAGNETIC_OPTIONS::NO_EFFECT && m_gridHelper.
GetSnap() )
3839 SEG trackSeg( track->GetStart(), track->GetEnd() );
3847 if( settings->
pads != MAGNETIC_OPTIONS::NO_EFFECT && m_gridHelper.
GetSnap() )
3860 if( shape->IsFilled() )
3866 switch( shape->GetShape() )
3868 case SHAPE_T::SEGMENT:
3870 SEG seg( shape->GetStart(), shape->GetEnd() );
3878 if( ( shape->GetEnd() - position ).SquaredEuclideanNorm() <
3879 ( shape->GetStart() - position ).SquaredEuclideanNorm() )
3893 if( !shape->IsPolyShapeValid() )
3900 std::optional<SEG> nearestSeg;
3901 int minDist = std::numeric_limits<int>::max();
3910 int dist = seg.
Distance( position );
3912 if( dist < minDist )
3950 via->SetIsFree(
false );
3954 via->SetNetCode(
pad->GetNetCode() );
3955 via->SetIsFree(
false );
3959 std::optional<int> netcode = findStitchedZoneNet(
via );
3961 if( !netcode.has_value() )
3964 via->SetNetCode( netcode.value() );
3965 via->SetIsFree(
via->GetNetCode() > 0 );
3968 if( checkDRCViolation(
via ) )
3973 if( !m_allowDRCViolations )
3987 if( track && m_gridHelper.
GetSnap() )
3991 SEG trackSeg( trackStart, trackEnd );
3993 if( viaPos == trackStart || viaPos == trackEnd )
4007 newTrack->
SetEnd( trackEnd );
4008 aCommit.
Add( newTrack );
4014 std::unique_ptr<BOARD_ITEM> CreateItem()
override
4019 via->SetNetCode( 0 );
4022 if(
via->GetViaType() == VIATYPE::THROUGH )
4037 via->SetLayerPair( first_layer, last_layer );
4040 if(
via->GetViaType() == VIATYPE::MICROVIA )
4043 via->GetEffectiveNetClass()->GetuViaDiameter() );
4044 via->SetDrill(
via->GetEffectiveNetClass()->GetuViaDrill() );
4052 return std::unique_ptr<BOARD_ITEM>(
via );
4056 VIA_PLACER placer(
frame() );
constexpr int ARC_HIGH_DEF
constexpr EDA_IU_SCALE pcbIUScale
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION cancelInteractive
static TOOL_ACTION updateUnits
static TOOL_ACTION activatePointEditor
static TOOL_ACTION doDelete
static TOOL_ACTION cursorClick
static TOOL_ACTION refreshPreview
static TOOL_ACTION resetLocalCoords
void SetLayerVisible(int aLayer, bool isVisible)
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr) override
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
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
std::shared_ptr< DRC_ENGINE > m_DRCEngine
bool m_UseConnectedTrackWidth
bool m_DimensionSuppressZeroes
void SetViaSizeIndex(unsigned aIndex)
Set the current via size list index to aIndex.
int GetDRCEpsilon() const
unsigned GetViaSizeIndex() const
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 coord_type GetRight() const
constexpr coord_type GetTop() const
constexpr coord_type GetBottom() const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
std::list< std::unique_ptr< EDA_ITEM > > & GetImportedItems()
bool ShouldFixDiscontinuities()
bool IsPlacementInteractive()
Implementing DIALOG_TRACK_VIA_SIZE_BASE.
SEVERITY GetSeverity() const
const MINOPTMAX< int > & GetValue() const
void ShowInfoBarMsg(const wxString &aMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an info icon on the left of...
virtual PICKED_ITEMS_LIST * PopCommandFromUndoList()
Return the last command to undo and remove it from list, nothing is deleted.
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
bool IsType(FRAME_T aType) const
WX_INFOBAR * GetInfoBar()
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void DisplayConstraintsMsg(const wxString &msg)
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
A base class for most all the KiCad significant classes used in schematics and boards.
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 SetBezierC2(const VECTOR2I &aPt)
void SetCenter(const VECTOR2I &aCenter)
void SetFilled(bool aFlag)
void RebuildBezierToSegmentsPointsList(int aMaxError)
Rebuild the m_bezierPoints vertex list that approximate the Bezier curve by a list of segments.
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 SetBezierC1(const VECTOR2I &aPt)
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.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
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_CONTROL1
Waiting to lock in the first control 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(bool 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.
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
void ShowPreview(bool aShow=true)
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
int Query(const BOX2I &aRect, std::vector< LAYER_ITEM_PAIR > &aResult) const
Find all visible items that touch or are within the rectangle aRect.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
void RecacheAllItems()
Rebuild GAL display lists.
std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
void AddToPreview(VIEW_ITEM *aItem, bool aTakeOwnership=true)
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
LSET is a set of PCB_LAYER_IDs.
static LSET AllLayersMask()
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
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 toggleHV45Mode
static TOOL_ACTION drawRuleArea
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 selectionCursor
Select a single item under the cursor position.
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 selectionClear
Clear the current selection.
static TOOL_ACTION placeCharacteristics
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 selectItem
Select an item (specified as the event parameter).
static TOOL_ACTION arcPosture
Switch posture when drawing arc.
static TOOL_ACTION closeOutline
static TOOL_ACTION amplIncrease
static TOOL_ACTION amplDecrease
static TOOL_ACTION lengthTunerSettings
static TOOL_ACTION spacingIncrease
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
static TOOL_ACTION drawLine
static TOOL_ACTION placeStackup
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.
Common, abstract interface for edit frames.
wxString GetDesignRulesPath()
Return the absolute path to the design rules file for the currently-loaded board.
void ClearListAndDeleteItems(PICKED_ITEMS_LIST *aList)
int ShowTextBoxPropertiesDialog(PCB_TEXTBOX *aTextBox)
APPEARANCE_CONTROLS * GetAppearancePanel()
void PutDataInPreviousState(PICKED_ITEMS_LIST *aList)
Used in undo or redo command.
void SetObjectVisible(GAL_LAYER_ID aLayer, bool aVisible=true)
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
virtual PCB_LAYER_ID GetActiveLayer() const
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
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.
virtual void SetEnd(const VECTOR2I &aPoint)
virtual void SetStart(const VECTOR2I &aPoint)
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.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
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.
PCB_LAYER_ID m_Route_Layer_TOP
PCB_LAYER_ID m_Route_Layer_BOTTOM
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 SetColWidth(int aCol, int aWidth)
void Normalize() override
Perform any normalization required after a user rotate and/or flip.
void AddCell(PCB_TABLECELL *aCell)
void SetColCount(int aCount)
VECTOR2I GetPosition() const override
void SetRowHeight(int aRow, int aHeight)
void SetPosition(const VECTOR2I &aPos) 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
virtual SETTINGS_MANAGER & GetSettingsManager() const
A holder to handle information on schematic or board items.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
unsigned GetCount() const
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.
@ DIRECT
Unconstrained point-to-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.
int Size() const
Returns the number of selected parts.
void SetReferencePoint(const VECTOR2I &aP)
bool Empty() const
Checks if there is anything selected.
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
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.
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.
void SetLineStyle(LINE_STYLE aLineStyle)
void SetWidth(int aWidth)
void SetColor(const KIGFX::COLOR4D &aColor)
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().
EDA_UNITS GetUserUnits() const
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
An adjunct helper to the DRAWING_TOOL interactive tool, which handles incoming geometry changes from ...
void OnGeometryChange(const POLYGON_GEOM_MANAGER &aMgr) override
Called when the polygon is complete.
Handle a list of polygons defining a copper zone.
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
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
#define IS_NEW
New item, just created.
#define IS_MOVING
Item being moved.
void ConnectBoardShapes(std::vector< PCB_SHAPE * > &aShapeList, std::vector< std::unique_ptr< PCB_SHAPE > > &aNewShapes, 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...
void InferBold(TEXT_ATTRIBUTES *aAttrs)
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored)
@ LAYER_SHAPES
Copper graphic shape 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)
Class to handle a set of BOARD_ITEMs.
@ 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.
@ NONE
No connection to this item.
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.
constexpr int mmToIU(double mm) const
A filename or source description, a problem input line, a line number, a byte offset,...
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.
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_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