class_zone.h 22.7 KB
Newer Older
1

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

26 27 28 29
/**
 * @file class_zone.h
 * @brief Classes to handle copper zones
 */
30

Dick Hollenbeck's avatar
Dick Hollenbeck committed
31 32
#ifndef CLASS_ZONE_H_
#define CLASS_ZONE_H_
33

34

35
#include <vector>
36 37 38 39 40
#include <gr_basic.h>
#include <class_board_item.h>
#include <class_board_connected_item.h>
#include <layers_id_colors_and_visibility.h>
#include <PolyLine.h>
Dick Hollenbeck's avatar
Dick Hollenbeck committed
41
#include <class_zone_settings.h>
42

43

44
class EDA_RECT;
45
class LINE_READER;
46 47 48 49
class EDA_DRAW_PANEL;
class PCB_EDIT_FRAME;
class BOARD;
class ZONE_CONTAINER;
50 51
class MSG_PANEL_ITEM;

52

53 54 55 56 57
/**
 * Struct SEGMENT
 * is a simple container used when filling areas with segments
 */
struct SEGMENT
charras's avatar
charras committed
58 59 60
{
    wxPoint m_Start;        // starting point of a segment
    wxPoint m_End;          // ending point of a segment
61

charras's avatar
charras committed
62
    SEGMENT() {}
63

64
    SEGMENT( const wxPoint& aStart, const wxPoint& aEnd )
charras's avatar
charras committed
65 66 67 68
    {
        m_Start = aStart;
        m_End = aEnd;
    }
Dick Hollenbeck's avatar
Dick Hollenbeck committed
69
};
70

71

72 73 74 75 76
/**
 * Class ZONE_CONTAINER
 * handles a list of polygons defining a copper zone.
 * A zone is described by a main polygon, a time stamp, a layer, and a net name.
 * Other polygons inside the main polygon are holes in the zone.
77
 */
78
class ZONE_CONTAINER : public BOARD_CONNECTED_ITEM
79 80
{
public:
81

82
    ZONE_CONTAINER( BOARD* parent );
83 84 85

    ZONE_CONTAINER( const ZONE_CONTAINER& aZone );

86 87
    ~ZONE_CONTAINER();

88 89
    /**
     * Function GetPosition
charras's avatar
charras committed
90 91
     * @return a wxPoint, position of the first point of the outline
     */
Dick Hollenbeck's avatar
Dick Hollenbeck committed
92
    const wxPoint& GetPosition() const;             // was overload
93
    void SetPosition( const wxPoint& aPos )     {}  // was overload
94

95 96 97 98 99 100 101 102 103 104 105 106
    /**
     * Function SetPriority
     * @param aPriority = the priority level
     */
    void SetPriority( unsigned aPriority ) { m_priority = aPriority; }

    /**
     * Function GetPriority
     * @return the priority level of this zone
     */
    unsigned GetPriority() const { return m_priority; }

dickelbeck's avatar
dickelbeck committed
107
    /**
108
     * Function copy
109
     * copy useful data from the source.
110 111
     * flags and linked list pointers are NOT copied
     */
112
    void Copy( ZONE_CONTAINER* src );
113

114
    void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
115 116 117 118 119 120

    /**
     * Function Draw
     * Draws the zone outline.
     * @param panel = current Draw Panel
     * @param DC = current Device Context
dickelbeck's avatar
dickelbeck committed
121
     * @param aDrawMode = GR_OR, GR_XOR, GR_COPY ..
122
     * @param offset = Draw offset (usually wxPoint(0,0))
123
     */
124 125
    void Draw( EDA_DRAW_PANEL* panel,
               wxDC*           DC,
126
               GR_DRAWMODE     aDrawMode,
127
               const wxPoint&  offset = ZeroOffset );
128

129 130 131 132 133 134 135 136
    /**
     * Function DrawDrawFilledArea
     * Draws the filled  area for this zone (polygon list .m_FilledPolysList)
     * @param panel = current Draw Panel
     * @param DC = current Device Context
     * @param offset = Draw offset (usually wxPoint(0,0))
     * @param aDrawMode = GR_OR, GR_XOR, GR_COPY ..
     */
137 138
    void DrawFilledArea( EDA_DRAW_PANEL* panel,
                         wxDC*           DC,
139
                         GR_DRAWMODE     aDrawMode,
140
                         const wxPoint&  offset = ZeroOffset );
141 142 143

    /**
     * Function DrawWhileCreateOutline
144 145 146
     * Draws the zone outline when it is created.
     * The moving edges are in XOR graphic mode, old segment in draw_mode graphic mode
     * (usually GR_OR).  The closing edge has its own shape.
147 148 149 150
     * @param panel = current Draw Panel
     * @param DC = current Device Context
     * @param draw_mode = draw mode: OR, XOR ..
     */
151 152
    void DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC,
                                 GR_DRAWMODE draw_mode = GR_OR );
