27#include <math/vector2d.h>
29#include <geometry/shape.h>
30#include <geometry/shape_line_chain.h>
32#include "pns_layerset.h"
39class PNS_HORIZON_PARENT_ITEM;
43 MK_VIOLATION = ( 1 << 3 ),
44 MK_LOCKED = ( 1 << 4 ),
45 MK_DP_COUPLED = ( 1 << 5 ),
85 m_isCompoundShapePrimitive =
false;
88 ITEM(
const ITEM& aOther )
90 m_layers = aOther.m_layers;
92 m_movable = aOther.m_movable;
93 m_kind = aOther.m_kind;
94 m_parent = aOther.m_parent;
95 m_owner = aOther.m_owner;
96 m_marker = aOther.m_marker;
97 m_rank = aOther.m_rank;
98 m_routable = aOther.m_routable;
99 m_isVirtual = aOther.m_isVirtual;
100 m_isCompoundShapePrimitive = aOther.m_isCompoundShapePrimitive;
116 virtual const SHAPE_LINE_CHAIN Hull(
int aClearance = 0,
int aWalkaroundThickness = 0,
117 int aLayer = -1 )
const
122 virtual const SHAPE_LINE_CHAIN HoleHull(
int aClearance,
int aWalkaroundThickness,
141 return ( aKindMask & m_kind ) != 0;
150 const PNS_HORIZON_PARENT_ITEM* Parent()
const {
return m_parent; }
152 void SetNet(
int aNet ) { m_net = aNet; }
153 int Net()
const {
return m_net; }
155 const LAYER_RANGE& Layers()
const {
return m_layers; }
156 void SetLayers(
const LAYER_RANGE& aLayers ) { m_layers = aLayers; }
158 void SetLayer(
int aLayer ) { m_layers =
LAYER_RANGE( aLayer, aLayer ); }
159 virtual int Layer()
const {
return Layers().Start(); }
166 return Layers().Overlaps( aOther->Layers() );
184 return m_owner == aNode;
196 bool Collide(
const ITEM* aOther,
const NODE* aNode,
bool aDifferentNetsOnly =
true )
const;
206 virtual const SHAPE* Hole()
const
211 virtual void Mark(
int aMarker )
const { m_marker = aMarker; }
212 virtual void Unmark(
int aMarker = -1 )
const { m_marker &= ~aMarker; }
213 virtual int Marker()
const {
return m_marker; }
215 virtual void SetRank(
int aRank ) { m_rank = aRank; }
216 virtual int Rank()
const {
return m_rank; }
218 virtual VECTOR2I Anchor(
int n )
const
223 virtual int AnchorCount()
const
228 bool IsLocked()
const
230 return Marker() & MK_LOCKED;
233 void SetRoutable(
bool aRoutable ) { m_routable = aRoutable; }
234 bool IsRoutable()
const {
return m_routable; }
236 bool IsVirtual()
const
241 void SetIsCompoundShapePrimitive() { m_isCompoundShapePrimitive =
true; }
242 bool IsCompoundShapePrimitive()
const {
return m_isCompoundShapePrimitive; }
245 bool collideSimple(
const ITEM* aOther,
const NODE* aNode,
bool aDifferentNetsOnly )
const;
250 const PNS_HORIZON_PARENT_ITEM* m_parent;
256 mutable int m_marker;
260 bool m_isCompoundShapePrimitive;
263template<
typename T,
typename S>
264std::unique_ptr<T> ItemCast( std::unique_ptr<S> aPtr )
266 static_assert( std::is_base_of<ITEM, S>::value,
"Need to be handed a ITEM!" );
267 static_assert( std::is_base_of<ITEM, T>::value,
"Need to cast to an ITEM!" );
268 return std::unique_ptr<T>(
static_cast<T*
>( aPtr.release() ) );
272std::unique_ptr< typename std::remove_const<T>::type > Clone(
const T& aItem )
274 static_assert( std::is_base_of<ITEM, T>::value,
"Need to be handed an ITEM!" );
275 return std::unique_ptr<typename std::remove_const<T>::type>( aItem.Clone() );
Represent a contiguous set of PCB layers.
Definition pns_layerset.h:32
Base class for PNS router board items.
Definition pns_item.h:57
void SetOwner(NODE *aOwner)
Set the node that owns this item.
Definition pns_item.h:177
PnsKind Kind() const
Return the type (kind) of the item.
Definition pns_item.h:131
virtual ITEM * Clone() const =0
Return a deep copy of the item.
NODE * Owner() const
Return the owner of this item, or NULL if there's none.
Definition pns_item.h:172
bool BelongsTo(NODE *aNode) const
Definition pns_item.h:182
virtual const SHAPE * Shape() const
Return the geometrical shape of the item.
Definition pns_item.h:201
static const int UnusedNet
Supported item types.
Definition pns_item.h:59
bool OfKind(int aKindMask) const
Return true if the item's type matches the mask aKindMask.
Definition pns_item.h:139
bool Collide(const ITEM *aOther, const NODE *aNode, bool aDifferentNetsOnly=true) const
Check for a collision (clearance violation) with between us and item aOther.
Definition pns_item.cpp:132
std::string KindStr() const
Returns the kind of the item, as string.
Definition pns_item.cpp:161
bool LayersOverlap(const ITEM *aOther) const
Return true if the set of layers spanned by aOther overlaps our layers.
Definition pns_item.h:164
Keep the router "world" - i.e.
Definition pns_node.h:148
Definition pns_horizon_iface.hpp:29
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Definition shape_line_chain.h:81
An abstract shape on 2D plane.
Definition shape.h:117