KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_shape.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright (C) 2011 Wayne Stambaugh <[email protected]>
7 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#include "pcb_shape.h"
28
29#include <google/protobuf/any.pb.h>
30#include <magic_enum.hpp>
31
32#include <bitmaps.h>
33#include <macros.h>
34#include <pcb_edit_frame.h>
36#include <board.h>
37#include <footprint.h>
38#include <lset.h>
39#include <pad.h>
40#include <base_units.h>
45#include <pcb_painter.h>
46#include <api/board/board_types.pb.h>
47#include <api/api_enums.h>
48#include <api/api_utils.h>
49
50
51PCB_SHAPE::PCB_SHAPE( BOARD_ITEM* aParent, KICAD_T aItemType, SHAPE_T aShapeType ) :
52 BOARD_CONNECTED_ITEM( aParent, aItemType ),
53 EDA_SHAPE( aShapeType, pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ), FILL_T::NO_FILL )
54{
55 m_hasSolderMask = false;
56}
57
58
59PCB_SHAPE::PCB_SHAPE( BOARD_ITEM* aParent, SHAPE_T shapetype ) :
61 EDA_SHAPE( shapetype, pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ), FILL_T::NO_FILL )
62{
63 m_hasSolderMask = false;
64}
65
66
68{
69}
70
71
72void PCB_SHAPE::Serialize( google::protobuf::Any &aContainer ) const
73{
74 using namespace kiapi::common;
75 using namespace kiapi::board::types;
76 BoardGraphicShape msg;
77
78 msg.set_layer( ToProtoEnum<PCB_LAYER_ID, BoardLayer>( GetLayer() ) );
79 msg.mutable_net()->mutable_code()->set_value( GetNetCode() );
80 msg.mutable_net()->set_name( GetNetname() );
81 msg.mutable_id()->set_value( m_Uuid.AsStdString() );
82 msg.set_locked( IsLocked() ? types::LockedState::LS_LOCKED : types::LockedState::LS_UNLOCKED );
83
84 google::protobuf::Any any;
86 any.UnpackTo( msg.mutable_shape() );
87
88 // TODO m_hasSolderMask and m_solderMaskMargin
89
90 aContainer.PackFrom( msg );
91}
92
93
94bool PCB_SHAPE::Deserialize( const google::protobuf::Any &aContainer )
95{
96 using namespace kiapi::common;
97 using namespace kiapi::board::types;
98
99 BoardGraphicShape msg;
100
101 if( !aContainer.UnpackTo( &msg ) )
102 return false;
103
104 // Initialize everything to a known state that doesn't get touched by every
105 // codepath below, to make sure the equality operator is consistent
106 m_start = {};
107 m_end = {};
108 m_arcCenter = {};
109 m_arcMidData = {};
110 m_bezierC1 = {};
111 m_bezierC2 = {};
112 m_editState = 0;
113 m_proxyItem = false;
114 m_endsSwapped = false;
115
116 const_cast<KIID&>( m_Uuid ) = KIID( msg.id().value() );
117 SetLocked( msg.locked() == types::LS_LOCKED );
118 SetLayer( FromProtoEnum<PCB_LAYER_ID, BoardLayer>( msg.layer() ) );
119 SetNetCode( msg.net().code().value() );
120
121 google::protobuf::Any any;
122 any.PackFrom( msg.shape() );
124
125 // TODO m_hasSolderMask and m_solderMaskMargin
126
127 return true;
128}
129
130
131bool PCB_SHAPE::IsType( const std::vector<KICAD_T>& aScanTypes ) const
132{
133 if( BOARD_ITEM::IsType( aScanTypes ) )
134 return true;
135
136 bool sametype = false;
137
138 for( KICAD_T scanType : aScanTypes )
139 {
140 if( scanType == PCB_LOCATE_BOARD_EDGE_T )
141 sametype = m_layer == Edge_Cuts;
142 else if( scanType == PCB_SHAPE_LOCATE_ARC_T )
143 sametype = m_shape == SHAPE_T::ARC;
144 else if( scanType == PCB_SHAPE_LOCATE_CIRCLE_T )
145 sametype = m_shape == SHAPE_T::CIRCLE;
146 else if( scanType == PCB_SHAPE_LOCATE_RECT_T )
147 sametype = m_shape == SHAPE_T::RECTANGLE;
148 else if( scanType == PCB_SHAPE_LOCATE_SEGMENT_T )
149 sametype = m_shape == SHAPE_T::SEGMENT;
150 else if( scanType == PCB_SHAPE_LOCATE_POLY_T )
151 sametype = m_shape == SHAPE_T::POLY;
152 else if( scanType == PCB_SHAPE_LOCATE_BEZIER_T )
153 sametype = m_shape == SHAPE_T::BEZIER;
154
155 if( sametype )
156 return true;
157 }
158
159 return false;
160}
161
162
164{
165 // Only board-level copper shapes are connectable
166 return IsOnCopperLayer() && !GetParentFootprint();
167}
168
169
171{
172 BOARD_ITEM::SetLayer( aLayer );
173
174 if( !IsOnCopperLayer() )
175 SetNetCode( -1 );
176}
177
178
180{
181 int margin = m_solderMaskMargin.value_or( 0 );
182
183 // If no local margin is set, get the board's solder mask expansion value
184 if( !m_solderMaskMargin.has_value() )
185 {
186 const BOARD* board = GetBoard();
187
188 if( board )
190 }
191
192 // Ensure the resulting mask opening has a non-negative size
193 if( margin < 0 && !IsFilled() )
194 margin = std::max( margin, -GetWidth() / 2 );
195
196 return margin;
197}
198
199
201{
202 if( aLayer == m_layer )
203 {
204 return true;
205 }
206
208 && ( ( aLayer == F_Mask && m_layer == F_Cu )
209 || ( aLayer == B_Mask && m_layer == B_Cu ) ) )
210 {
211 return true;
212 }
213
214 return false;
215}
216
217
219{
220 LSET layermask( { m_layer } );
221
222 if( m_hasSolderMask )
223 {
224 if( layermask.test( F_Cu ) )
225 layermask.set( F_Mask );
226
227 if( layermask.test( B_Cu ) )
228 layermask.set( B_Mask );
229 }
230
231 return layermask;
232}
233
234
235void PCB_SHAPE::SetLayerSet( const LSET& aLayerSet )
236{
237 aLayerSet.RunOnLayers(
238 [&]( PCB_LAYER_ID layer )
239 {
240 if( IsCopperLayer( layer ) )
241 SetLayer( layer );
242 else if( IsSolderMaskLayer( layer ) )
243 SetHasSolderMask( true );
244 } );
245}
246
247
248std::vector<VECTOR2I> PCB_SHAPE::GetConnectionPoints() const
249{
250 std::vector<VECTOR2I> ret;
251
252 // For filled shapes, we may as well use a centroid
253 if( IsFilled() )
254 {
255 ret.emplace_back( GetCenter() );
256 return ret;
257 }
258
259 switch( m_shape )
260 {
261 case SHAPE_T::CIRCLE:
262 {
263 const CIRCLE circle( GetCenter(), GetRadius() );
264 for( const TYPED_POINT2I& pt : KIGEOM::GetCircleKeyPoints( circle, false ) )
265 {
266 ret.emplace_back( pt.m_point );
267 }
268 break;
269 }
270 case SHAPE_T::ARC:
271 ret.emplace_back( GetArcMid() );
273
274 case SHAPE_T::SEGMENT:
275 case SHAPE_T::BEZIER:
276 ret.emplace_back( GetStart() );
277 ret.emplace_back( GetEnd() );
278 break;
279
280 case SHAPE_T::POLY:
281 for( auto iter = GetPolyShape().CIterate(); iter; ++iter )
282 ret.emplace_back( *iter );
283
284 break;
285
286 case SHAPE_T::RECTANGLE:
287 for( const VECTOR2I& pt : GetRectCorners() )
288 ret.emplace_back( pt );
289
290 break;
291
292 case SHAPE_T::UNDEFINED:
293 // No default - handle all cases, even if just break
294 break;
295 }
296
297 return ret;
298}
299
300
302{
303 // A stroke width of 0 in PCBNew means no-border, but negative stroke-widths are only used
304 // in EEschema (see SCH_SHAPE::GetPenWidth()).
305 // Since negative stroke widths can trip up down-stream code (such as the Gerber plotter), we
306 // weed them out here.
307 return std::max( EDA_SHAPE::GetWidth(), 0 );
308}
309
310
312{
314}
315
316
318{
319 // For some shapes return the visual center, but for not filled polygonal shapes,
320 // the center is usually far from the shape: a point on the outline is better
321
322 switch( m_shape )
323 {
324 case SHAPE_T::CIRCLE:
325 if( !IsFilled() )
326 return VECTOR2I( GetCenter().x + GetRadius(), GetCenter().y );
327 else
328 return GetCenter();
329
330 case SHAPE_T::RECTANGLE:
331 if( !IsFilled() )
332 return GetStart();
333 else
334 return GetCenter();
335
336 case SHAPE_T::POLY:
337 if( !IsFilled() )
338 {
339 VECTOR2I pos = GetPolyShape().Outline(0).CPoint(0);
340 return VECTOR2I( pos.x, pos.y );
341 }
342 else
343 {
344 return GetCenter();
345 }
346
347 case SHAPE_T::ARC:
348 return GetArcMid();
349
350 case SHAPE_T::BEZIER:
351 return GetStart();
352
353 default:
354 return GetCenter();
355 }
356}
357
358
359std::vector<VECTOR2I> PCB_SHAPE::GetCorners() const
360{
361 std::vector<VECTOR2I> pts;
362
363 if( GetShape() == SHAPE_T::RECTANGLE )
364 {
365 pts = GetRectCorners();
366 }
367 else if( GetShape() == SHAPE_T::POLY )
368 {
369 for( int ii = 0; ii < GetPolyShape().OutlineCount(); ++ii )
370 {
371 for( const VECTOR2I& pt : GetPolyShape().Outline( ii ).CPoints() )
372 pts.emplace_back( pt );
373 }
374 }
375 else
376 {
378 }
379
380 while( pts.size() < 4 )
381 pts.emplace_back( pts.back() + VECTOR2I( 10, 10 ) );
382
383 return pts;
384}
385
386
387void PCB_SHAPE::Move( const VECTOR2I& aMoveVector )
388{
389 move( aMoveVector );
390}
391
392
393void PCB_SHAPE::Scale( double aScale )
394{
395 scale( aScale );
396}
397
398
400{
401 if( m_shape == SHAPE_T::RECTANGLE )
402 {
403 VECTOR2I start = GetStart();
404 VECTOR2I end = GetEnd();
405
406 BOX2I rect( start, end - start );
407 rect.Normalize();
408
409 SetStart( rect.GetPosition() );
410 SetEnd( rect.GetEnd() );
411 }
412 else if( m_shape == SHAPE_T::POLY )
413 {
414 auto horizontal =
415 []( const SEG& seg )
416 {
417 return seg.A.y == seg.B.y;
418 };
419
420 auto vertical =
421 []( const SEG& seg )
422 {
423 return seg.A.x == seg.B.x;
424 };
425
426 // Convert a poly back to a rectangle if appropriate
427 if( m_poly.OutlineCount() == 1 && m_poly.Outline( 0 ).SegmentCount() == 4 )
428 {
429 SHAPE_LINE_CHAIN& outline = m_poly.Outline( 0 );
430
431 if( horizontal( outline.Segment( 0 ) )
432 && vertical( outline.Segment( 1 ) )
433 && horizontal( outline.Segment( 2 ) )
434 && vertical( outline.Segment( 3 ) ) )
435 {
436 m_shape = SHAPE_T::RECTANGLE;
437 m_start.x = std::min( outline.Segment( 0 ).A.x, outline.Segment( 0 ).B.x );
438 m_start.y = std::min( outline.Segment( 1 ).A.y, outline.Segment( 1 ).B.y );
439 m_end.x = std::max( outline.Segment( 0 ).A.x, outline.Segment( 0 ).B.x );
440 m_end.y = std::max( outline.Segment( 1 ).A.y, outline.Segment( 1 ).B.y );
441 }
442 else if( vertical( outline.Segment( 0 ) )
443 && horizontal( outline.Segment( 1 ) )
444 && vertical( outline.Segment( 2 ) )
445 && horizontal( outline.Segment( 3 ) ) )
446 {
447 m_shape = SHAPE_T::RECTANGLE;
448 m_start.x = std::min( outline.Segment( 1 ).A.x, outline.Segment( 1 ).B.x );
449 m_start.y = std::min( outline.Segment( 0 ).A.y, outline.Segment( 0 ).B.y );
450 m_end.x = std::max( outline.Segment( 1 ).A.x, outline.Segment( 1 ).B.x );
451 m_end.y = std::max( outline.Segment( 0 ).A.y, outline.Segment( 0 ).B.y );
452 }
453 }
454 }
455}
456
457
459{
460 if( m_shape == SHAPE_T::SEGMENT )
461 {
462 // we want start point the top left point and end point the bottom right
463 // (more easy to compare 2 segments: we are seeing them as equivalent if
464 // they have the same end points, not necessary the same order)
465 VECTOR2I start = GetStart();
466 VECTOR2I end = GetEnd();
467
468 if( ( start.x > end.x )
469 || ( start.x == end.x && start.y < end.y ) )
470 {
471 SetStart( end );
472 SetEnd( start );
473 }
474 }
475 else
476 Normalize();
477}
478
479
480void PCB_SHAPE::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
481{
482 rotate( aRotCentre, aAngle );
483}
484
485
486void PCB_SHAPE::Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
487{
488 flip( aCentre, aFlipDirection );
489
491}
492
493
494void PCB_SHAPE::Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
495{
496 // Mirror an edge of the footprint. the layer is not modified
497 // This is a footprint shape modification.
498
499 switch( GetShape() )
500 {
501 case SHAPE_T::ARC:
502 case SHAPE_T::SEGMENT:
503 case SHAPE_T::RECTANGLE:
504 case SHAPE_T::CIRCLE:
505 case SHAPE_T::BEZIER:
506 MIRROR( m_start, aCentre, aFlipDirection );
507 MIRROR( m_end, aCentre, aFlipDirection );
508 MIRROR( m_arcCenter, aCentre, aFlipDirection );
509 MIRROR( m_bezierC1, aCentre, aFlipDirection );
510 MIRROR( m_bezierC2, aCentre, aFlipDirection );
511
512 if( GetShape() == SHAPE_T::ARC )
513 std::swap( m_start, m_end );
514
515 if( GetShape() == SHAPE_T::BEZIER )
517
518 break;
519
520 case SHAPE_T::POLY:
521 m_poly.Mirror( aCentre, aFlipDirection );
522 break;
523
524 default:
526 }
527}
528
529
530void PCB_SHAPE::SetIsProxyItem( bool aIsProxy )
531{
532 PAD* parentPad = nullptr;
533
534 if( GetBoard() && GetBoard()->IsFootprintHolder() )
535 {
536 for( FOOTPRINT* fp : GetBoard()->Footprints() )
537 {
538 for( PAD* pad : fp->Pads() )
539 {
540 if( pad->IsEntered() )
541 {
542 parentPad = pad;
543 break;
544 }
545 }
546 }
547 }
548
549 if( aIsProxy && !m_proxyItem )
550 {
551 if( GetShape() == SHAPE_T::SEGMENT )
552 {
553 if( parentPad && parentPad->GetLocalThermalSpokeWidthOverride().has_value() )
554 SetWidth( parentPad->GetLocalThermalSpokeWidthOverride().value() );
555 else
557 }
558 else
559 {
560 SetWidth( 1 );
561 }
562 }
563 else if( m_proxyItem && !aIsProxy )
564 {
566 }
567
568 m_proxyItem = aIsProxy;
569}
570
571
572double PCB_SHAPE::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
573{
574 KIGFX::PCB_PAINTER& painter = static_cast<KIGFX::PCB_PAINTER&>( *aView->GetPainter() );
575 KIGFX::PCB_RENDER_SETTINGS& renderSettings = *painter.GetSettings();
576
577 if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
578 {
579 // Hide shadow if the main layer is not shown
580 if( !aView->IsLayerVisible( m_layer ) )
581 return LOD_HIDE;
582
583 // Hide shadow on dimmed tracks
584 if( renderSettings.GetHighContrast() )
585 {
586 if( m_layer != renderSettings.GetPrimaryHighContrastLayer() )
587 return LOD_HIDE;
588 }
589 }
590
591 if( FOOTPRINT* parent = GetParentFootprint() )
592 {
593 if( parent->GetLayer() == F_Cu && !aView->IsLayerVisible( LAYER_FOOTPRINTS_FR ) )
594 return LOD_HIDE;
595
596 if( parent->GetLayer() == B_Cu && !aView->IsLayerVisible( LAYER_FOOTPRINTS_BK ) )
597 return LOD_HIDE;
598 }
599
600 return LOD_SHOW;
601}
602
603
604std::vector<int> PCB_SHAPE::ViewGetLayers() const
605{
606 std::vector<int> layers;
607 layers.reserve( 4 );
608
609 layers.push_back( GetLayer() );
610
611 if( IsOnCopperLayer() )
612 {
613 layers.push_back( GetNetnameLayer( GetLayer() ) );
614
615 if( m_hasSolderMask )
616 {
617 if( m_layer == F_Cu )
618 layers.push_back( F_Mask );
619 else if( m_layer == B_Cu )
620 layers.push_back( B_Mask );
621 }
622 }
623
624 if( IsLocked() )
625 layers.push_back( LAYER_LOCKED_ITEM_SHADOW );
626
627 return layers;
628}
629
630
631void PCB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
632{
633 if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
634 {
635 if( FOOTPRINT* parent = GetParentFootprint() )
636 aList.emplace_back( _( "Footprint" ), parent->GetReference() );
637 }
638
639 aList.emplace_back( _( "Type" ), _( "Drawing" ) );
640
641 if( aFrame->GetName() == PCB_EDIT_FRAME_NAME && IsLocked() )
642 aList.emplace_back( _( "Status" ), _( "Locked" ) );
643
644 ShapeGetMsgPanelInfo( aFrame, aList );
645
646 aList.emplace_back( _( "Layer" ), GetLayerName() );
647}
648
649
650wxString PCB_SHAPE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
651{
652 FOOTPRINT* parentFP = nullptr;
653
654 if( EDA_DRAW_FRAME* frame = dynamic_cast<EDA_DRAW_FRAME*>( aUnitsProvider ) )
655 {
656 if( frame->GetName() == PCB_EDIT_FRAME_NAME )
657 parentFP = GetParentFootprint();
658 }
659
660 if( IsOnCopperLayer() )
661 {
662 if( parentFP )
663 {
664 return wxString::Format( _( "%s %s of %s on %s" ),
667 parentFP->GetReference(),
668 GetLayerName() );
669 }
670 else
671 {
672 return wxString::Format( _( "%s %s on %s" ),
675 GetLayerName() );
676 }
677 }
678 else
679 {
680 if( parentFP )
681 {
682 return wxString::Format( _( "%s of %s on %s" ),
684 parentFP->GetReference(),
685 GetLayerName() );
686 }
687 else
688 {
689 return wxString::Format( _( "%s on %s" ),
691 GetLayerName() );
692 }
693 }
694}
695
696
698{
699 if( GetParentFootprint() )
700 return BITMAPS::show_mod_edge;
701 else
702 return BITMAPS::add_dashed_line;
703}
704
705
707{
708 return new PCB_SHAPE( *this );
709}
710
711
713{
714 BOX2I return_box = EDA_ITEM::ViewBBox();
715
716 // Inflate the bounding box by just a bit more for safety.
717 return_box.Inflate( GetWidth() );
718
719 return return_box;
720}
721
722
723std::shared_ptr<SHAPE> PCB_SHAPE::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
724{
725 return std::make_shared<SHAPE_COMPOUND>( MakeEffectiveShapes() );
726}
727
728
730{
731 PCB_SHAPE* image = dynamic_cast<PCB_SHAPE*>( aImage );
732 wxCHECK( image, /* void */ );
733
734 SwapShape( image );
735
736 // Swap params not handled by SwapShape( image )
737 std::swap( m_layer, image->m_layer );
738 std::swap( m_isKnockout, image->m_isKnockout );
739 std::swap( m_isLocked, image->m_isLocked );
740 std::swap( m_flags, image->m_flags );
741 std::swap( m_parent, image->m_parent );
742 std::swap( m_forceVisible, image->m_forceVisible );
743 std::swap( m_netinfo, image->m_netinfo );
744 std::swap( m_hasSolderMask, image->m_hasSolderMask );
745 std::swap( m_solderMaskMargin, image->m_solderMaskMargin );
746}
747
748
750 const BOARD_ITEM* aSecond ) const
751{
752 if( aFirst->Type() != aSecond->Type() )
753 return aFirst->Type() < aSecond->Type();
754
755 if( aFirst->GetLayer() != aSecond->GetLayer() )
756 return aFirst->GetLayer() < aSecond->GetLayer();
757
758 if( aFirst->Type() == PCB_SHAPE_T )
759 {
760 const PCB_SHAPE* dwgA = static_cast<const PCB_SHAPE*>( aFirst );
761 const PCB_SHAPE* dwgB = static_cast<const PCB_SHAPE*>( aSecond );
762
763 if( dwgA->GetShape() != dwgB->GetShape() )
764 return dwgA->GetShape() < dwgB->GetShape();
765 }
766
767 return aFirst->m_Uuid < aSecond->m_Uuid;
768}
769
770
772 int aClearance, int aError, ERROR_LOC aErrorLoc,
773 bool ignoreLineWidth ) const
774{
775 EDA_SHAPE::TransformShapeToPolygon( aBuffer, aClearance, aError, aErrorLoc, ignoreLineWidth );
776}
777
778
779bool PCB_SHAPE::operator==( const BOARD_ITEM& aOther ) const
780{
781 if( aOther.Type() != Type() )
782 return false;
783
784 const PCB_SHAPE& other = static_cast<const PCB_SHAPE&>( aOther );
785
786 return *this == other;
787}
788
789
790bool PCB_SHAPE::operator==( const PCB_SHAPE& aOther ) const
791{
792 if( aOther.Type() != Type() )
793 return false;
794
795 const PCB_SHAPE& other = static_cast<const PCB_SHAPE&>( aOther );
796
797 if( m_layer != other.m_layer )
798 return false;
799
800 if( m_isKnockout != other.m_isKnockout )
801 return false;
802
803 if( m_isLocked != other.m_isLocked )
804 return false;
805
806 if( m_flags != other.m_flags )
807 return false;
808
809 if( m_forceVisible != other.m_forceVisible )
810 return false;
811
812 if( m_netinfo->GetNetCode() != other.m_netinfo->GetNetCode() )
813 return false;
814
815 if( m_hasSolderMask != other.m_hasSolderMask )
816 return false;
817
819 return false;
820
821 return EDA_SHAPE::operator==( other );
822}
823
824
825double PCB_SHAPE::Similarity( const BOARD_ITEM& aOther ) const
826{
827 if( aOther.Type() != Type() )
828 return 0.0;
829
830 const PCB_SHAPE& other = static_cast<const PCB_SHAPE&>( aOther );
831
832 double similarity = 1.0;
833
834 if( GetLayer() != other.GetLayer() )
835 similarity *= 0.9;
836
837 if( m_isKnockout != other.m_isKnockout )
838 similarity *= 0.9;
839
840 if( m_isLocked != other.m_isLocked )
841 similarity *= 0.9;
842
843 if( m_flags != other.m_flags )
844 similarity *= 0.9;
845
846 if( m_forceVisible != other.m_forceVisible )
847 similarity *= 0.9;
848
849 if( m_netinfo->GetNetCode() != other.m_netinfo->GetNetCode() )
850 similarity *= 0.9;
851
852 if( m_hasSolderMask != other.m_hasSolderMask )
853 similarity *= 0.9;
854
856 similarity *= 0.9;
857
858 similarity *= EDA_SHAPE::Similarity( other );
859
860 return similarity;
861}
862
863
864static struct PCB_SHAPE_DESC
865{
867 {
874
875 // Need to initialise enum_map before we can use a Property enum for it
877
878 if( layerEnum.Choices().GetCount() == 0 )
879 {
880 layerEnum.Undefined( UNDEFINED_LAYER );
881
882 for( PCB_LAYER_ID layer : LSET::AllLayersMask().Seq() )
883 layerEnum.Map( layer, LSET::Name( layer ) );
884 }
885
886 void ( PCB_SHAPE::*shapeLayerSetter )( PCB_LAYER_ID ) = &PCB_SHAPE::SetLayer;
887 PCB_LAYER_ID ( PCB_SHAPE::*shapeLayerGetter )() const = &PCB_SHAPE::GetLayer;
888
889 auto layerProperty = new PROPERTY_ENUM<PCB_SHAPE, PCB_LAYER_ID>(
890 _HKI( "Layer" ), shapeLayerSetter, shapeLayerGetter );
891
892 propMgr.ReplaceProperty( TYPE_HASH( BOARD_CONNECTED_ITEM ), _HKI( "Layer" ), layerProperty );
893
894 // Only polygons have meaningful Position properties.
895 // On other shapes, these are duplicates of the Start properties.
896 auto isPolygon =
897 []( INSPECTABLE* aItem ) -> bool
898 {
899 if( PCB_SHAPE* shape = dynamic_cast<PCB_SHAPE*>( aItem ) )
900 return shape->GetShape() == SHAPE_T::POLY;
901
902 return false;
903 };
904
906 _HKI( "Position X" ), isPolygon );
908 _HKI( "Position Y" ), isPolygon );
909
910 propMgr.Mask( TYPE_HASH( PCB_SHAPE ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Color" ) );
911 propMgr.Mask( TYPE_HASH( PCB_SHAPE ), TYPE_HASH( EDA_SHAPE ), _HKI( "Fill Color" ) );
912
913 auto isCopper =
914 []( INSPECTABLE* aItem ) -> bool
915 {
916 if( PCB_SHAPE* shape = dynamic_cast<PCB_SHAPE*>( aItem ) )
917 return shape->IsOnCopperLayer();
918
919 return false;
920 };
921
923 _HKI( "Net" ), isCopper );
924
925 auto isPadEditMode =
926 []( BOARD* aBoard ) -> bool
927 {
928 if( aBoard && aBoard->IsFootprintHolder() )
929 {
930 for( FOOTPRINT* fp : aBoard->Footprints() )
931 {
932 for( PAD* pad : fp->Pads() )
933 {
934 if( pad->IsEntered() )
935 return true;
936 }
937 }
938 }
939
940 return false;
941 };
942
943 auto showNumberBoxProperty =
944 [&]( INSPECTABLE* aItem ) -> bool
945 {
946 if( PCB_SHAPE* shape = dynamic_cast<PCB_SHAPE*>( aItem ) )
947 {
948 if( shape->GetShape() == SHAPE_T::RECTANGLE )
949 return isPadEditMode( shape->GetBoard() );
950 }
951
952 return false;
953 };
954
955 auto showSpokeTemplateProperty =
956 [&]( INSPECTABLE* aItem ) -> bool
957 {
958 if( PCB_SHAPE* shape = dynamic_cast<PCB_SHAPE*>( aItem ) )
959 {
960 if( shape->GetShape() == SHAPE_T::SEGMENT )
961 return isPadEditMode( shape->GetBoard() );
962 }
963
964 return false;
965 };
966
967 const wxString groupPadPrimitives = _HKI( "Pad Primitives" );
968
969 propMgr.AddProperty( new PROPERTY<PCB_SHAPE, bool>( _HKI( "Number Box" ),
972 groupPadPrimitives )
973 .SetAvailableFunc( showNumberBoxProperty )
975
976 propMgr.AddProperty( new PROPERTY<PCB_SHAPE, bool>( _HKI( "Thermal Spoke Template" ),
979 groupPadPrimitives )
980 .SetAvailableFunc( showSpokeTemplateProperty )
982
983 const wxString groupTechLayers = _HKI( "Technical Layers" );
984
985 auto isExternalCuLayer =
986 []( INSPECTABLE* aItem )
987 {
988 if( auto shape = dynamic_cast<PCB_SHAPE*>( aItem ) )
989 return IsExternalCopperLayer( shape->GetLayer() );
990
991 return false;
992 };
993
994 propMgr.AddProperty( new PROPERTY<PCB_SHAPE, bool>( _HKI( "Soldermask" ),
997 groupTechLayers )
998 .SetAvailableFunc( isExternalCuLayer );
999
1000 propMgr.AddProperty( new PROPERTY<PCB_SHAPE, std::optional<int>>(
1001 _HKI( "Soldermask Margin Override" ),
1004 PROPERTY_DISPLAY::PT_SIZE ),
1005 groupTechLayers )
1006 .SetAvailableFunc( isExternalCuLayer );
1007 }
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
Definition: approximation.h:32
constexpr int ARC_HIGH_DEF
Definition: base_units.h:120
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
#define DEFAULT_LINE_WIDTH
BASE_SET & set(size_t pos)
Definition: base_set.h:116
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
wxString GetNetnameMsg() const
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
NETINFO_ITEM * m_netinfo
Store all information about the net that item belongs to.
Container for design settings for a BOARD object.
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:79
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:239
bool m_isKnockout
Definition: board_item.h:439
virtual void SetLocked(bool aLocked)
Definition: board_item.h:330
PCB_LAYER_ID m_layer
Definition: board_item.h:438
bool m_isLocked
Definition: board_item.h:441
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:290
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:47
FOOTPRINT * GetParentFootprint() const
Definition: board_item.cpp:298
virtual bool IsLocked() const
Definition: board_item.cpp:75
virtual bool IsOnCopperLayer() const
Definition: board_item.h:150
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Definition: board_item.cpp:139
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:295
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:934
constexpr const Vec & GetPosition() const
Definition: box2.h:211
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:558
constexpr const Vec GetEnd() const
Definition: box2.h:212
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition: box2.h:146
Represent basic circle geometry with utility geometry functions.
Definition: circle.h:33
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
const KIID m_Uuid
Definition: eda_item.h:490
bool m_forceVisible
Definition: eda_item.h:503
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:501
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:176
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: eda_item.cpp:276
EDA_ITEM * m_parent
Linked list: Link (parent struct).
Definition: eda_item.h:502
SHAPE_T m_shape
Definition: eda_shape.h:433
bool m_proxyItem
Definition: eda_shape.h:457
bool m_endsSwapped
Definition: eda_shape.h:432
int m_editState
Definition: eda_shape.h:456
void rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle)
Definition: eda_shape.cpp:635
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
Definition: eda_shape.h:333
SHAPE_POLY_SET & GetPolyShape()
Definition: eda_shape.h:291
bool IsFilled() const
Definition: eda_shape.h:98
void ShapeGetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Definition: eda_shape.cpp:982
bool operator==(const EDA_SHAPE &aOther) const
Definition: eda_shape.cpp:2070
int GetRadius() const
Definition: eda_shape.cpp:840
SHAPE_T GetShape() const
Definition: eda_shape.h:132
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: eda_shape.cpp:234
VECTOR2I m_arcCenter
Definition: eda_shape.h:447
ARC_MID m_arcMidData
Definition: eda_shape.h:448
void RebuildBezierToSegmentsPointsList(int aMaxError)
Rebuild the m_bezierPoints vertex list that approximate the Bezier curve by a list of segments.
Definition: eda_shape.cpp:739
void flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection)
Definition: eda_shape.cpp:696
VECTOR2I m_start
Definition: eda_shape.h:444
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:174
void SetStart(const VECTOR2I &aStart)
Definition: eda_shape.h:141
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:137
void SwapShape(EDA_SHAPE *aImage)
Definition: eda_shape.cpp:1871
std::vector< VECTOR2I > GetRectCorners() const
Definition: eda_shape.cpp:1404
void SetEnd(const VECTOR2I &aEnd)
Definition: eda_shape.h:178
wxString SHAPE_T_asString() const
Definition: eda_shape.cpp:340
double Similarity(const EDA_SHAPE &aOther) const
Definition: eda_shape.cpp:2115
VECTOR2I m_end
Definition: eda_shape.h:445
SHAPE_POLY_SET m_poly
Definition: eda_shape.h:454
virtual int GetWidth() const
Definition: eda_shape.h:122
STROKE_PARAMS m_stroke
Definition: eda_shape.h:434
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const
Convert the shape to a closed polygon.
Definition: eda_shape.cpp:1935
VECTOR2I m_bezierC1
Definition: eda_shape.h:450
void SetWidth(int aWidth)
Definition: eda_shape.h:121
VECTOR2I m_bezierC2
Definition: eda_shape.h:451
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: eda_shape.cpp:146
VECTOR2I GetArcMid() const
Definition: eda_shape.cpp:810
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition: property.h:686
static ENUM_MAP< T > & Instance()
Definition: property.h:680
ENUM_MAP & Undefined(T aValue)
Definition: property.h:693
wxPGChoices & Choices()
Definition: property.h:729
const wxString & GetReference() const
Definition: footprint.h:620
Class that other classes need to inherit from, in order to be inspectable.
Definition: inspectable.h:37
Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:180
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
Definition: pcb_painter.h:185
PCB specific render settings.
Definition: pcb_painter.h:78
PCB_LAYER_ID GetPrimaryHighContrastLayer() const
Return the board layer which is in high-contrast mode.
bool GetHighContrast() const
static constexpr double LOD_HIDE
Return this constant from ViewGetLOD() to hide the item unconditionally.
Definition: view_item.h:174
static constexpr double LOD_SHOW
Return this constant from ViewGetLOD() to show the item unconditionally.
Definition: view_item.h:179
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:418
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:216
Definition: kiid.h:49
std::string AsStdString() const
Definition: kiid.cpp:252
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:37
static LSET AllLayersMask()
Definition: lset.cpp:587
void RunOnLayers(const std::function< void(PCB_LAYER_ID)> &aFunction) const
Execute a function on each layer of the LSET.
Definition: lset.h:253
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition: lset.cpp:188
int GetNetCode() const
Definition: netinfo.h:108
Definition: pad.h:54
std::optional< int > GetLocalThermalSpokeWidthOverride() const
Definition: pad.h:601
virtual void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
Definition: pcb_shape.cpp:494
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: pcb_shape.cpp:631
void swapData(BOARD_ITEM *aImage) override
Definition: pcb_shape.cpp:729
bool IsConnected() const override
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
Definition: pcb_shape.cpp:163
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_shape.cpp:572
std::optional< int > GetLocalSolderMaskMargin() const
Definition: pcb_shape.h:186
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_shape.h:79
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_shape.cpp:480
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_shape.cpp:697
PCB_SHAPE(BOARD_ITEM *aParent, KICAD_T aItemType, SHAPE_T aShapeType)
Definition: pcb_shape.cpp:51
int GetWidth() const override
Definition: pcb_shape.cpp:301
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: pcb_shape.cpp:712
bool HasSolderMask() const
Definition: pcb_shape.h:183
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Make a set of SHAPE objects representing the PCB_SHAPE.
Definition: pcb_shape.cpp:723
void SetHasSolderMask(bool aVal)
Definition: pcb_shape.h:182
std::optional< int > m_solderMaskMargin
Definition: pcb_shape.h:203
int GetSolderMaskExpansion() const
Definition: pcb_shape.cpp:179
void NormalizeForCompare() override
Normalize coordinates to compare 2 similar PCB_SHAPES similat to Normalize(), but also normalize SEGM...
Definition: pcb_shape.cpp:458
const VECTOR2I GetFocusPosition() const override
Allows items to return their visual center rather than their anchor.
Definition: pcb_shape.cpp:317
virtual void SetLayerSet(const LSET &aLayers) override
Definition: pcb_shape.cpp:235
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: pcb_shape.cpp:486
virtual std::vector< VECTOR2I > GetCorners() const
Return 4 corners for a rectangle or rotated rectangle (stored as a poly).
Definition: pcb_shape.cpp:359
bool IsProxyItem() const override
Definition: pcb_shape.h:114
bool m_hasSolderMask
Definition: pcb_shape.h:202
~PCB_SHAPE() override
Definition: pcb_shape.cpp:67
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_shape.cpp:218
bool operator==(const PCB_SHAPE &aShape) const
Definition: pcb_shape.cpp:790
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: pcb_shape.cpp:170
wxString GetFriendlyName() const override
Definition: pcb_shape.h:64
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the shape to a closed polygon.
Definition: pcb_shape.cpp:771
void SetIsProxyItem(bool aIsProxy=true) override
Definition: pcb_shape.cpp:530
void StyleFromSettings(const BOARD_DESIGN_SETTINGS &settings) override
Definition: pcb_shape.cpp:311
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition: pcb_shape.h:185
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_shape.cpp:387
std::vector< VECTOR2I > GetConnectionPoints() const
Definition: pcb_shape.cpp:248
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_shape.cpp:94
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_shape.cpp:706
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_shape.cpp:200
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: pcb_shape.cpp:650
void Scale(double aScale)
Definition: pcb_shape.cpp:393
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_shape.cpp:72
void Normalize() override
Perform any normalization required after a user rotate and/or flip.
Definition: pcb_shape.cpp:399
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: pcb_shape.cpp:131
std::vector< int > ViewGetLayers() const override
Definition: pcb_shape.cpp:604
double Similarity(const BOARD_ITEM &aBoardItem) const override
Return a measure of how likely the other object is to represent the same object.
Definition: pcb_shape.cpp:825
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: pcb_shape.h:69
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
Definition: property.h:257
PROPERTY_BASE & SetIsHiddenFromRulesEditor(bool aHide=true)
Definition: property.h:307
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:85
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
void Mask(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName)
Sets a base class property as masked in a derived class.
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:87
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void OverrideAvailability(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName, std::function< bool(INSPECTABLE *)> aFunc)
Sets an override availability functor for a base class property of a given derived class.
PROPERTY_BASE & ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew, const wxString &aGroup=wxEmptyString)
Replace an existing property for a specific type.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Definition: seg.h:42
VECTOR2I A
Definition: seg.h:49
VECTOR2I B
Definition: seg.h:50
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
SEG Segment(int aIndex) const
Return a copy of the aIndex-th segment in the line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
int SegmentCount() const
Return the number of segments in this line chain.
const std::vector< VECTOR2I > & CPoints() const
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
void Mirror(const VECTOR2I &aRef, FLIP_DIRECTION aFlipDirection)
Mirror the line points about y or x (or both)
int OutlineCount() const
Return the number of outlines in the set.
void SetWidth(int aWidth)
#define _HKI(x)
#define _(s)
#define PCB_EDIT_FRAME_NAME
SHAPE_T
Definition: eda_shape.h:43
FILL_T
Definition: eda_shape.h:56
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: layer_id.cpp:210
bool IsSolderMaskLayer(int aLayer)
Definition: layer_ids.h:651
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition: layer_ids.h:147
int GetNetnameLayer(int aLayer)
Return a netname layer corresponding to the given layer.
Definition: layer_ids.h:756
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
Definition: layer_ids.h:581
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
Definition: layer_ids.h:269
@ LAYER_FOOTPRINTS_FR
Show footprints on front.
Definition: layer_ids.h:221
@ LAYER_FOOTPRINTS_BK
Show footprints on back.
Definition: layer_ids.h:222
bool IsExternalCopperLayer(int aLayerId)
Test whether a layer is an external (F_Cu or B_Cu) copper layer.
Definition: layer_ids.h:592
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ Edge_Cuts
Definition: layer_ids.h:112
@ B_Mask
Definition: layer_ids.h:98
@ B_Cu
Definition: layer_ids.h:65
@ F_Mask
Definition: layer_ids.h:97
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
@ F_Cu
Definition: layer_ids.h:64
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 ...
Definition: macros.h:83
#define UNIMPLEMENTED_FOR(type)
Definition: macros.h:96
constexpr void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:45
FLIP_DIRECTION
Definition: mirror.h:27
std::vector< TYPED_POINT2I > GetCircleKeyPoints(const CIRCLE &aCircle, bool aIncludeCenter)
Get key points of an CIRCLE.
static struct PCB_SHAPE_DESC _PCB_SHAPE_DESC
static bool isCopper(const PNS::ITEM *aItem)
#define TYPE_HASH(x)
Definition: property.h:71
#define REGISTER_TYPE(x)
Definition: property_mgr.h:371
Utility functions for working with shapes.
const int scale
constexpr int mmToIU(double mm) const
Definition: base_units.h:88
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition: pcb_shape.cpp:749
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:88
@ PCB_LOCATE_BOARD_EDGE_T
Definition: typeinfo.h:130
@ PCB_SHAPE_LOCATE_CIRCLE_T
Definition: typeinfo.h:135
@ PCB_SHAPE_LOCATE_SEGMENT_T
Definition: typeinfo.h:133
@ PCB_SHAPE_LOCATE_RECT_T
Definition: typeinfo.h:134
@ PCB_SHAPE_LOCATE_BEZIER_T
Definition: typeinfo.h:138
@ PCB_SHAPE_LOCATE_POLY_T
Definition: typeinfo.h:137
@ PCB_SHAPE_LOCATE_ARC_T
Definition: typeinfo.h:136
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:695
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_MM
Definition: zones.h:34