153

154
    /* Function GetBoundingBox
155
     * @return an EDA_RECT that is the bounding box of the zone outline
156
     */
157
    EDA_RECT GetBoundingBox() const;
158

159 160
    int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const;

161
    /**
162
     * Function TestForCopperIslandAndRemoveInsulatedIslands
163
     * Remove insulated copper islands found in m_FilledPolysList.
164
     * @param aPcb = the board to analyze
165
     */
166
    void TestForCopperIslandAndRemoveInsulatedIslands( BOARD* aPcb );
167

168 169
    /**
     * Function CalculateSubAreaBoundaryBox
170
     * Calculates the bounding box of a a filled area ( list of CPolyPt )
171 172
     * use m_FilledPolysList as list of CPolyPt (that are the corners of one or more
     * polygons or filled areas )
173
     * @return an EDA_RECT as bounding box
174 175
     * @param aIndexStart = index of the first corner of a polygon (filled area)
     *                      in m_FilledPolysList
176 177
     * @param aIndexEnd = index of the last corner of a polygon in m_FilledPolysList
     */
178
    EDA_RECT CalculateSubAreaBoundaryBox( int aIndexStart, int aIndexEnd );
179

180 181 182 183
    /**
     * Function IsOnCopperLayer
     * @return true if this zone is on a copper layer, false if on a technical layer
     */
184
    bool IsOnCopperLayer( void ) const
185
    {
186
        return ( GetLayer() < FIRST_NON_COPPER_LAYER ) ? true : false;
187
    }
188

189
    /**
190 191
     * Function SetNet
     * sets the netcode and the netname.
192 193 194 195 196 197
     *
     * @param aNetCode The net code of the zone container if greater than or equal to
     *                 zero.  Otherwise the current net code is kept and set the net
     *                 code error flag.
     */
    virtual void SetNet( int aNetCode );
198

199 200
    /**
     * Function SetNetNameFromNetCode
201
     * Find the net name corresponding to the net code.
202 203
     * @return bool - true if net found, else false
     */
charras's avatar
charras committed
204
    bool SetNetNameFromNetCode( void );
205

206 207 208
    /**
     * Function GetNetName
     * returns the net name.
Dick Hollenbeck's avatar
Dick Hollenbeck committed
209
     * @return const wxString& - The net name.
210
     */
211 212
    const wxString& GetNetName() const                  { return m_Netname; };
    void SetNetName( const wxString& aName )            { m_Netname = aName; }
213

214
    /// How to fill areas: 0 = use filled polygons, 1 => fill with segments.
215 216
    void SetFillMode( int aFillMode )                   { m_FillMode = aFillMode; }
    int GetFillMode() const                             { return m_FillMode; }
217

218
    void SetThermalReliefGap( int aThermalReliefGap )   { m_ThermalReliefGap = aThermalReliefGap; }
219
    int GetThermalReliefGap( D_PAD* aPad = NULL ) const;
220

221 222 223 224
    void SetThermalReliefCopperBridge( int aThermalReliefCopperBridge )
    {
        m_ThermalReliefCopperBridge = aThermalReliefCopperBridge;
    }
225
    int GetThermalReliefCopperBridge( D_PAD* aPad = NULL ) const;
226

227 228
    void SetArcSegmentCount( int aArcSegCount ) { m_ArcToSegmentsCount = aArcSegCount; }
    int GetArcSegmentCount() const { return m_ArcToSegmentsCount; }
229 230 231 232 233 234 235

    bool IsFilled() const { return m_IsFilled; }
    void SetIsFilled( bool isFilled ) { m_IsFilled = isFilled; }

    int GetZoneClearance() const { return m_ZoneClearance; }
    void SetZoneClearance( int aZoneClearance ) { m_ZoneClearance = aZoneClearance; }

236 237
    ZoneConnection GetPadConnection( D_PAD* aPad = NULL ) const;
    void SetPadConnection( ZoneConnection aPadConnection ) { m_PadConnection = aPadConnection; }
