KiCad PCB EDA Suite
zones_by_polygon.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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
7  * Copyright (C) 1992-2017 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 
31 #include <fctsys.h>
32 #include <kiface_i.h>
33 #include <class_drawpanel.h>
34 #include <confirm.h>
35 #include <pcb_edit_frame.h>
36 #include <board_commit.h>
37 #include <view/view.h>
38 
39 #include <class_board.h>
40 #include <class_zone.h>
41 
42 #include <pcbnew.h>
43 #include <zones.h>
44 #include <pcbnew_id.h>
45 #include <protos.h>
47 #include <drc.h>
49 
51 
52 #include <zone_filler.h>
53 
54 // Outline creation:
55 static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC );
56 static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
57  const wxPoint& aPosition, bool aErase );
58 
59 // Corner moving
60 static void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC );
62  wxDC* aDC,
63  const wxPoint& aPosition,
64  bool aErase );
65 
66 // Local variables
67 static wxPoint s_CornerInitialPosition; // Used to abort a move corner command
68 static bool s_CornerIsNew; // Used to abort a move corner command (if it is a new corner, it must be deleted)
69 static bool s_AddCutoutToCurrentZone; // if true, the next outline will be added to s_CurrentZone
70 static ZONE_CONTAINER* s_CurrentZone; // if != NULL, these ZONE_CONTAINER params will be used for the next zone
71 static wxPoint s_CursorLastPosition; // in move zone outline, last cursor position. Used to calculate the move vector
72 static PICKED_ITEMS_LIST s_PickedList; // a picked list to save zones for undo/redo command
73 static PICKED_ITEMS_LIST s_AuxiliaryList; // a picked list to store zones that are deleted or added when combined
74 
75 
77 {
78  if( !aZone )
79  return;
80 
82  s_CurrentZone = aZone;
83 
84  // set zone settings to the current zone
85  ZONE_SETTINGS zoneInfo = GetZoneSettings();
86  zoneInfo << *aZone;
87  SetZoneSettings( zoneInfo );
88 
89  // Use the general event handler to set others params (like toolbar)
90  wxCommandEvent evt;
91  evt.SetId( aZone->GetIsKeepout() ? ID_PCB_KEEPOUT_AREA_BUTT : ID_PCB_ZONES_BUTT );
92  OnSelectTool( evt );
93 }
94 
95 
97 {
98  if( !aZone )
99  return;
100 
102  s_CurrentZone = aZone;
103 
104  // set zones setup to the current zone
105  ZONE_SETTINGS zoneInfo = GetZoneSettings();
106  zoneInfo << *aZone;
107  SetZoneSettings( zoneInfo );
108 
109  // Use the general event handle to set others params (like toolbar)
110  wxCommandEvent evt;
111  evt.SetId( aZone->GetIsKeepout() ? ID_PCB_KEEPOUT_AREA_BUTT : ID_PCB_ZONES_BUTT );
112  OnSelectTool( evt );
113 }
114 
115 
117 {
118  ZONE_SETTINGS zoneSettings;
119  zoneSettings << *aZone;
120  int dialogResult;
121 
122  if( aZone->GetIsKeepout() )
123  dialogResult = InvokeKeepoutAreaEditor( this, &zoneSettings );
124  else if( aZone->IsOnCopperLayer() )
125  dialogResult = InvokeCopperZonesEditor( this, &zoneSettings );
126  else
127  dialogResult = InvokeNonCopperZonesEditor( this, &zoneSettings );
128 
129  if( dialogResult != wxID_OK )
130  return;
131 
132  // If the new zone is on the same layer as the the initial zone we'll end up combining
133  // them which will result in a no-op. Might as well exit here.
134  if( aZone->GetIsKeepout() && ( aZone->GetLayerSet() == zoneSettings.m_Layers ) )
135  {
136  DisplayErrorMessage( this, _( "The duplicated zone cannot be on the same layers as the original zone." ) );
137  return;
138  }
139  else if( !aZone->GetIsKeepout() && ( aZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) )
140  {
141  DisplayErrorMessage( this, _( "The duplicated zone cannot be on the same layer as the original zone." ) );
142  return;
143  }
144 
145  ZONE_CONTAINER* newZone = new ZONE_CONTAINER( *aZone );
146  newZone->UnFill();
147  zoneSettings.ExportSetting( *newZone );
148  newZone->Hatch();
149 
152  SaveCopyOfZones( s_PickedList, GetBoard(), newZone->GetNetCode(), newZone->GetLayer() );
153  GetBoard()->Add( newZone );
154 
155  ITEM_PICKER picker( newZone, UR_NEW );
156  s_PickedList.PushItem( picker );
157 
158  GetScreen()->SetCurItem( NULL ); // This outline may be deleted when merging outlines
159 
160  // Combine zones if possible
162 
163  // Redraw zones
164  GetBoard()->RedrawAreasOutlines( m_canvas, aDC, GR_OR, newZone->GetLayer() );
165  GetBoard()->RedrawFilledAreas( m_canvas, aDC, GR_OR, newZone->GetLayer() );
166 
167  DRC drc( this );
168 
169  if( GetBoard()->GetAreaIndex( newZone ) >= 0 && drc.TestZoneToZoneOutline( newZone, true ) )
170  DisplayInfoMessage( this, _( "Warning: The new zone fails DRC" ) );
171 
175 
176  OnModify();
177 }
178 
179 
181 {
183 
184  if( !zone )
185  return 0;
186 
187  if( !zone->GetNumCorners() )
188  return 0;
189 
190  zone->DrawWhileCreateOutline( m_canvas, DC, GR_XOR );
191 
192  if( zone->GetNumCorners() > 2 )
193  {
194  zone->Outline()->RemoveVertex( zone->GetNumCorners() - 1 );
195 
196  if( m_canvas->IsMouseCaptured() )
197  m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
198  }
199  else
200  {
201  m_canvas->SetMouseCapture( NULL, NULL );
202  SetCurItem( NULL );
203  zone->RemoveAllContours();
204  zone->ClearFlags();
205  }
206 
207  return zone->GetNumCorners();
208 }
209 
210 
215 static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC )
216 {
217  PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent();
218  ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour;
219 
220  if( zone )
221  {
222  zone->DrawWhileCreateOutline( Panel, DC, GR_XOR );
223  zone->RemoveAllContours();
224  if( zone->IsNew() )
225  {
226  delete zone;
227  pcbframe->GetBoard()->m_CurrentZoneContour = NULL;
228  }
229  else
230  zone->ClearFlags();
231  }
232 
233  pcbframe->SetCurItem( NULL );
234  s_AddCutoutToCurrentZone = false;
235  s_CurrentZone = NULL;
236  Panel->SetMouseCapture( NULL, NULL );
237 }
238 
239 
241  int corner_id, bool IsNewCorner )
242 {
243  if( aZone->IsOnCopperLayer() ) // Show the Net
244  {
245  if( GetBoard()->IsHighLightNetON() && DC )
246  {
247  HighLight( DC ); // Remove old highlight selection
248  }
249 
250  ZONE_SETTINGS zoneInfo = GetZoneSettings();
251  zoneInfo.m_NetcodeSelection = aZone->GetNetCode();
252  SetZoneSettings( zoneInfo );
253 
254  GetBoard()->SetHighLightNet( aZone->GetNetCode() );
255 
256  if( DC )
257  HighLight( DC );
258  }
259 
260 
261  // Prepare copy of old zones, for undo/redo.
262  // if the corner is new, remove it from list, save and insert it in list
263  VECTOR2I corner = aZone->Outline()->Vertex( corner_id );
264 
265  if ( IsNewCorner )
266  aZone->Outline()->RemoveVertex( corner_id );
267 
270 
271  SaveCopyOfZones( s_PickedList, GetBoard(), aZone->GetNetCode(), aZone->GetLayer() );
272 
273  if ( IsNewCorner )
274  aZone->Outline()->InsertVertex(corner_id-1, corner );
275 
276  aZone->SetFlags( IN_EDIT );
279  s_CornerInitialPosition = static_cast<wxPoint>( aZone->GetCornerPosition( corner_id ) );
280  s_CornerIsNew = IsNewCorner;
281  s_AddCutoutToCurrentZone = false;
282  s_CurrentZone = NULL;
283 }
284 
285 
287  ZONE_CONTAINER* aZone,
288  int corner_id )
289 {
290  aZone->SetFlags( IS_DRAGGED );
291  aZone->SetSelectedCorner( corner_id );
295  s_AddCutoutToCurrentZone = false;
296  s_CurrentZone = NULL;
297 
300  SaveCopyOfZones( s_PickedList, GetBoard(), aZone->GetNetCode(), aZone->GetLayer() );
301 }
302 
303 
305 {
306  // Show the Net
307  if( aZone->IsOnCopperLayer() ) // Show the Net
308  {
309  if( GetBoard()->IsHighLightNetON() )
310  {
311  HighLight( DC ); // Remove old highlight selection
312  }
313 
314  ZONE_SETTINGS zoneInfo = GetZoneSettings();
315  zoneInfo.m_NetcodeSelection = aZone->GetNetCode();
316  SetZoneSettings( zoneInfo );
317 
318  GetBoard()->SetHighLightNet( aZone->GetNetCode() );
319  HighLight( DC );
320  }
321 
324  SaveCopyOfZones( s_PickedList, GetBoard(), aZone->GetNetCode(), aZone->GetLayer() );
325 
326  aZone->SetFlags( IS_MOVED );
330  s_CornerIsNew = false;
331  s_AddCutoutToCurrentZone = false;
332  s_CurrentZone = NULL;
333 }
334 
335 
337 {
338  aZone->ClearFlags();
339  m_canvas->SetMouseCapture( NULL, NULL );
340 
341  if( DC )
342  aZone->Draw( m_canvas, DC, GR_OR );
343 
344  OnModify();
345  s_AddCutoutToCurrentZone = false;
346  s_CurrentZone = NULL;
347 
348  SetCurItem( NULL ); // This outline can be deleted when merging outlines
349 
350  // Combine zones if possible
352  m_canvas->Refresh();
353 
354  int ii = GetBoard()->GetAreaIndex( aZone ); // test if aZone exists
355 
356  if( ii < 0 )
357  aZone = NULL; // was removed by combining zones
358 
361  s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
362 
363  DRC drc( this );
364  int error_count = drc.TestZoneToZoneOutline( aZone, true );
365 
366  if( error_count )
367  {
368  DisplayErrorMessage( this, _( "Area: DRC outline error" ) );
369  }
370 }
371 
372 
374 {
375  OnModify();
376 
377  if( aZone->Outline()->TotalVertices() <= 3 )
378  {
380 
381  if( DC )
382  { // Remove the full zone because this is no more an area
383  aZone->UnFill();
384  aZone->DrawFilledArea( m_canvas, DC, GR_XOR );
385  }
386 
387  GetBoard()->Delete( aZone );
388  return;
389  }
390 
391  PCB_LAYER_ID layer = aZone->GetLayer();
392 
393  if( DC )
394  {
395  GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_XOR, layer );
396  GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_XOR, layer );
397  }
398 
400  s_PickedList. ClearListAndDeleteItems();
401  SaveCopyOfZones( s_PickedList, GetBoard(), aZone->GetNetCode(), aZone->GetLayer() );
402  aZone->Outline()->RemoveVertex( aZone->GetSelectedCorner() );
403 
404  // modify zones outlines according to the new aZone shape
406 
407  if( DC )
408  {
409  GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, layer );
410  GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_OR, layer );
411  }
412 
415  s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
416 
417  int ii = GetBoard()->GetAreaIndex( aZone ); // test if aZone exists
418 
419  if( ii < 0 )
420  aZone = NULL; // aZone does not exist anymore, after combining zones
421 
422  DRC drc( this );
423  int error_count = drc.TestZoneToZoneOutline( aZone, true );
424 
425  if( error_count )
426  {
427  DisplayErrorMessage( this, _( "Area: DRC outline error" ) );
428  }
429 }
430 
431 
437 {
438  PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent();
439  ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem();
440 
441  if( zone->IsMoving() )
442  {
443  wxPoint offset;
445  zone->Move( offset );
446  }
447  else if( zone->IsDragging() )
448  {
450  int selection = zone->GetSelectedCorner();
451  zone->MoveEdge( offset, selection );
452  }
453  else
454  {
455  if( s_CornerIsNew )
456  {
457  zone->Outline()->RemoveVertex( zone->GetSelectedCorner() );
458  }
459  else
460  {
461  wxPoint pos = s_CornerInitialPosition;
462  zone->Outline()->Vertex( zone->GetSelectedCorner() ) = pos;
463  }
464  }
465 
466  Panel->SetMouseCapture( NULL, NULL );
468  s_PickedList. ClearListAndDeleteItems();
469  Panel->Refresh();
470 
471  pcbframe->SetCurItem( NULL );
472  zone->ClearFlags();
473  s_AddCutoutToCurrentZone = false;
474  s_CurrentZone = NULL;
475 }
476 
477 
480  const wxPoint& aPosition, bool aErase )
481 {
482  PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) aPanel->GetParent();
483  ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem();
484 
485  if( aErase ) // Undraw edge in old position
486  {
487  zone->Draw( aPanel, aDC, GR_XOR );
488  }
489 
490  wxPoint pos = pcbframe->GetCrossHairPosition();
491 
492  if( zone->IsMoving() )
493  {
494  wxPoint offset;
495  offset = pos - s_CursorLastPosition;
496  zone->Move( offset );
497  s_CursorLastPosition = pos;
498  }
499  else if( zone->IsDragging() )
500  {
501  wxPoint offset = pos - s_CursorLastPosition;
502  int selection = zone->GetSelectedCorner();
503  zone->MoveEdge( offset, selection );
504  s_CursorLastPosition = pos;
505  }
506  else
507  {
508  zone->Outline()->Vertex( zone->GetSelectedCorner() ) = pos;
509  }
510 
511  zone->Draw( aPanel, aDC, GR_XOR );
512 }
513 
514 
515 
517 {
518  ZONE_SETTINGS zoneInfo = GetZoneSettings();
519 
520  // verify if s_CurrentZone exists (could be deleted since last selection) :
521  int ii;
522  for( ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
523  {
524  if( s_CurrentZone == GetBoard()->GetArea( ii ) )
525  break;
526  }
527 
528  if( ii >= GetBoard()->GetAreaCount() ) // Not found: could be deleted since last selection
529  {
530  s_AddCutoutToCurrentZone = false;
531  s_CurrentZone = NULL;
532  }
533 
535 
536  // Verify if a new zone is allowed on this layer:
537  if( zone == NULL )
538  {
540  {
541  DisplayErrorMessage( this,
542  _( "Error: a keepout area is allowed only on copper layers" ) );
543  return 0;
544  }
545  }
546 
547  // If no zone contour in progress, a new zone is being created,
548  if( zone == NULL )
549  {
551  zone->SetFlags( IS_NEW );
552  zone->SetTimeStamp( GetNewTimeStamp() );
553  }
554 
555  if( zone->GetNumCorners() == 0 ) // Start a new contour: init zone params (net, layer ...)
556  {
557  if( !s_CurrentZone ) // A new outline is created, from scratch
558  {
559  int dialogResult;
560 
561  // Prompt user for parameters:
563 
564  if( IsCopperLayer( GetActiveLayer() ) )
565  {
566  // Put a zone on a copper layer
567  if( GetBoard()->GetHighLightNetCode() > 0 )
568  {
570  zone->SetNetCode( zoneInfo.m_NetcodeSelection );
571  }
572 
573  double tmp = ZONE_THERMAL_RELIEF_GAP_MIL;
574 
575  wxConfigBase* cfg = Kiface().KifaceSettings();
576  cfg->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, &tmp );
577  zoneInfo.m_ThermalReliefGap = KiROUND( tmp * IU_PER_MILS);
578 
581  zoneInfo.m_ThermalReliefCopperBridge = KiROUND( tmp * IU_PER_MILS );
582 
583  tmp = ZONE_CLEARANCE_MIL;
584  cfg->Read( ZONE_CLEARANCE_WIDTH_STRING_KEY, &tmp );
585  zoneInfo.m_ZoneClearance = KiROUND( tmp * IU_PER_MILS );
586 
587  tmp = ZONE_THICKNESS_MIL;
588  cfg->Read( ZONE_MIN_THICKNESS_WIDTH_STRING_KEY, &tmp );
589  zoneInfo.m_ZoneMinThickness = KiROUND( tmp * IU_PER_MILS );
590 
592  {
593  zoneInfo.SetIsKeepout( true );
594  // Netcode, netname and some other settings are irrelevant,
595  // so ensure they are cleared
598  zoneInfo.SetCornerRadius( 0 );
599 
600  dialogResult = InvokeKeepoutAreaEditor( this, &zoneInfo );
601  }
602  else
603  {
604  zoneInfo.m_CurrentZone_Layer = GetActiveLayer(); // Preselect a layer
605  zoneInfo.SetIsKeepout( false );
606  dialogResult = InvokeCopperZonesEditor( this, &zoneInfo );
607  }
608  }
609  else // Put a zone on a non copper layer (technical layer)
610  {
611  zoneInfo.m_CurrentZone_Layer = GetActiveLayer(); // Preselect a layer
612  zoneInfo.SetIsKeepout( false );
613  zoneInfo.m_NetcodeSelection = 0; // No net for non copper zones
614  dialogResult = InvokeNonCopperZonesEditor( this, &zoneInfo );
615  }
616 
618  m_canvas->SetIgnoreMouseEvents( false );
619 
620  if( dialogResult == wxID_CANCEL )
621  {
622  GetBoard()->m_CurrentZoneContour = NULL;
623  delete zone;
624  return 0;
625  }
626 
627  // Switch active layer to the selected zone layer
629  SetZoneSettings( zoneInfo );
630  OnModify();
631  }
632  else
633  {
634  // Start a new contour: init zone params (net and layer) from an existing
635  // zone (add cutout or similar zone)
636 
639 
640  zoneInfo << *s_CurrentZone;
641 
642  SetZoneSettings( zoneInfo );
643  OnModify();
644  }
645 
646  // Show the Net for zones on copper layers
647  if( IsCopperLayer( zoneInfo.m_CurrentZone_Layer ) &&
648  !zoneInfo.GetIsKeepout() )
649  {
650  if( s_CurrentZone )
651  {
653  GetBoard()->SetZoneSettings( zoneInfo );
654  }
655 
656  if( GetBoard()->IsHighLightNetON() )
657  {
658  HighLight( DC ); // Remove old highlight selection
659  }
660 
662  HighLight( DC );
663  }
664 
666  s_CurrentZone = NULL; // the zone is used only once ("add similar zone" command)
667  }
668 
669  // if first segment
670  if( zone->GetNumCorners() == 0 )
671  {
672  zoneInfo.ExportSetting( *zone );
673 
674  // A duplicated corner is needed; null segments are removed when the zone is finished.
675  zone->AppendCorner( GetCrossHairPosition(), -1 );
676  // Add the duplicate corner:
677  zone->AppendCorner( GetCrossHairPosition(), -1, true );
678 
679  if( Settings().m_legacyDrcOn && (m_drc->DrcOnCreatingZone( zone, 0 ) == BAD_DRC)
680  && zone->IsOnCopperLayer() )
681  {
682  zone->ClearFlags();
683  zone->RemoveAllContours();
684 
685  // use the form of SetCurItem() which does not write to the msg panel,
686  // SCREEN::SetCurItem(), so the DRC error remains on screen.
687  // PCB_EDIT_FRAME::SetCurItem() calls DisplayInfo().
688  GetScreen()->SetCurItem( NULL );
689  DisplayErrorMessage( this, _( "DRC error: this start point is inside or too close another area" ) );
690  return 0;
691  }
692 
693  SetCurItem( zone );
695  }
696  else // edge in progress:
697  {
698  ii = zone->GetNumCorners() - 1;
699 
700  // edge in progress : the current corner coordinate was set
701  // by Show_New_Edge_While_Move_Mouse
702  if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) )
703  {
704  if( !Settings().m_legacyDrcOn || !zone->IsOnCopperLayer()
705  || ( m_drc->DrcOnCreatingZone( zone, ii - 1 ) == OK_DRC ) )
706  {
707  // Ok, we can add a new corner
708  if( m_canvas->IsMouseCaptured() )
709  m_canvas->CallMouseCapture( DC, wxPoint(0,0), false );
710 
711  // It is necessary to allow duplication of the points, as we have to handle the
712  // continuous drawing while creating the zone at the same time as we build it. Null
713  // segments are removed when the zone is finished, in End_Zone.
714  zone->AppendCorner( GetCrossHairPosition(), -1, true );
715 
716  SetCurItem( zone ); // calls DisplayInfo().
717 
718  if( m_canvas->IsMouseCaptured() )
719  m_canvas->CallMouseCapture( DC, wxPoint(0,0), false );
720  }
721  }
722  }
723 
724  return zone->GetNumCorners();
725 }
726 
727 
728 bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
729 {
731 
732  if( !zone )
733  return true;
734 
735  // Validate the current outline:
736  if( zone->GetNumCorners() <= 2 ) // An outline must have 3 corners or more
737  {
739  return true;
740  }
741 
742  // Remove the last corner if is is at the same location as the prevoius corner
743  zone->Outline()->RemoveNullSegments();
744 
745  // Validate the current edge:
746  int icorner = zone->GetNumCorners() - 1;
747  if( zone->IsOnCopperLayer() )
748  {
749  if( Settings().m_legacyDrcOn &&
750  m_drc->DrcOnCreatingZone( zone, icorner - 1 ) == BAD_DRC ) // we can't validate last edge
751  return false;
752 
753  if( Settings().m_legacyDrcOn &&
754  m_drc->DrcOnCreatingZone( zone, icorner ) == BAD_DRC ) // we can't validate the closing edge
755  {
756  DisplayErrorMessage( this, _( "DRC error: closing this area creates a DRC error with another area" ) );
758  return false;
759  }
760  }
761 
762  zone->ClearFlags();
763 
764  zone->DrawWhileCreateOutline( m_canvas, DC, GR_XOR );
765 
766  m_canvas->SetMouseCapture( NULL, NULL );
767 
768  // Undraw old drawings, because they can have important changes
769  PCB_LAYER_ID layer = zone->GetLayer();
770  GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_XOR, layer );
771  GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_XOR, layer );
772 
773  // Save initial zones configuration, for undo/redo, before adding new zone
777 
778  // Put new zone in list
779  if( !s_CurrentZone )
780  {
781  GetBoard()->Add( zone );
782 
783  // Add this zone in picked list, as new item
784  ITEM_PICKER picker( zone, UR_NEW );
785  s_PickedList.PushItem( picker );
786  }
787  else // Append this outline as a cutout to an existing zone
788  {
789  s_CurrentZone->Outline()->AddHole( zone->Outline()->Outline( 0 ) );
790 
791  zone->RemoveAllContours(); // All corners are copied in s_CurrentZone. Free corner list.
792  zone = s_CurrentZone;
793  }
794 
795  s_AddCutoutToCurrentZone = false;
796  s_CurrentZone = NULL;
797  GetBoard()->m_CurrentZoneContour = NULL;
798 
799  GetScreen()->SetCurItem( NULL ); // This outline can be deleted when merging outlines
800 
801  // Combine zones if possible :
803 
804  // Redraw the real edge zone :
805  GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, layer );
806  GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_OR, layer );
807 
808  int ii = GetBoard()->GetAreaIndex( zone ); // test if zone exists
809 
810  if( ii < 0 )
811  zone = NULL; // was removed by combining zones
812 
813  DRC drc( this );
814  int error_count = drc.TestZoneToZoneOutline( zone, true );
815 
816  if( error_count )
817  {
818  DisplayErrorMessage( this, _( "Area: DRC outline error" ) );
819  }
820 
823  s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
824 
825  OnModify();
826  return true;
827 }
828 
829 
830 /* Redraws the zone outlines when moving mouse
831  */
832 static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
833  const wxPoint& aPosition, bool aErase )
834 {
835  PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) aPanel->GetParent();
836  wxPoint c_pos = pcbframe->GetCrossHairPosition();
837  ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour;
838 
839  if( !zone )
840  return;
841 
842  int icorner = zone->GetNumCorners() - 1;
843 
844  if( icorner < 1 )
845  return; // We must have 2 (or more) corners
846 
847  if( aErase ) // Undraw edge in old position
848  {
849  zone->DrawWhileCreateOutline( aPanel, aDC );
850  }
851 
852  // Redraw the current edge in its new position
853  if( pcbframe->GetZoneSettings().m_Zone_45_Only )
854  {
855  // calculate the new position as allowed
856  wxPoint StartPoint = static_cast<wxPoint>( zone->GetCornerPosition( icorner - 1 ) );
857  c_pos = CalculateSegmentEndPoint( c_pos, StartPoint );
858  }
859 
860  zone->SetCornerPosition( icorner, c_pos );
861 
862  zone->DrawWhileCreateOutline( aPanel, aDC );
863 }
864 
866 {
867  int dialogResult;
868  ZONE_SETTINGS zoneInfo = GetZoneSettings();
869 
870  BOARD_COMMIT commit( this );
872 
873  // Save initial zones configuration, for undo/redo, before adding new zone
874  // note the net name and the layer can be changed, so we must save all zones
878 
879  if( aZone->GetIsKeepout() )
880  {
881  // edit a keepout area on a copper layer
882  zoneInfo << *aZone;
883  dialogResult = InvokeKeepoutAreaEditor( this, &zoneInfo );
884  }
885  else if( IsCopperLayer( aZone->GetLayer() ) )
886  {
887  // edit a zone on a copper layer
888  zoneInfo << *aZone;
889  dialogResult = InvokeCopperZonesEditor( this, &zoneInfo );
890  }
891  else
892  {
893  zoneInfo << *aZone;
894  dialogResult = InvokeNonCopperZonesEditor( this, &zoneInfo );
895  }
896 
898  m_canvas->SetIgnoreMouseEvents( false );
899 
900  if( dialogResult == wxID_CANCEL )
901  {
904  return;
905  }
906 
907  SetZoneSettings( zoneInfo );
908  OnModify();
909 
910  if( dialogResult == ZONE_EXPORT_VALUES )
911  {
913  commit.Stage( s_PickedList );
914  commit.Push( _( "Modify zone properties" ) );
915  s_PickedList.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
916  return;
917  }
918 
919  wxBusyCursor dummy;
920 
921  // Undraw old zone outlines
922  for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
923  {
924  ZONE_CONTAINER* edge_zone = GetBoard()->GetArea( ii );
925  edge_zone->Draw( m_canvas, DC, GR_XOR );
926 
927  if( IsGalCanvasActive() )
928  {
929  GetGalCanvas()->GetView()->Update( edge_zone );
930  }
931  }
932 
933  zoneInfo.ExportSetting( *aZone );
934 
935  NETINFO_ITEM* net = GetBoard()->FindNet( zoneInfo.m_NetcodeSelection );
936 
937  if( net ) // net == NULL should not occur
938  aZone->SetNetCode( net->GetNet() );
939 
940  // Combine zones if possible
942 
943  // Redraw the real new zone outlines
945 
947 
948  // refill zones with the new properties applied
949  std::vector<ZONE_CONTAINER*> zones_to_refill;
950 
951  for( unsigned i = 0; i < s_PickedList.GetCount(); ++i )
952  {
953  ZONE_CONTAINER* zone = dyn_cast<ZONE_CONTAINER*>( s_PickedList.GetPickedItem( i ) );
954 
955  if( zone == nullptr )
956  {
957  wxASSERT_MSG( false, "Expected a zone after zone properties edit" );
958  continue;
959  }
960 
961  if( zone->IsFilled() )
962  zones_to_refill.push_back( zone );
963  }
964 
965  if( zones_to_refill.size() )
966  {
967  ZONE_FILLER filler ( GetBoard() );
968  wxString title;
969  title.Printf( _( "Refill %d Zones" ), (int)zones_to_refill.size() );
970  std::unique_ptr<WX_PROGRESS_REPORTER> progressReporter(
971  new WX_PROGRESS_REPORTER( this, title, 4 ) );
972 
973  filler.SetProgressReporter( progressReporter.get() );
974  filler.Fill( zones_to_refill );
975  }
976 
977  commit.Stage( s_PickedList );
978  commit.Push( _( "Modify zone properties" ) );
979  GetBoard()->GetConnectivity()->RecalculateRatsnest();
980 
981  s_PickedList.ClearItemsList(); // s_ItemsListPicker is no longer owner of picked items
982 
983  if( !IsGalCanvasActive() )
984  m_canvas->Refresh();
985 }
986 
987 
989 {
990  // Get contour in which the selected corner is
992 
993  // If the selected corner does not exist, abort
994  if( !aZone->Outline()->GetRelativeIndices( aZone->GetSelectedCorner(), &indices ) )
995  throw( std::out_of_range( "Zone selected corner does not exist" ) );
996 
997  EDA_RECT dirty = aZone->GetBoundingBox();
998 
999  // Remove current filling:
1000  aZone->UnFill();
1001 
1002  if( indices.m_contour == 0 ) // This is the main outline: remove all
1003  {
1004  SaveCopyInUndoList( aZone, UR_DELETED );
1005  GetBoard()->Remove( aZone );
1006  }
1007 
1008  else
1009  {
1010  SaveCopyInUndoList( aZone, UR_CHANGED );
1011  aZone->Outline()->RemoveContour( indices.m_contour, indices.m_polygon );
1012  }
1013 
1014  m_canvas->RefreshDrawingRect( dirty );
1015 
1016  OnModify();
1017 }
int TotalVertices() const
Returns total number of vertices stored in the set.
void MoveEdge(const wxPoint &offset, int aEdge)
Function MoveEdge Move the outline Edge.
Definition: class_zone.cpp:914
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset=ZeroOffset) override
Function Draw Draws the zone outline.
Definition: class_zone.cpp:289
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:59
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
Definition: class_board.h:559
bool IsFilled() const
Definition: class_zone.h:187
void SetCurItem(BOARD_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
Definition: pcb_screen.h:82
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType)
Adds a change of the item aItem of type aChangeType to the change list.
Definition: commit.cpp:46
void DrawWhileCreateOutline(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE draw_mode=GR_OR)
Function DrawWhileCreateOutline Draws the zone outline when it is created.
Definition: class_zone.cpp:543
#define OK_DRC
Definition: drc.h:39
#define IN_EDIT
Item currently edited.
Definition: base_struct.h:112
void Start_Move_Zone_Corner(wxDC *DC, ZONE_CONTAINER *zone_container, int corner_id, bool IsNewCorner)
Function Start_Move_Zone_Corner Prepares a move corner in a zone outline, called from a move corner c...
void Start_Move_Zone_Drag_Outline_Edge(wxDC *DC, ZONE_CONTAINER *zone_container, int corner_id)
Function Start_Move_Zone_Corner Prepares a drag edge in an existing zone outline,.
int GetNetCode() const
Function GetNetCode.
int InvokeKeepoutAreaEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeKeepoutAreaEditor invokes up a modal dialog window for copper zone editing.
bool End_Zone(wxDC *DC)
Function End_Zone terminates (if no DRC error ) the zone edge creation process.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:258
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:118
static bool s_CornerIsNew
int TestZoneToZoneOutline(ZONE_CONTAINER *aZone, bool aCreateMarkers)
Tests whether distance between zones complies with the DRC rules.
Definition: drc.cpp:226
This file is part of the common library.
void UpdateCopyOfZonesList(PICKED_ITEMS_LIST &aPickList, PICKED_ITEMS_LIST &aAuxiliaryList, BOARD *aPcb)
Function UpdateCopyOfZonesList Check a pick list to remove zones identical to their copies and set th...
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:516
void SetCornerSmoothingType(int aType)
bool OnAreaPolygonModified(PICKED_ITEMS_LIST *aModifiedZonesList, ZONE_CONTAINER *modified_area)
Function OnAreaPolygonModified Process an area that has been modified, by normalizing its polygon and...
static void Abort_Zone_Move_Corner_Or_Outlines(EDA_DRAW_PANEL *Panel, wxDC *DC)
Function Abort_Zone_Move_Corner_Or_Outlines cancels the Begin_Zone state if at least one EDGE_ZONE ha...
long m_ThermalReliefCopperBridge
thickness of the copper bridge in thermal reliefs
Definition: zone_settings.h:87
int GetSelectedCorner() const
Definition: class_zone.h:223
int InvokeNonCopperZonesEditor(PCB_BASE_FRAME *aParent, ZONE_SETTINGS *aSettings)
Function InvokeNonCopperZonesEditor invokes up a modal dialog window for non-copper zone editing.
Class BOARD to handle a board.
void DrawFilledArea(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset=ZeroOffset)
Function DrawDrawFilledArea Draws the filled area for this zone (polygon list .m_FilledPolysList)
Definition: class_zone.cpp:419
bool IsHighLightNetON() const
Function IsHighLightNetON.
Definition: class_board.h:383
bool IsMoving() const
Definition: base_struct.h:224
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:931
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:185
static bool s_AddCutoutToCurrentZone
ZONE_CONTAINER * m_CurrentZoneContour
zone contour currently in progress
Definition: class_board.h:261
void SetCurItem(BOARD_ITEM *aItem, bool aDisplayInfo=true)
Function SetCurItem sets the currently selected item and displays it in the MsgPanel.
void Start_Move_Zone_Outlines(wxDC *DC, ZONE_CONTAINER *zone_container)
Function Start_Move_Zone_Outlines Initialize parameters to move an existing zone outlines.
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:260
Struct VERTEX_INDEX.
Classes to handle copper zones.
virtual void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
void OnSelectTool(wxCommandEvent &aEvent)
Definition: edit.cpp:1383
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL
Definition: zones.h:39
#define ZONE_EXPORT_VALUES
Definition: zones.h:46
DRC * m_drc
the DRC controller, see drc.cpp
void Remove_Zone_Corner(wxDC *DC, ZONE_CONTAINER *zone_container)
Function End_Move_Zone_Corner_Or_Outlines Remove the currently selected corner in a zone outline the ...
virtual void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
unsigned GetCount() const
Function GetCount.
bool IsDragging() const
Definition: base_struct.h:225
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
wxPoint CalculateSegmentEndPoint(const wxPoint &aPosition, const wxPoint &aOrigin)
Determine end point for a segment direction 0, 90, or 45 degrees depending on it's position from the ...
Definition: editrack.cpp:800
bool IsNew() const
Definition: base_struct.h:222
static wxPoint s_CursorLastPosition
static PICKED_ITEMS_LIST s_AuxiliaryList
VECTOR2I & Vertex(int aIndex, int aOutline, int aHole)
Returns the index-th vertex in a given hole outline within a given outline
#define IS_NEW
New item, just created.
Definition: base_struct.h:114
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use.
Definition: draw_frame.h:924
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
virtual EDA_DRAW_FRAME * GetParent() const =0
int SaveCopyOfZones(PICKED_ITEMS_LIST &aPickList, BOARD *aPcb, int aNetCode, LAYER_NUM aLayer)
Function SaveCopyOfZones creates a copy of zones having a given netcode on a given layer,...
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:116
int m_NetcodeSelection
Net code selection for the current zone.
Definition: zone_settings.h:74
timestamp_t GetNewTimeStamp()
Definition: common.cpp:217
void SetProgressReporter(WX_PROGRESS_REPORTER *aReporter)
Definition: zone_filler.cpp:97
PCB_LAYER_ID
A quick note on layer IDs:
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:981
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:259
int Begin_Zone(wxDC *DC)
Function Begin_Zone either initializes the first segment of a new zone, or adds an intermediate segme...
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
PCB_GENERAL_SETTINGS & Settings()
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
int DrcOnCreatingZone(ZONE_CONTAINER *aArea, int aCornerIndex)
Function Drc tests the outline segment starting at CornerIndex and returns the result and displays th...
Definition: drc.cpp:379
const ZONE_SETTINGS & GetZoneSettings() const
static ZONE_CONTAINER * s_CurrentZone
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:292
void End_Move_Zone_Corner_Or_Outlines(wxDC *DC, ZONE_CONTAINER *zone_container)
Function End_Move_Zone_Corner_Or_Outlines Terminates a move corner in a zone outline,...
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
EDA_ITEM * GetPickedItem(unsigned int aIdx) const
Function GetPickedItem.
bool UnFill()
Function UnFill Removes the zone filling.
Definition: class_zone.cpp:166
int GetNumCorners(void) const
Access to m_Poly parameters.
Definition: class_zone.h:459
static void Abort_Zone_Create_Outline(EDA_DRAW_PANEL *Panel, wxDC *DC)
Function Abort_Zone_Create_Outline cancels the Begin_Zone command if at least one EDGE_ZONE was creat...
#define ZONE_CLEARANCE_MIL
Definition: zones.h:42
int m_ZoneClearance
Clearance value.
Definition: zone_settings.h:64
void HighLight(wxDC *DC)
Function HighLight.
Definition: highlight.cpp:104
#define ZONE_THERMAL_RELIEF_GAP_STRING_KEY
Definition: zones.h:32
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
void SetIsKeepout(bool aEnable)
const bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
static wxPoint s_CornerInitialPosition
bool Fill(const std::vector< ZONE_CONTAINER * > &aZones, bool aCheck=false)
static void Show_Zone_Corner_Or_Outline_While_Move_Mouse(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Redraws the zone outline when moving a corner according to the cursor position.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0)) override
Function SaveCopyInUndoList Creates a new entry in undo list of commands.
Definition: undo_redo.cpp:198
void ExportSetting(ZONE_CONTAINER &aTarget, bool aFullExport=true) const
Function ExportSetting copy settings to a given zone.
int RemoveNullSegments()
Function RemoveNullSegments looks for null segments; ie, segments whose ends are exactly the same and...
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1539
int Delete_LastCreatedCorner(wxDC *DC)
Function Delete_LastCreatedCorner Used only while creating a new zone outline Remove and delete the c...
bool GetRelativeIndices(int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const
Function GetRelativeIndices.
#define ZONE_THICKNESS_MIL
Definition: zones.h:40
void Add_Similar_Zone(wxDC *DC, ZONE_CONTAINER *zone_container)
Function Add_Similar_Zone Add a zone to a given zone outline.
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Adds a new hole to the given outline (default: last) and returns its index
void SetSelectedCorner(int aCorner)
Definition: class_zone.h:234
#define BAD_DRC
Definition: drc.h:40
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:651
void Add_Zone_Cutout(wxDC *DC, ZONE_CONTAINER *zone_container)
Function Add_Zone_Cutout Add a cutout zone to a given zone outline.
void Edit_Zone_Params(wxDC *DC, ZONE_CONTAINER *zone_container)
Function Edit_Zone_Params Edit params (layer, clearance, ...) for a zone outline.
Class ZONE_SETTINGS handles zones parameters.
Definition: zone_settings.h:49
void Move(const wxPoint &offset) override
Function Move Move the outlines.
Definition: class_zone.cpp:897
Definition: gr_basic.h:38
int GetHighLightNetCode() const
Function GetHighLightNetCode.
Definition: class_board.h:368
void SetHighLightNet(int aNetCode)
Function SetHighLightNet.
Definition: class_board.h:374
#define ZONE_MIN_THICKNESS_WIDTH_STRING_KEY
Definition: zones.h:35
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:128
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY
Definition: zones.h:33
void SetCornerPosition(int aCornerIndex, wxPoint new_pos)
Definition: class_zone.h:510
void duplicateZone(wxDC *aDC, ZONE_CONTAINER *aZone)
Function duplicateZone duplicates the given zone.
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
int GetNet() const
Function GetNet.
Definition: netinfo.h:227
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
void RedrawFilledAreas(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, PCB_LAYER_ID aLayer)
Function RedrawFilledAreas Redraw all filled areas on layer aLayer ( redraw all if aLayer < 0 )
Design Rule Checker object that performs all the DRC tests.
Definition: drc.h:188
static PICKED_ITEMS_LIST s_PickedList
void RemoveVertex(int aGlobalIndex)
Function RemoveVertex deletes the aGlobalIndex-th vertex.
size_t i
Definition: json11.cpp:597
void SetCornerRadius(int aRadius)
void SetIgnoreMouseEvents(bool aIgnore)
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
#define IU_PER_MILS
Definition: plotter.cpp:134
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
#define ZONE_CLEARANCE_WIDTH_STRING_KEY
Definition: zones.h:34
void ClearItemsList()
Function ClearItemsList deletes only the list of pickers, NOT the picked data itself.
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Executes the changes.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:260
int InvokeCopperZonesEditor(PCB_BASE_FRAME *aCaller, ZONE_SETTINGS *aSettings)
Function InvokeCopperZonesEditor invokes up a modal dialog window for copper zone editing.
virtual void Delete(BOARD_ITEM *aItem)
Removes an item from the containter and deletes it.
void InsertVertex(int aGlobalIndex, VECTOR2I aNewVertex)
Function InsertVertex Adds a vertex in the globally indexed position aGlobalIndex.
void Delete_Zone_Contour(wxDC *DC, ZONE_CONTAINER *zone_container)
Function Delete_Zone Remove the zone which include the segment aZone, or the zone which have the give...
bool AppendCorner(wxPoint aPosition, int aHoleIdx, bool aAllowDuplication=false)
Add a new corner to the zone outline (to the main outline or a hole)
void SetZoneSettings(const ZONE_SETTINGS &aSettings)
void RedrawAreasOutlines(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, PCB_LAYER_ID aLayer)
Function RedrawAreasOutlines Redraw all areas outlines on layer aLayer ( redraw all if aLayer < 0 )
#define ZONE_THERMAL_RELIEF_GAP_MIL
Definition: zones.h:38
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:952
BOARD * GetBoard() const
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
int GetAreaIndex(const ZONE_CONTAINER *aArea) const
Function GetAreaIndex returns the Area Index for the given Zone Container.
Definition: class_board.h:966
BOARD_ITEM * GetCurItem()
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:276
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:465
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:191
virtual void SetActiveLayer(PCB_LAYER_ID aLayer) override
Function SetActiveLayer will change the currently active layer to aLayer and also update the PCB_LAYE...
const VECTOR2I & GetCornerPosition(int aCornerIndex) const
Definition: class_zone.h:499
PCB_LAYER_ID m_CurrentZone_Layer
Layer used to create the current zone.
Definition: zone_settings.h:78
void Remove(BOARD_ITEM *aBoardItem) override
Removes an item from the container.
static void Show_New_Edge_While_Move_Mouse(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
void ClearListAndDeleteItems()
Function ClearListAndDeleteItems deletes the list of pickers, AND the data pointed by m_PickedItem or...
int GetToolId() const
Definition: draw_frame.h:524
long m_ThermalReliefGap
thickness of the gap in thermal reliefs
Definition: zone_settings.h:86
int m_ZoneMinThickness
Min thickness value in filled areas.
Definition: zone_settings.h:65
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:209
void RemoveAllContours(void)
Definition: class_zone.h:494
void RemoveContour(int aContourIdx, int aPolygonIdx=-1)
Function RemoveContour deletes the aContourIdx-th contour of the aPolygonIdx-th polygon in the set.
#define IS_MOVED
Item being moved.
Definition: base_struct.h:113