2012-01-14 19:50:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-01-24 13:22:43 +00:00
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wandadoo.fr
|
|
|
|
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-01-14 19:50:32 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2011-09-20 13:57:40 +00:00
|
|
|
/**
|
|
|
|
* @file class_board_item.h
|
|
|
|
* @brief Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
|
|
|
|
*/
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
#ifndef BOARD_ITEM_STRUCT_H
|
|
|
|
#define BOARD_ITEM_STRUCT_H
|
|
|
|
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <base_struct.h>
|
2020-09-02 01:09:34 +00:00
|
|
|
#include <common.h>
|
2019-05-14 12:39:34 +00:00
|
|
|
#include <convert_to_biu.h>
|
2012-09-01 13:38:27 +00:00
|
|
|
#include <gr_basic.h>
|
2013-03-30 17:24:04 +00:00
|
|
|
#include <layers_id_colors_and_visibility.h>
|
2008-11-18 18:13:55 +00:00
|
|
|
|
2012-04-12 21:31:31 +00:00
|
|
|
|
2011-09-20 13:57:40 +00:00
|
|
|
class BOARD;
|
2016-12-13 16:24:19 +00:00
|
|
|
class BOARD_ITEM_CONTAINER;
|
2017-11-29 18:51:01 +00:00
|
|
|
class SHAPE_POLY_SET;
|
2019-05-31 12:15:25 +00:00
|
|
|
class PCB_BASE_FRAME;
|
2020-07-15 16:23:36 +00:00
|
|
|
class SHAPE;
|
2020-09-24 01:05:46 +00:00
|
|
|
class PCB_GROUP;
|
2011-09-20 13:57:40 +00:00
|
|
|
|
2011-12-01 22:50:41 +00:00
|
|
|
/**
|
2020-10-04 14:19:33 +00:00
|
|
|
* Enum PCB_SHAPE_TYPE_T
|
|
|
|
* is the set of shapes for PCB graphics and tracks and footprint graphics
|
2011-12-01 22:50:41 +00:00
|
|
|
* in the .m_Shape member
|
|
|
|
*/
|
2020-10-04 14:19:33 +00:00
|
|
|
enum PCB_SHAPE_TYPE_T
|
2011-12-01 22:50:41 +00:00
|
|
|
{
|
|
|
|
S_SEGMENT = 0, ///< usual segment : line with rounded ends
|
|
|
|
S_RECT, ///< segment with non rounded ends
|
|
|
|
S_ARC, ///< Arcs (with rounded ends)
|
|
|
|
S_CIRCLE, ///< ring
|
|
|
|
S_POLYGON, ///< polygon (not yet used for tracks, but could be in microwave apps)
|
|
|
|
S_CURVE, ///< Bezier Curve
|
|
|
|
S_LAST ///< last value for this list
|
2008-05-05 19:56:06 +00:00
|
|
|
};
|
|
|
|
|
2020-10-04 14:19:33 +00:00
|
|
|
static inline wxString PCB_SHAPE_TYPE_T_asString( PCB_SHAPE_TYPE_T a )
|
2020-06-30 12:41:59 +00:00
|
|
|
{
|
|
|
|
switch( a )
|
|
|
|
{
|
|
|
|
case S_SEGMENT: return "S_SEGMENT";
|
|
|
|
case S_RECT: return "S_RECT";
|
|
|
|
case S_ARC: return "S_ARC";
|
|
|
|
case S_CIRCLE: return "S_CIRCLE";
|
|
|
|
case S_POLYGON: return "S_POLYGON";
|
|
|
|
case S_CURVE: return "S_CURVE";
|
|
|
|
case S_LAST: return "S_LAST"; // Synthetic value, but if we come across it we're
|
|
|
|
// going to want to know.
|
|
|
|
}
|
2020-06-30 18:15:11 +00:00
|
|
|
|
|
|
|
return wxEmptyString; // Just to quiet GCC.
|
2020-06-30 12:41:59 +00:00
|
|
|
};
|
|
|
|
|
2008-05-05 19:56:06 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
/**
|
2020-01-10 14:31:00 +00:00
|
|
|
* BOARD_ITEM
|
2008-04-14 19:22:48 +00:00
|
|
|
* is a base class for any item which can be embedded within the BOARD
|
|
|
|
* container class, and therefore instances of derived classes should only be
|
2011-09-30 18:15:37 +00:00
|
|
|
* found in Pcbnew or other programs that use class BOARD and its contents.
|
|
|
|
* The corresponding class in Eeschema is SCH_ITEM.
|
2008-04-14 19:22:48 +00:00
|
|
|
*/
|
2010-12-08 20:12:46 +00:00
|
|
|
class BOARD_ITEM : public EDA_ITEM
|
2008-04-14 19:22:48 +00:00
|
|
|
{
|
|
|
|
protected:
|
2017-03-13 03:19:33 +00:00
|
|
|
PCB_LAYER_ID m_Layer;
|
2020-09-25 17:37:03 +00:00
|
|
|
PCB_GROUP* m_group;
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
public:
|
2020-09-25 17:37:03 +00:00
|
|
|
BOARD_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
|
|
|
|
EDA_ITEM( aParent, idtype ),
|
|
|
|
m_Layer( F_Cu ),
|
|
|
|
m_group( nullptr )
|
2008-04-14 19:22:48 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-09-25 17:37:03 +00:00
|
|
|
void SetParentGroup( PCB_GROUP* aGroup ) { m_group = aGroup; }
|
|
|
|
PCB_GROUP* GetParentGroup() const { return m_group; }
|
2020-09-02 01:09:34 +00:00
|
|
|
|
2016-05-31 08:27:52 +00:00
|
|
|
// Do not create a copy constructor & operator=.
|
|
|
|
// The ones generated by the compiler are adequate.
|
2020-02-02 18:40:14 +00:00
|
|
|
int GetX() const
|
|
|
|
{
|
|
|
|
wxPoint p = GetPosition();
|
|
|
|
return p.x;
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetY() const
|
|
|
|
{
|
|
|
|
wxPoint p = GetPosition();
|
|
|
|
return p.y;
|
|
|
|
}
|
|
|
|
|
2015-02-12 03:22:24 +00:00
|
|
|
/**
|
|
|
|
* Function GetCenter()
|
|
|
|
*
|
2020-10-06 16:38:24 +00:00
|
|
|
* This defaults to the center of the bounding box if not overridden.
|
2015-02-12 03:22:24 +00:00
|
|
|
*
|
|
|
|
* @return centre point of the item
|
|
|
|
*/
|
2020-10-06 16:38:24 +00:00
|
|
|
virtual wxPoint GetCenter() const
|
|
|
|
{
|
|
|
|
return GetBoundingBox().GetCenter();
|
|
|
|
}
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2020-02-02 18:40:14 +00:00
|
|
|
void SetX( int aX )
|
|
|
|
{
|
|
|
|
wxPoint p( aX, GetY() );
|
|
|
|
SetPosition( p );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetY( int aY )
|
|
|
|
{
|
|
|
|
wxPoint p( GetX(), aY );
|
|
|
|
SetPosition( p );
|
|
|
|
}
|
|
|
|
|
2014-01-28 15:23:08 +00:00
|
|
|
/**
|
|
|
|
* Function IsConnected()
|
|
|
|
* Returns information if the object is derived from BOARD_CONNECTED_ITEM.
|
|
|
|
* @return True if the object is of BOARD_CONNECTED_ITEM type, false otherwise.
|
|
|
|
*/
|
|
|
|
virtual bool IsConnected() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-07-25 11:08:41 +00:00
|
|
|
/**
|
|
|
|
* @return true if the object is on any copper layer, false otherwise.
|
|
|
|
*/
|
|
|
|
virtual bool IsOnCopperLayer() const
|
|
|
|
{
|
|
|
|
return IsCopperLayer( GetLayer() );
|
|
|
|
}
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
/**
|
|
|
|
* A value of wxPoint(0,0) which can be passed to the Draw() functions.
|
|
|
|
*/
|
2011-08-01 15:29:27 +00:00
|
|
|
static wxPoint ZeroOffset;
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2020-07-22 23:05:22 +00:00
|
|
|
/**
|
|
|
|
* Function GetEffectiveShape
|
|
|
|
* Some pad shapes can be complex (rounded/chamfered rectangle), even without considering
|
2020-09-02 01:09:34 +00:00
|
|
|
* custom shapes. This routine returns a COMPOUND shape (set of simple shapes which make
|
2020-07-22 23:05:22 +00:00
|
|
|
* up the pad fod use with routing, collision determiniation, etc).
|
|
|
|
*
|
|
|
|
* Note that this list can contain a SHAPE_SIMPLE (a simple single-outline non-intersecting
|
|
|
|
* polygon), but should never contain a SHAPE_POLY_SET (a complex polygon consisting of
|
|
|
|
* multiple outlines and/or holes).
|
2020-09-02 01:09:34 +00:00
|
|
|
*
|
2020-07-22 23:05:22 +00:00
|
|
|
* @param aLayer in case of items spanning multiple layers, only the shapes belonging to aLayer
|
|
|
|
* will be returned. Pass UNDEFINED_LAYER to return shapes for all layers.
|
|
|
|
*/
|
|
|
|
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const;
|
2020-07-15 16:23:36 +00:00
|
|
|
|
2016-12-13 16:24:19 +00:00
|
|
|
BOARD_ITEM_CONTAINER* GetParent() const { return (BOARD_ITEM_CONTAINER*) m_Parent; }
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetLayer
|
2015-06-04 12:54:07 +00:00
|
|
|
* returns the primary layer this item is on.
|
2008-04-14 19:22:48 +00:00
|
|
|
*/
|
2017-09-29 09:40:10 +00:00
|
|
|
virtual PCB_LAYER_ID GetLayer() const { return m_Layer; }
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2015-06-04 12:54:07 +00:00
|
|
|
/**
|
|
|
|
* Function GetLayerSet
|
2020-08-09 11:22:09 +00:00
|
|
|
* returns a std::bitset of all layers on which the item physically resides.
|
2015-06-04 12:54:07 +00:00
|
|
|
*/
|
|
|
|
virtual LSET GetLayerSet() const { return LSET( m_Layer ); }
|
2020-08-09 11:22:09 +00:00
|
|
|
virtual void SetLayerSet( LSET aLayers )
|
|
|
|
{
|
|
|
|
wxFAIL_MSG( "Attempted to SetLayerSet() on a single-layer object." );
|
|
|
|
|
|
|
|
// Derived classes which support multiple layers must implement this
|
|
|
|
}
|
2015-06-04 12:54:07 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
/**
|
|
|
|
* Function SetLayer
|
|
|
|
* sets the layer this item is on.
|
|
|
|
* @param aLayer The layer number.
|
2010-04-23 09:54:40 +00:00
|
|
|
* is virtual because some items (in fact: class DIMENSION)
|
2011-08-01 15:29:27 +00:00
|
|
|
* have a slightly different initialization
|
2008-04-14 19:22:48 +00:00
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
virtual void SetLayer( PCB_LAYER_ID aLayer )
|
2013-11-04 02:09:28 +00:00
|
|
|
{
|
|
|
|
m_Layer = aLayer;
|
|
|
|
}
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2020-02-20 12:11:04 +00:00
|
|
|
/**
|
|
|
|
* Function Duplicate
|
|
|
|
* creates a copy of a BOARD_ITEM.
|
|
|
|
*/
|
2020-08-10 13:22:02 +00:00
|
|
|
virtual BOARD_ITEM* Duplicate() const
|
2020-02-20 12:11:04 +00:00
|
|
|
{
|
|
|
|
EDA_ITEM* dupe = Clone();
|
2020-02-21 22:20:42 +00:00
|
|
|
const_cast<KIID&>( dupe->m_Uuid ) = KIID();
|
2020-02-20 12:11:04 +00:00
|
|
|
|
|
|
|
return static_cast<BOARD_ITEM*>( dupe );
|
|
|
|
}
|
|
|
|
|
2013-11-20 17:26:47 +00:00
|
|
|
/**
|
|
|
|
* Swap data between aItem and aImage.
|
|
|
|
* aItem and aImage should have the same type
|
|
|
|
* Used in undo redo command to swap values between an item and its copy
|
2020-01-04 23:05:57 +00:00
|
|
|
* Only values like layer, size .. which are modified by editing are swapped
|
2013-11-20 17:26:47 +00:00
|
|
|
* @param aImage = the item image which contains data to swap
|
|
|
|
*/
|
2017-10-31 13:59:03 +00:00
|
|
|
virtual void SwapData( BOARD_ITEM* aImage );
|
2013-11-20 17:26:47 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
/**
|
|
|
|
* Function IsOnLayer
|
|
|
|
* tests to see if this object is on the given layer. Is virtual so
|
|
|
|
* objects like D_PAD, which reside on multiple layers can do their own
|
|
|
|
* form of testing.
|
|
|
|
* @param aLayer The layer to test for.
|
|
|
|
* @return bool - true if on given layer, else false.
|
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
virtual bool IsOnLayer( PCB_LAYER_ID aLayer ) const
|
2008-04-14 19:22:48 +00:00
|
|
|
{
|
|
|
|
return m_Layer == aLayer;
|
|
|
|
}
|
|
|
|
|
2010-11-24 15:10:33 +00:00
|
|
|
/**
|
|
|
|
* Function IsTrack
|
|
|
|
* tests to see if this object is a track or via (or microvia).
|
|
|
|
* form of testing.
|
|
|
|
* @return bool - true if a track or via, else false.
|
|
|
|
*/
|
2011-08-01 15:29:27 +00:00
|
|
|
bool IsTrack() const
|
2010-11-24 15:10:33 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
|
2010-11-24 15:10:33 +00:00
|
|
|
}
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function IsLocked
|
|
|
|
* @return bool - true if the object is locked, else false
|
|
|
|
*/
|
|
|
|
virtual bool IsLocked() const
|
|
|
|
{
|
2016-05-09 08:29:06 +00:00
|
|
|
// only MODULEs & TRACKs can be locked at this time.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetLocked
|
|
|
|
* modifies 'lock' status for of the item.
|
|
|
|
*/
|
|
|
|
virtual void SetLocked( bool aLocked )
|
|
|
|
{
|
|
|
|
// only MODULEs & TRACKs can be locked at this time.
|
2008-04-14 19:22:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function DeleteStructure
|
2019-12-10 13:49:28 +00:00
|
|
|
* deletes this object after removing from its parent if it has one.
|
2008-04-14 19:22:48 +00:00
|
|
|
*/
|
2016-12-10 15:20:21 +00:00
|
|
|
void DeleteStructure();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2008-05-05 19:56:06 +00:00
|
|
|
/**
|
|
|
|
* Function ShowShape
|
2020-10-04 14:19:33 +00:00
|
|
|
* converts the enum PCB_SHAPE_TYPE_T integer value to a wxString.
|
2008-05-05 19:56:06 +00:00
|
|
|
*/
|
2020-10-04 14:19:33 +00:00
|
|
|
static wxString ShowShape( PCB_SHAPE_TYPE_T aShape );
|
2008-05-05 19:56:06 +00:00
|
|
|
|
2011-08-01 15:29:27 +00:00
|
|
|
// Some geometric transforms, that must be rewritten for derived classes
|
2009-08-01 19:26:05 +00:00
|
|
|
/**
|
|
|
|
* Function Move
|
|
|
|
* move this object.
|
2010-12-14 15:56:30 +00:00
|
|
|
* @param aMoveVector - the move vector for this object.
|
2009-08-01 19:26:05 +00:00
|
|
|
*/
|
2011-08-01 15:29:27 +00:00
|
|
|
virtual void Move( const wxPoint& aMoveVector )
|
2009-08-01 19:26:05 +00:00
|
|
|
{
|
2018-05-11 12:01:30 +00:00
|
|
|
wxFAIL_MSG( wxString::Format( wxT( "virtual BOARD_ITEM::Move called for %s" ),
|
|
|
|
GetClass() ) );
|
2009-08-01 19:26:05 +00:00
|
|
|
}
|
2009-08-17 02:59:38 +00:00
|
|
|
|
2017-09-28 16:38:54 +00:00
|
|
|
void Move( const VECTOR2I& aMoveVector )
|
|
|
|
{
|
|
|
|
Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
|
|
|
|
}
|
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
/**
|
|
|
|
* Function Rotate
|
|
|
|
* Rotate this object.
|
2010-12-28 11:24:42 +00:00
|
|
|
* @param aRotCentre - the rotation point.
|
2009-08-01 19:26:05 +00:00
|
|
|
* @param aAngle - the rotation angle in 0.1 degree.
|
|
|
|
*/
|
2011-12-14 04:29:25 +00:00
|
|
|
virtual void Rotate( const wxPoint& aRotCentre, double aAngle )
|
2009-08-01 19:26:05 +00:00
|
|
|
{
|
2011-08-01 15:29:27 +00:00
|
|
|
wxMessageBox( wxT( "virtual BOARD_ITEM::Rotate used, should not occur" ), GetClass() );
|
2009-08-01 19:26:05 +00:00
|
|
|
}
|
2009-08-17 02:59:38 +00:00
|
|
|
|
2017-09-28 16:38:54 +00:00
|
|
|
void Rotate( const VECTOR2I& aRotCentre, double aAngle )
|
|
|
|
{
|
|
|
|
Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
|
|
|
|
}
|
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
/**
|
|
|
|
* Function Flip
|
|
|
|
* Flip this object, i.e. change the board side for this object
|
2010-12-28 11:24:42 +00:00
|
|
|
* @param aCentre - the rotation point.
|
2019-07-12 21:02:10 +00:00
|
|
|
* @param aFlipLeftRight - mirror across Y axis instead of X (the default)
|
2009-08-01 19:26:05 +00:00
|
|
|
*/
|
2019-07-12 21:02:10 +00:00
|
|
|
virtual void Flip( const wxPoint& aCentre, bool aFlipLeftRight )
|
2009-08-01 19:26:05 +00:00
|
|
|
{
|
2011-08-01 15:29:27 +00:00
|
|
|
wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() );
|
2009-08-01 19:26:05 +00:00
|
|
|
}
|
2009-08-17 02:59:38 +00:00
|
|
|
|
2019-07-12 21:02:10 +00:00
|
|
|
void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
2017-09-28 16:38:54 +00:00
|
|
|
{
|
2019-07-12 21:02:10 +00:00
|
|
|
Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
|
2017-09-28 16:38:54 +00:00
|
|
|
}
|
|
|
|
|
2009-08-17 02:59:38 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoard
|
|
|
|
* returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
|
|
|
|
*/
|
|
|
|
virtual BOARD* GetBoard() const;
|
2011-07-14 15:42:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetLayerName
|
|
|
|
* returns the name of the PCB layer on which the item resides.
|
|
|
|
*
|
|
|
|
* @return wxString containing the layer name associated with this item.
|
|
|
|
*/
|
|
|
|
wxString GetLayerName() const;
|
2012-04-12 21:31:31 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
2017-11-29 18:51:01 +00:00
|
|
|
|
2018-11-14 23:34:32 +00:00
|
|
|
/**
|
|
|
|
* Function TransformShapeWithClearanceToPolygon
|
|
|
|
* Convert the item shape to a closed polygon
|
|
|
|
* Used in filling zones calculations
|
|
|
|
* Circles and arcs are approximated by segments
|
|
|
|
* @param aCornerBuffer = a buffer to store the polygon
|
|
|
|
* @param aClearanceValue = the clearance around the pad
|
2019-05-14 12:39:34 +00:00
|
|
|
* @param aError = the maximum deviation from true circle
|
2018-11-14 23:34:32 +00:00
|
|
|
* @param ignoreLineWidth = used for edge cut items where the line width is only
|
|
|
|
* for visualization
|
|
|
|
*/
|
2017-11-29 18:51:01 +00:00
|
|
|
virtual void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
|
2020-08-12 21:18:13 +00:00
|
|
|
PCB_LAYER_ID aLayer,
|
|
|
|
int aClearanceValue,
|
|
|
|
int aError = ARC_LOW_DEF,
|
|
|
|
bool ignoreLineWidth = false ) const;
|
2020-05-21 17:42:42 +00:00
|
|
|
|
2020-07-24 22:08:36 +00:00
|
|
|
struct ptr_cmp
|
|
|
|
{
|
|
|
|
bool operator() ( const BOARD_ITEM* a, const BOARD_ITEM* b ) const;
|
|
|
|
};
|
|
|
|
|
2020-05-21 17:42:42 +00:00
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Helper function
|
|
|
|
* Return a string (to be shown to the user) describing a layer mask.
|
|
|
|
* The BOARD is needed because layer names are (somewhat) customizable
|
|
|
|
*/
|
2020-09-19 16:12:00 +00:00
|
|
|
virtual wxString LayerMaskDescribe() const;
|
2008-04-14 19:22:48 +00:00
|
|
|
};
|
|
|
|
|
2020-02-02 18:40:14 +00:00
|
|
|
#ifndef SWIG
|
|
|
|
DECLARE_ENUM_TO_WXANY( PCB_LAYER_ID );
|
|
|
|
#endif
|
|
|
|
|
2020-07-19 21:22:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A singleton item of this class is returned for a weak reference that no longer exists.
|
|
|
|
* Its sole purpose is to flag the item as having been deleted.
|
|
|
|
*/
|
|
|
|
class DELETED_BOARD_ITEM : public BOARD_ITEM
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DELETED_BOARD_ITEM() :
|
|
|
|
BOARD_ITEM( nullptr, NOT_USED )
|
|
|
|
{}
|
|
|
|
|
|
|
|
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
|
|
|
|
{
|
|
|
|
return _( "(Deleted Item)" );
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString GetClass() const override
|
|
|
|
{
|
|
|
|
return wxT( "DELETED_BOARD_ITEM" );
|
|
|
|
}
|
|
|
|
|
|
|
|
// pure virtuals:
|
|
|
|
void SetPosition( const wxPoint& ) override {}
|
|
|
|
|
|
|
|
wxPoint GetPosition() const override {
|
|
|
|
return wxPoint(0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static DELETED_BOARD_ITEM* GetInstance()
|
|
|
|
{
|
|
|
|
static DELETED_BOARD_ITEM* item = nullptr;
|
|
|
|
|
|
|
|
if( !item )
|
|
|
|
item = new DELETED_BOARD_ITEM();
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(DEBUG)
|
|
|
|
void Show( int , std::ostream& ) const override {}
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
#endif /* BOARD_ITEM_STRUCT_H */
|