238 239 240

    int GetMinThickness() const { return m_ZoneMinThickness; }
    void SetMinThickness( int aMinThickness ) { m_ZoneMinThickness = aMinThickness; }
241

242 243 244
    int GetSelectedCorner() const { return m_CornerSelection; }
    void SetSelectedCorner( int aCorner ) { m_CornerSelection = aCorner; }

245 246
    int GetLocalFlags() const { return m_localFlgs; }
    void SetLocalFlags( int aFlags ) { m_localFlgs = aFlags; }
247 248 249 250 251 252 253 254 255

    std::vector <SEGMENT>& FillSegments() { return m_FillSegmList; }
    const std::vector <SEGMENT>& FillSegments() const { return m_FillSegmList; }

    CPolyLine* Outline() { return m_Poly; }
    const CPolyLine* Outline() const { return const_cast< CPolyLine* >( m_Poly ); }

    void SetOutline( CPolyLine* aOutline ) { m_Poly = aOutline; }

256
    virtual bool HitTest( const wxPoint& aPosition );
257

258 259 260 261 262 263
    /**
     * Function HitTestFilledArea
     * tests if the given wxPoint is within the bounds of a filled area of this zone.
     * @param aRefPos A wxPoint to test
     * @return bool - true if a hit, else false
     */
264
    bool HitTestFilledArea( const wxPoint& aRefPos ) const;
265

266 267 268 269 270 271 272 273 274 275 276
     /**
     * Function TransformSolidAreasShapesToPolygonSet
     * Convert solid areas full shapes to polygon set
     * (the full shape is the polygon area with a thick outline)
     * Used in 3D view
     * Arcs (ends of segments) are approximated by segments
     * @param aCornerBuffer = a buffer to store the polygons
     * @param aCircleToSegmentsCount = the number of segments to approximate a circle
     * @param aCorrectionFactor = the correction to apply to arcs radius to roughly
     * keep arc radius when approximated by segments
     */
277
    void TransformSolidAreasShapesToPolygonSet( CPOLYGONS_LIST& aCornerBuffer,
278 279
                                                int                    aCircleToSegmentsCount,
                                                double                 aCorrectionFactor );
280
    /**
281 282 283 284
     * Function BuildFilledSolidAreasPolygons
     * Build the filled solid areas data from real outlines (stored in m_Poly)
     * The solid areas can be more thna one on copper layers, and do not have holes
      ( holes are linked by overlapping segments to the main outline)
285
     * in order to have drawable (and plottable) filled polygons
286
     * @param aPcb: the current board (can be NULL for non copper zones)
287 288 289 290 291 292 293 294 295 296 297 298
     * @param aCornerBuffer: A reference to a buffer to store polygon corners, or NULL
     * if NULL (default:
     * - m_FilledPolysList is used to store solid areas polygons.
     * - on copper layers, tracks and other items shapes of other nets are
     * removed from solid areas
     * if not null:
     * Only the zone outline (with holes, if any) are stored in aCornerBuffer
     * with holes linked. Therfore only one polygon is created
     * @return true if OK, false if the solid areas cannot be calculated
     * This function calls AddClearanceAreasPolygonsToPolysList()
     * to add holes for pads and tracks and other items not in net.
     */
299
    bool BuildFilledSolidAreasPolygons( BOARD* aPcb, CPOLYGONS_LIST* aCornerBuffer = NULL );
300

301 302 303 304 305 306 307 308 309 310 311 312 313
    /**
     * Function CopyPolygonsFromKiPolygonListToFilledPolysList
     * Copy polygons stored in aKiPolyList to m_FilledPolysList
     * The previous m_FilledPolysList contents is replaced.
     * @param aKiPolyList = a KI_POLYGON_SET containing polygons.
     */
    void CopyPolygonsFromKiPolygonListToFilledPolysList( KI_POLYGON_SET& aKiPolyList );

    /**
     * Function CopyPolygonsFromFilledPolysListToKiPolygonList
     * Copy polygons from m_FilledPolysList to aKiPolyList
     * @param aKiPolyList = a KI_POLYGON_SET to fill by polygons.
     */
314
    void CopyPolygonsFromFilledPolysListToKiPolygonList( KI_POLYGON_SET& aKiPolyList );
315

316 317
    /**
     * Function AddClearanceAreasPolygonsToPolysList
318
     * Add non copper areas polygons (pads and tracks with clearance)
319
     * to a filled copper area
320
     * used in BuildFilledSolidAreasPolygons when calculating filled areas in a zone
321 322
     * Non copper areas are pads and track and their clearance area
     * The filled copper area must be computed before
323
     * BuildFilledSolidAreasPolygons() call this function just after creating the
324
     *  filled copper area polygon (without clearance areas
325 326
     * @param aPcb: the current board
     */
327
    void AddClearanceAreasPolygonsToPolysList( BOARD* aPcb );
charras's avatar
charras committed
328

329 330 331 332 333 334 335 336 337 338 339 340 341

     /**
     * Function TransformOutlinesShapeWithClearanceToPolygon
     * Convert the outlines shape to a polygon with no holes
     * inflated (optional) by max( aClearanceValue, the zone clearance)
     * (holes are linked to external outline by overlapping segments)
     * Used in filling zones calculations
     * Circles (vias) and arcs (ends of tracks) are approximated by segments
     * @param aCornerBuffer = a buffer to store the polygon
     * @param aClearanceValue = the clearance around the pad
     * @param aAddClearance = true to add a clearance area to the polygon
     *                      false to create the outline polygon.
     */
342
    void TransformOutlinesShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
343 344
                                               int                    aClearanceValue,
                                               bool                   aAddClearance );
charras's avatar
charras committed
345
    /**
346
     * Function HitTestForCorner
347
     * tests if the given wxPoint near a corner
348 349
     * Set m_CornerSelection to -1 if nothing found, or index of corner
     * @return true if found
350
     * @param refPos : A wxPoint to test
351
     */
352
    bool HitTestForCorner( const wxPoint& refPos );
353 354 355

    /**
     * Function HitTestForEdge
356 357 358
     * tests if the given wxPoint is near a segment defined by 2 corners.
     * Set m_CornerSelection to -1 if nothing found, or index of the starting corner of vertice
     * @return true if found
359
     * @param refPos : A wxPoint to test
360
     */
361
    bool HitTestForEdge( const wxPoint& refPos );
362

363
    virtual bool HitTest( const EDA_RECT& aRect ) const;
364

365
    /**
366
     * Function Fill_Zone
367 368 369 370 371 372 373 374 375
     * Calculate the zone filling
     * The zone outline is a frontier, and can be complex (with holes)
     * The filling starts from starting points like pads, tracks.
     * If exists the old filling is removed
     * @param frame = reference to the main frame
     * @param DC = current Device Context
     * @param verbose = true to show error messages
     * @return error level (0 = no error)
     */
376
    int Fill_Zone( PCB_EDIT_FRAME* frame, wxDC* DC, bool verbose = true );
377

378
    /**
379
     * Function FillZoneAreasWithSegments
380 381 382 383 384 385
     *  Fill sub areas in a zone with segments with m_ZoneMinThickness width
     * A scan is made line per line, on the whole filled areas, with a step of m_ZoneMinThickness.
     * all intersecting points with the horizontal infinite line and polygons to fill are calculated
     * a list of SEGZONE items is built, line per line
     * @return number of segments created
     */
386
    int FillZoneAreasWithSegments();
387

388 389 390 391 392 393
    /**
     * Function UnFill
     * Removes the zone filling
     * @return true if a previous filling is removed, false if no change
     * (when no filling found)
     */
394
    bool UnFill();
395

396 397 398 399 400 401 402
    /* Geometric transformations: */

    /**
     * Function Move
     * Move the outlines
     * @param offset = moving vector
     */
403
    void Move( const wxPoint& offset );
404 405

    /**
406 407 408 409
     * Function MoveEdge
     * Move the outline Edge. m_CornerSelection is the start point of the outline edge
     * @param offset = moving vector
     */
410
    void MoveEdge( const wxPoint& offset );
411 412 413

    /**
     * Function Rotate
414 415 416 417
     * Move the outlines
     * @param centre = rot centre
     * @param angle = in 0.1 degree
     */
Dick Hollenbeck's avatar
Dick Hollenbeck committed
418
    void Rotate( const wxPoint& centre, double angle );
419

420 421 422 423
    /**
     * Function Flip
     * Flip this object, i.e. change the board side for this object
     * (like Mirror() but changes layer)
424
     * @param aCentre - the rotation point.
425
     */
charras's avatar
charras committed
426
    virtual void Flip( const wxPoint& aCentre );
427

428 429 430 431 432 433
    /**
     * Function Mirror
     * Mirror the outlines , relative to a given horizontal axis
     * the layer is not changed
     * @param mirror_ref = vertical axis position
     */
434
    void Mirror( const wxPoint& mirror_ref );
dickelbeck's avatar
dickelbeck committed
435

436 437 438 439 440 441 442 443 444
    /**
     * Function GetClass
     * returns the class name.
     * @return wxString
     */
    wxString GetClass() const
    {
        return wxT( "ZONE_CONTAINER" );
    }
dickelbeck's avatar
dickelbeck committed
445

446
    /** Access to m_Poly parameters
447
     */
dickelbeck's avatar
dickelbeck committed
448

Dick Hollenbeck's avatar
Dick Hollenbeck committed
449

450
    int GetNumCorners( void ) const
dickelbeck's avatar
dickelbeck committed
451
    {
452
        return m_Poly->GetCornersCount();
dickelbeck's avatar
dickelbeck committed
453 454
    }

455
    void RemoveAllContours( void )
dickelbeck's avatar
dickelbeck committed
456 457 458 459
    {
        m_Poly->RemoveAllContours();
    }

Dick Hollenbeck's avatar
Dick Hollenbeck committed
460
    const wxPoint& GetCornerPosition( int aCornerIndex ) const
dickelbeck's avatar
dickelbeck committed
461
    {
Dick Hollenbeck's avatar
Dick Hollenbeck committed
462
        return m_Poly->GetPos( aCornerIndex );
dickelbeck's avatar
dickelbeck committed
463 464
    }

465
    void SetCornerPosition( int aCornerIndex, wxPoint new_pos )
dickelbeck's avatar
dickelbeck committed
466
    {
467 468
        m_Poly->SetX( aCornerIndex, new_pos.x );
        m_Poly->SetY( aCornerIndex, new_pos.y );
dickelbeck's avatar
dickelbeck committed
469 470 471 472 473 474
    }

    void AppendCorner( wxPoint position )
    {
        m_Poly->AppendCorner( position.x, position.y );
    }
475 476 477 478 479

    int GetHatchStyle() const
    {
        return m_Poly->GetHatchStyle();
    }
480

481
    void SetHatchStyle( CPolyLine::HATCH_STYLE aStyle )
482 483 484 485
    {
        m_Poly->SetHatchStyle( aStyle );
    }

486
    /**
487
     * Function IsSame
488
     * tests if 2 zones are equivalent:
489
     * 2 zones are equivalent if they have same parameters and same outlines
490
     * info, filling is not taken into account
491 492
     * @param aZoneToCompare = zone to compare with "this"
     */
493
    bool IsSame( const ZONE_CONTAINER &aZoneToCompare );
494

495 496 497 498 499 500
   /**
     * Function ClearFilledPolysList
     * clears the list of filled polygons.
     */
    void ClearFilledPolysList()
    {
501
        m_FilledPolysList.RemoveAllContours();
502 503 504 505 506 507 508
    }

   /**
     * Function GetFilledPolysList
     * returns a reference to the list of filled polygons.
     * @return Reference to the list of filled polygons.
     */
509
    const CPOLYGONS_LIST& GetFilledPolysList() const
510 511 512 513 514 515 516 517
    {
        return m_FilledPolysList;
    }

   /**
     * Function AddFilledPolysList
     * sets the list of filled polygons.
     */
518
    void AddFilledPolysList( CPOLYGONS_LIST& aPolysList )
519 520 521 522
    {
        m_FilledPolysList = aPolysList;
    }

523 524 525 526 527 528 529 530
    /**
     * Function GetSmoothedPoly
     * returns a pointer to the corner-smoothed version of
     * m_Poly if it exists, otherwise it returns m_Poly.
     * @return CPolyLine* - pointer to the polygon.
     */
    CPolyLine* GetSmoothedPoly() const
    {
531 532
        if( m_smoothedPoly )
            return m_smoothedPoly;
533 534 535 536
        else
            return m_Poly;
    };

537
    void SetCornerSmoothingType( int aType ) { m_cornerSmoothingType = aType; };
538

539
    int  GetCornerSmoothingType() const { return m_cornerSmoothingType; };
540 541 542

    void SetCornerRadius( unsigned int aRadius )
    {
543 544 545
        m_cornerRadius = aRadius;
        if( m_cornerRadius > (unsigned int) Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS ) )
            m_cornerRadius = Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS );
546 547
    };

548
    unsigned int GetCornerRadius() const { return m_cornerRadius; };
549

550 551
    void AddPolygon( std::vector< wxPoint >& aPolygon );

552
    void AddFilledPolygon( CPOLYGONS_LIST& aPolygon )
553
    {
554
        m_FilledPolysList.Append( aPolygon );
555 556 557 558 559 560 561
    }

    void AddFillSegments( std::vector< SEGMENT >& aSegments )
    {
        m_FillSegmList.insert( m_FillSegmList.end(), aSegments.begin(), aSegments.end() );
    }

562 563
    virtual wxString GetSelectMenuText() const;

564
    virtual BITMAP_DEF GetMenuImage() const { return  add_zone_xpm; }
565

566 567
    virtual EDA_ITEM* Clone() const;

568 569 570 571
    /**
     * Accessors to parameters used in Keepout zones:
     */
    bool GetIsKeepout() const { return m_isKeepout; }
572
    bool GetDoNotAllowCopperPour() const { return m_doNotAllowCopperPour; }
573 574 575 576
    bool GetDoNotAllowVias() const { return m_doNotAllowVias; }
    bool GetDoNotAllowTracks() const { return m_doNotAllowTracks; }

    void SetIsKeepout( bool aEnable ) { m_isKeepout = aEnable; }
577
    void SetDoNotAllowCopperPour( bool aEnable ) { m_doNotAllowCopperPour = aEnable; }
578 579 580 581
    void SetDoNotAllowVias( bool aEnable ) { m_doNotAllowVias = aEnable; }
    void SetDoNotAllowTracks( bool aEnable ) { m_doNotAllowTracks = aEnable; }


582
#if defined(DEBUG)
583
    virtual void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); }    // override
584
#endif
585 586 587


private:
588 589 590
    CPolyLine*            m_Poly;                ///< Outline of the zone.
    wxString              m_Netname;             ///< Name of the net assigned to the zone.
    CPolyLine*            m_smoothedPoly;        // Corner-smoothed version of m_Poly
591 592 593 594 595 596 597
    int                   m_cornerSmoothingType;
    unsigned int          m_cornerRadius;

    /* Priority: when a zone outline is inside and other zone, if its priority is higher
     * the other zone priority, it will be created inside.
     * if priorities are equal, a DRC error is set
     */
598
    unsigned              m_priority;
599 600 601 602 603 604 605 606 607

    /* A zone outline can be a keepout zone.
     * It will be never filled, and DRC should test for pads, tracks and vias
     */
    bool                  m_isKeepout;

    /* For keepout zones only:
     * what is not allowed inside the keepout ( pads, tracks and vias )
     */
608
    bool                  m_doNotAllowCopperPour;
609 610 611
    bool                  m_doNotAllowVias;
    bool                  m_doNotAllowTracks;

612
    ZoneConnection        m_PadConnection;
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631
    int                   m_ZoneClearance;           ///< Clearance value in internal units.
    int                   m_ZoneMinThickness;        ///< Minimum thickness value in filled areas.

    /** The number of segments to convert a circle to a polygon.  Valid values are
        #ARC_APPROX_SEGMENTS_COUNT_LOW_DEF or #ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF. */
    int                   m_ArcToSegmentsCount;

    /** True when a zone was filled, false after deleting the filled areas. */
    bool                  m_IsFilled;

    ///< Width of the gap in thermal reliefs.
    int                   m_ThermalReliefGap;

    ///< Width of the copper bridge in thermal reliefs.
    int                   m_ThermalReliefCopperBridge;


    /// How to fill areas: 0 => use filled polygons, 1 => fill with segments.
    int                   m_FillMode;
632

633 634 635
    /// The index of the corner being moved or -1 if no corner is selected.
    int                   m_CornerSelection;

636
    int                   m_localFlgs;                ///< Flags used in polygon calculations.
637 638 639 640 641 642 643


    /** Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
     *  In this case the segments have #m_ZoneMinThickness width.
     */
    std::vector <SEGMENT> m_FillSegmList;

644 645
    /* set of filled polygons used to draw a zone as a filled area.
     * from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole
646
     * (they are all in one piece)  In very simple cases m_FilledPolysList is same
647
     * as m_Poly.  In less simple cases (when m_Poly has holes) m_FilledPolysList is
648 649 650



651 652 653 654
     * a polygon equivalent to m_Poly, without holes but with extra outline segment
     * connecting "holes" with external main outline.  In complex cases an outline
     * described by m_Poly can have many filled areas
     */
655
    CPOLYGONS_LIST m_FilledPolysList;
656 657
};

658

Dick Hollenbeck's avatar
Dick Hollenbeck committed
659
#endif  // CLASS_ZONE_H_